/ *
* ( C) C o p y r i g h t 2 0 0 2
* Daniel E n g s t r <EFBFBD> m , O m i c r o n C e t i A B , d a n i e l @omicron.se
*
* See f i l e C R E D I T S f o r l i s t o f p e o p l e w h o c o n t r i b u t e d t o t h i s
* project.
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version 2 of
* the L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n ,
* MA 0 2 1 1 1 - 1 3 0 7 U S A
* /
/ *
* Based o n m s b i o s . c f r o m r o l o 1 . 6 :
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* ( C) C o p y r i g h t 2 0 0 0
* Sysgo R e a l - T i m e S o l u t i o n s G m b H
* Klein- W i n t e r n h e i m , G e r m a n y
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
# include " b i o s . h "
/ *
* During i t ' s i n i t i a l i z a t i o n p h a s e , b e f o r e s w i t c h i n g t o p r o t e c t e d
* mode, t h e L i n u x K e r n e l m a k e s a f e w B I O S c a l l s . T h i s w o n ' t w o r k
* if t h e b o a r d d o e s n o t h a v e a B I O S .
*
* This i s a v e r y m i n i m a l i s i c B I O S t h a t s u p p l i e s j u s t e n o u g h
* functionality t o k e e p t h e L i n u x K e r n e l h a p p y . I t i s N O T
* a g e n e r a l p u r p o s e r e p l a c e m e n t f o r a r e a l B I O S ! !
* /
.section .bios , " ax"
.code16
.org 0
/* a call to f000:0 should warmboot */
jmp r e a l m o d e _ r e s e t
.globl rm_int00
rm_int00 :
pushw $ 0
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int01
rm_int01 :
pushw $ 1
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int02
rm_int02 :
pushw $ 2
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int03
rm_int03 :
pushw $ 3
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int04
rm_int04 :
pushw $ 4
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int05
rm_int05 :
pushw $ 5
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int06
rm_int06 :
pushw $ 6
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int07
rm_int07 :
pushw $ 7
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int08
rm_int08 :
pushw $ 8
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int09
rm_int09 :
pushw $ 9
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0a
rm_int0a :
pushw $ 1 0
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0b
rm_int0b :
pushw $ 1 1
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0c
rm_int0c :
pushw $ 1 2
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0d
rm_int0d :
pushw $ 1 3
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0e
rm_int0e :
pushw $ 1 4
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int0f
rm_int0f :
pushw $ 1 5
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int10
rm_int10 :
pushw $ 1 6
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int11
rm_int11 :
pushw $ 1 7
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int12
rm_int12 :
pushw $ 1 8
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int13
rm_int13 :
pushw $ 1 9
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int14
rm_int14 :
pushw $ 2 0
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int15
rm_int15 :
pushw $ 2 1
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int16
rm_int16 :
pushw $ 2 2
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int17
rm_int17 :
pushw $ 2 3
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int18
rm_int18 :
pushw $ 2 4
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int19
rm_int19 :
pushw $ 2 5
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1a
rm_int1a :
pushw $ 2 6
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1b
rm_int1b :
pushw $ 2 7
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1c
rm_int1c :
pushw $ 2 8
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1d
rm_int1d :
pushw $ 2 9
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1e
rm_int1e :
pushw $ 3 0
jmp a n y _ i n t e r r u p t 1 6
.globl rm_int1f
rm_int1f :
pushw $ 3 1
jmp a n y _ i n t e r r u p t 1 6
.globl rm_def_int
rm_def_int :
iret
/ *
* All i n t e r r u p t j u m p t a b l e e n t r i e s j u m p t o h e r e
* after p u s h i n g t h e i n t e r r u p t v e c t o r n u m b e r o n t o t h e
* stack.
* /
any_interrupt16 :
MAKE_ B I O S _ S T A C K
gs m o v w O F F S _ V E C T O R ( % b p ) , % a x
cmpw $ 0 x10 , % a x
je L i n t _ 1 0 h
cmpw $ 0 x11 , % a x
je L i n t _ 1 1 h
cmpw $ 0 x12 , % a x
je L i n t _ 1 2 h
cmpw $ 0 x13 , % a x
je L i n t _ 1 3 h
cmpw $ 0 x15 , % a x
je L i n t _ 1 5 h
cmpw $ 0 x16 , % a x
je L i n t _ 1 6 h
cmpw $ 0 x1 a , % a x
je L i n t _ 1 a h
movw $ 0 x f f f f , % a x
jmp L o u t
Lint_10h : /* VGA BIOS services */
call b i o s _ 1 0 h
jmp L o u t
Lint_11h :
call b i o s _ 1 1 h
jmp L o u t
Lint_12h :
call b i o s _ 1 2 h
jmp L o u t
Lint_13h : /* BIOS disk services */
call b i o s _ 1 3 h
jmp L o u t
Lint_15h : /* Misc. BIOS services */
call b i o s _ 1 5 h
jmp L o u t
Lint_16h : /* keyboard services */
call b i o s _ 1 6 h
jmp L o u t
Lint_1ah : /* PCI bios */
call b i o s _ 1 a h
jmp L o u t
Lout :
cmpw $ 0 , % a x
je L h a n d e l e d
/ * Insert c o d e f o r u n h a n d e l e d I N T s h e r e .
*
* ROLO p r i n t s a m e s s a g e t o t h e c o n s o l e
* ( we c o u l d d o t h a t b u t t h e n w e ' r e i n 1 6 b i t m o d e
* so w e ' l l h a v e t o g e t b a c k i n t o 3 2 b i t m o d e
* to u s e t h e c o n s o l e I / O r o u t i n e s ( i f w e d o t h i s
* we s h u l s m a k e i n t 0 x10 a n d i n t 0 x16 w o r k a s w e l l ) )
* /
Lhandeled :
RESTORE_ C A L L E R S _ S T A C K
addw $ 2 ,% s p / * d u m p v e c t o r n u m b e r * /
iret / * r e t u r n f r o m i n t e r r u p t * /
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 0 h - - V G A s e r v i c e s
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_10h :
gs m o v w O F F S _ A X ( % b p ) , % a x
shrw $ 8 , % a x
cmpw $ 0 x3 , % a x
je L c u r _ p o s
cmpw $ 0 x f , % a x
je L v i d _ s t a t e
cmpw $ 0 x12 , % a x
je L v i d _ c f g
movw $ 0 x f f f f , % a x
ret
Lcur_pos : /* Read Cursor Position and Size */
gs m o v w $ 0 , O F F S _ C X ( % b p )
gs m o v w $ 0 , O F F S _ D X ( % b p )
xorw % a x , % a x
ret
Lvid_state : /* Get Video State */
gs m o v w $ ( 8 0 < < 8 | 0 x03 ) , O F F S _ A X ( % b p ) / * 8 0 c o l u m n s , 8 0 x25 , 1 6 c o l o r s * /
gs m o v w $ 0 , O F F S _ B X ( % b p )
xorw % a x , % a x
ret
Lvid_cfg : /* Video Subsystem Configuration (EGA/VGA) */
gs m o v w $ 0 x10 , O F F S _ B X ( % b p ) / * i n d i c a t e C G A / M D A / H G A * /
xorw % a x , % a x
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 1 h - - E q u i p m e n t d e t e r m i n a t i o n
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_11h :
cs m o v w b i o s _ e q u i p m e n t , % a x
gs m o v w % a x , O F F S _ A X ( % b p )
xorw % a x , % a x
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 2 h - - G e t M e m o r y S i z e
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_12h :
cs m o v w r a m _ i n _ 6 4 k b _ c h u n k s , % a x
cmpw $ 0 x a , % a x
ja b12 _ m o r e _ t h a n _ 6 4 0 k
shlw $ 6 , % a x
jmp b12 _ r e t u r n
b12_more_than_640k :
movw $ 0 x28 0 , % a x
b12_return :
gs m o v w % a x , O F F S _ A X ( % b p ) / * r e t u r n n u m b e r o f k i l o b y t e s i n a x * /
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
andw $ 0 x f f f e , % a x / * c l e a r c a r r y - - f u n c t i o n s u c c e e d e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 3 h - - D i s k s e r v i c e s
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_13h :
gs m o v w O F F S _ A X ( % b p ) , % a x
shrw $ 8 , % a x
cmpw $ 0 x15 , % a x
je L f u n c _ 1 5 h
movw $ 0 x f f f f , % a x
ret
Lfunc_15h :
gs m o v w O F F S _ A X ( % b p ) , % a x
andw $ 0 x f f , % a x / * r e t u r n A H =0 - > d r i v e n o t p r e s e n t * /
gs m o v w % a x , O F F S _ A X ( % b p )
xorw % a x , % a x
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 5 h - - M i s c e l l a n e o u s s e r v i c e s
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_15h :
gs m o v w O F F S _ A X ( % b p ) , % a x
shrw $ 8 , % a x
cmpw $ 0 x c0 , % a x
je L f u n c _ c0 h
cmpw $ 0 x e 8 , % a x
je L f u n c _ e 8 h
cmpw $ 0 x88 , % a x
je L f u n c _ 8 8 h
movw $ 0 x f f f f , % a x
ret
Lfunc_c0h : /* Return System Configuration Parameters (PS2 only) */
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
orw $ 1 , % a x / * r e t u r n c a r r y - - f u n c t i o n n o t s u p p o r t e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
Lfunc_e8h :
gs m o v w O F F S _ A X ( % b p ) , % a x
andw $ 0 x f f , % a x
cmpw $ 1 , % a x
je L f u n c _ e 8 0 1 h
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
orw $ 1 , % a x / * r e t u r n c a r r y - - f u n c t i o n n o t s u p p o r t e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
Lfunc_e801h : /* Get memory size for >64M Configurations */
cs m o v w r a m _ i n _ 6 4 k b _ c h u n k s , % a x
cmpw $ 0 x10 0 , % a x
ja e 8 0 1 _ m o r e _ t h a n _ 1 6 m b
shlw $ 6 , % a x / * m u l t i p l y b y 6 4 * /
subw $ 0 x40 0 , % a x / * 1 s t m e g d o e s n o t c o u n t * /
gs m o v w % a x , O F F S _ A X ( % b p ) / * r e t u r n m e m o r y s i z e b e t w e e n 1 M a n d 1 6 M i n 1 k b c h u n k s i n A X a n d C X * /
gs m o v w % a x , O F F S _ C X ( % b p )
gs m o v w $ 0 , O F F S _ B X ( % b p ) / * s e t B X a n d D X t o 0 * /
gs m o v w $ 0 , O F F S _ D X ( % b p )
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
andw $ 0 x f f f e , % a x / * c l e a r c a r r y - - f u n c t i o n s u c c e e d e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
e801_more_than_16mb :
subw $ 0 x10 0 , % a x / * s u b t r a c t 1 6 M B * /
gs m o v w $ 0 x3 c00 , O F F S _ A X ( % b p ) / * r e t u r n 0 x3 c00 ( 1 6 M B - 1 M B ) i n A X a n d C X * /
gs m o v w $ 0 x3 c00 , O F F S _ C X ( % b p )
gs m o v w % a x , O F F S _ B X ( % b p ) / * s e t B X a n d D X t o n u m b e r o f 6 4 k b c h u n k s a b o v e 1 6 M B * /
gs m o v w % a x , O F F S _ D X ( % b p )
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
andw $ 0 x f f f e , % a x / * c l e a r c a r r y - - f u n c t i o n s u c c e e d e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
Lfunc_88h :
cs m o v w r a m _ i n _ 6 4 k b _ c h u n k s , % a x
cmpw $ 0 x10 0 , % a x
jna b88 _ n o t _ m o r e _ t h a n 1 6
movw $ 0 x10 0 , % a x
b88_not_more_than16 :
shlw $ 6 , % a x
subw $ 0 x40 0 , % a x / * 1 s t m e g d o e s n o t c o u n t * /
gs m o v w % a x , O F F S _ A X ( % b p ) / * r e t u r n n u m b e r o f k i l o b y t e s b e t w e e n 1 6 M B a n d 1 6 M B i n a x * /
gs m o v w O F F S _ F L A G S ( % b p ) , % a x
andw $ 0 x f f f e , % a x / * c l e a r c a r r y - - f u n c t i o n s u c c e e d e d * /
gs m o v w % a x , O F F S _ F L A G S ( % b p )
xorw % a x , % a x
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 6 h - - k e y b o a r d s e r v i c e s
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_16h :
gs m o v w O F F S _ A X ( % b p ) , % a x
shrw $ 8 , % a x
cmpw $ 0 x03 , % a x
je L f u n c _ 0 3 h
movw $ 0 x f f f f , % a x
ret
Lfunc_03h :
xorw % a x , % a x / * d o n o t h i n g - - f u n c t i o n n o t s u p p o r t e d * /
ret
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* BIOS i n t e r r u p t 1 a h - - P C I b i o s
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
bios_1ah :
gs m o v w O F F S _ A X ( % b p ) , % a x
cmpb $ 0 x b1 , % a h
je L f u n c _ b1 h
movw $ 0 x f f f f , % a x
ret
Lfunc_b1h :
call r e a l m o d e _ p c i _ b i o s
xorw % a x , % a x / * d o n o t h i n g - - f u n c t i o n n o t s u p p o r t e d * /
ret
.globl ram_in_64kb_chunks
ram_in_64kb_chunks :
.word 0
.globl bios_equipment
bios_equipment :
.word 0