2005-04-16 15:20:36 -07:00
/ *
* arch/ a l p h a / l i b / c a l l b a c k _ s r m . S
* /
# include < a s m / c o n s o l e . h >
2016-01-11 09:51:29 -05:00
# include < a s m / e x p o r t . h >
2005-04-16 15:20:36 -07:00
.text
# define H W R P B _ C R B _ O F F S E T 0 x c0
# if d e f i n e d ( C O N F I G _ A L P H A _ S R M ) | | d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C )
.align 4
srm_dispatch :
# if d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C )
ldl $ 4 ,a l p h a _ u s i n g _ s r m
beq $ 4 ,n o s r m
# endif
ldq $ 0 ,h w r p b # g p i s s e t u p b y C A L L B A C K m a c r o .
ldl $ 2 5 ,0 ( $ 2 5 ) # P i c k u p t h e w r a p p e r d a t a .
mov $ 2 0 ,$ 2 1 # S h i f t a r g u m e n t s r i g h t .
mov $ 1 9 ,$ 2 0
ldq $ 1 ,H W R P B _ C R B _ O F F S E T ( $ 0 )
mov $ 1 8 ,$ 1 9
mov $ 1 7 ,$ 1 8
mov $ 1 6 ,$ 1 7
addq $ 0 ,$ 1 ,$ 2 # C R B a d d r e s s
ldq $ 2 7 ,0 ( $ 2 ) # D I S P A T C H p r o c e d u r e d e s c r i p t o r ( V M S c a l l s t d )
extwl $ 2 5 ,0 ,$ 1 6 # S R M c a l l b a c k f u n c t i o n c o d e
ldq $ 3 ,8 ( $ 2 7 ) # c a l l a d d r e s s
extwl $ 2 5 ,2 ,$ 2 5 # a r g u m e n t i n f o r m a t i o n ( V M S c a l l i n g s t d )
jmp ( $ 3 ) # R e t u r n d i r e c t l y t o c a l l e r o f w r a p p e r .
.align 4
.globl srm_fixup
.ent srm_fixup
srm_fixup :
ldgp $ 2 9 ,0 ( $ 2 7 )
# if d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C )
ldl $ 4 ,a l p h a _ u s i n g _ s r m
beq $ 4 ,n o s r m
# endif
ldq $ 0 ,h w r p b
ldq $ 1 ,H W R P B _ C R B _ O F F S E T ( $ 0 )
addq $ 0 ,$ 1 ,$ 2 # C R B a d d r e s s
ldq $ 2 7 ,1 6 ( $ 2 ) # V A o f F I X U P p r o c e d u r e d e s c r i p t o r
ldq $ 3 ,8 ( $ 2 7 ) # c a l l a d d r e s s
lda $ 2 5 ,2 ( $ 3 1 ) # t w o i n t e g e r a r g u m e n t s
jmp ( $ 3 ) # R e t u r n d i r e c t l y t o c a l l e r o f s r m _ f i x u p .
.end srm_fixup
# if d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C )
.align 3
nosrm :
lda $ 0 ,- 1 ( $ 3 1 )
ret
# endif
# define C A L L B A C K ( N A M E , C O D E , A R G _ C N T ) \
.align 4 ; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
ldgp $ 2 9 ,0 ( $ 2 7 ) ; br $25,srm_dispatch; .word CODE, ARG_CNT; .end callback_##NAME
# else / * d e f i n e d ( C O N F I G _ A L P H A _ S R M ) | | d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C ) * /
# define C A L L B A C K ( N A M E , C O D E , A R G _ C N T ) \
.align 3 ; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
lda $ 0 ,- 1 ( $ 3 1 ) ; ret; .end callback_##NAME
.align 3
.globl srm_fixup
.ent srm_fixup
srm_fixup :
lda $ 0 ,- 1 ( $ 3 1 )
ret
.end srm_fixup
# endif / * d e f i n e d ( C O N F I G _ A L P H A _ S R M ) | | d e f i n e d ( C O N F I G _ A L P H A _ G E N E R I C ) * /
CALLBACK( p u t s , C C B _ P U T S , 4 )
CALLBACK( o p e n , C C B _ O P E N , 3 )
CALLBACK( c l o s e , C C B _ C L O S E , 2 )
CALLBACK( r e a d , C C B _ R E A D , 5 )
CALLBACK( o p e n _ c o n s o l e , C C B _ O P E N _ C O N S O L E , 1 )
CALLBACK( c l o s e _ c o n s o l e , C C B _ C L O S E _ C O N S O L E , 1 )
CALLBACK( g e t e n v , C C B _ G E T _ E N V , 4 )
CALLBACK( s e t e n v , C C B _ S E T _ E N V , 4 )
CALLBACK( g e t c , C C B _ G E T C , 2 )
CALLBACK( r e s e t _ t e r m , C C B _ R E S E T _ T E R M , 2 )
CALLBACK( t e r m _ i n t , C C B _ S E T _ T E R M _ I N T , 3 )
CALLBACK( t e r m _ c t l , C C B _ S E T _ T E R M _ C T L , 3 )
CALLBACK( p r o c e s s _ k e y c o d e , C C B _ P R O C E S S _ K E Y C O D E , 3 )
CALLBACK( i o c t l , C C B _ I O C T L , 6 )
CALLBACK( w r i t e , C C B _ W R I T E , 5 )
CALLBACK( r e s e t _ e n v , C C B _ R E S E T _ E N V , 4 )
CALLBACK( s a v e _ e n v , C C B _ S A V E _ E N V , 1 )
CALLBACK( p s w i t c h , C C B _ P S W I T C H , 3 )
CALLBACK( b i o s _ e m u l , C C B _ B I O S _ E M U L , 5 )
2016-01-11 09:51:29 -05:00
EXPORT_ S Y M B O L ( c a l l b a c k _ g e t e n v )
EXPORT_ S Y M B O L ( c a l l b a c k _ s e t e n v )
EXPORT_ S Y M B O L ( c a l l b a c k _ s a v e _ e n v )
2005-04-16 15:20:36 -07:00
.data
__alpha_using_srm : # For u s e b y b o o t p h e a d e r
.long 7 # value i s n o t 1 f o r l i n k d e b u g g i n g
.weak alpha_ u s i n g _ s r m ; alpha_using_srm = __alpha_using_srm
__callback_init_done : # For u s e b y b o o t p h e a d e r
.long 7 # value i s n o t 1 f o r l i n k d e b u g g i n g
.weak callback_ i n i t _ d o n e ; callback_init_done = __callback_init_done