2005-04-17 02:20:36 +04:00
/ *
* arch/ v85 0 / k e r n e l / e n t r y . S - - L o w - l e v e l s y s t e m - c a l l h a n d l i n g , t r a p h a n d l e r s ,
* and c o n t e x t - s w i t c h i n g
*
* Copyright ( C ) 2 0 0 1 ,0 2 ,0 3 N E C E l e c t r o n i c s C o r p o r a t i o n
* Copyright ( C ) 2 0 0 1 ,0 2 ,0 3 M i l e s B a d e r < m i l e s @gnu.org>
*
* This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l
* Public L i c e n s e . S e e t h e f i l e C O P Y I N G i n t h e m a i n d i r e c t o r y o f t h i s
* archive f o r m o r e d e t a i l s .
*
* Written b y M i l e s B a d e r < m i l e s @gnu.org>
* /
# include < l i n u x / s y s . h >
# include < a s m / e n t r y . h >
# include < a s m / c u r r e n t . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / c l i n k a g e . h >
# include < a s m / p r o c e s s o r . h >
# include < a s m / i r q . h >
# include < a s m / e r r n o . h >
2005-09-09 23:39:46 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
/* Make a slightly more convenient alias for C_SYMBOL_NAME. */
# define C S Y M C _ S Y M B O L _ N A M E
/* The offset of the struct pt_regs in a state-save-frame on the stack. */
# define P T O S T A T E _ S A V E _ P T _ O F F S E T
/* Save argument registers to the state-save-frame pointed to by EP. */
# define S A V E _ A R G _ R E G S \
sst. w r6 , P T O + P T _ G P R ( 6 ) [ e p ] ; \
sst. w r7 , P T O + P T _ G P R ( 7 ) [ e p ] ; \
sst. w r8 , P T O + P T _ G P R ( 8 ) [ e p ] ; \
sst. w r9 , P T O + P T _ G P R ( 9 ) [ e p ]
/* Restore argument registers from the state-save-frame pointed to by EP. */
# define R E S T O R E _ A R G _ R E G S \
sld. w P T O + P T _ G P R ( 6 ) [ e p ] , r6 ; \
sld. w P T O + P T _ G P R ( 7 ) [ e p ] , r7 ; \
sld. w P T O + P T _ G P R ( 8 ) [ e p ] , r8 ; \
sld. w P T O + P T _ G P R ( 9 ) [ e p ] , r9
/* Save value return registers to the state-save-frame pointed to by EP. */
# define S A V E _ R V A L _ R E G S \
sst. w r10 , P T O + P T _ G P R ( 1 0 ) [ e p ] ; \
sst. w r11 , P T O + P T _ G P R ( 1 1 ) [ e p ]
/* Restore value return registers from the state-save-frame pointed to by EP. */
# define R E S T O R E _ R V A L _ R E G S \
sld. w P T O + P T _ G P R ( 1 0 ) [ e p ] , r10 ; \
sld. w P T O + P T _ G P R ( 1 1 ) [ e p ] , r11
# define S A V E _ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S \
sst. w r1 , P T O + P T _ G P R ( 1 ) [ e p ] ; \
sst. w r5 , P T O + P T _ G P R ( 5 ) [ e p ]
# define S A V E _ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L \
sst. w r12 , P T O + P T _ G P R ( 1 2 ) [ e p ] ; \
sst. w r13 , P T O + P T _ G P R ( 1 3 ) [ e p ] ; \
sst. w r14 , P T O + P T _ G P R ( 1 4 ) [ e p ] ; \
sst. w r15 , P T O + P T _ G P R ( 1 5 ) [ e p ] ; \
sst. w r16 , P T O + P T _ G P R ( 1 6 ) [ e p ] ; \
sst. w r17 , P T O + P T _ G P R ( 1 7 ) [ e p ] ; \
sst. w r18 , P T O + P T _ G P R ( 1 8 ) [ e p ] ; \
sst. w r19 , P T O + P T _ G P R ( 1 9 ) [ e p ]
# define R E S T O R E _ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S \
sld. w P T O + P T _ G P R ( 1 ) [ e p ] , r1 ; \
sld. w P T O + P T _ G P R ( 5 ) [ e p ] , r5
# define R E S T O R E _ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L \
sld. w P T O + P T _ G P R ( 1 2 ) [ e p ] , r12 ; \
sld. w P T O + P T _ G P R ( 1 3 ) [ e p ] , r13 ; \
sld. w P T O + P T _ G P R ( 1 4 ) [ e p ] , r14 ; \
sld. w P T O + P T _ G P R ( 1 5 ) [ e p ] , r15 ; \
sld. w P T O + P T _ G P R ( 1 6 ) [ e p ] , r16 ; \
sld. w P T O + P T _ G P R ( 1 7 ) [ e p ] , r17 ; \
sld. w P T O + P T _ G P R ( 1 8 ) [ e p ] , r18 ; \
sld. w P T O + P T _ G P R ( 1 9 ) [ e p ] , r19
/* Save `call clobbered' registers to the state-save-frame pointed to by EP. */
# define S A V E _ C A L L _ C L O B B E R E D _ R E G S \
SAVE_ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S ; \
SAVE_ A R G _ R E G S ; \
SAVE_ R V A L _ R E G S ; \
SAVE_ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L
/ * Restore ` c a l l c l o b b e r e d ' r e g i s t e r s f r o m t h e s t a t e - s a v e - f r a m e p o i n t e d t o
by E P . * /
# define R E S T O R E _ C A L L _ C L O B B E R E D _ R E G S \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S ; \
RESTORE_ A R G _ R E G S ; \
RESTORE_ R V A L _ R E G S ; \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L
/ * Save ` c a l l c l o b b e r e d ' r e g i s t e r s e x c e p t f o r t h e r e t u r n - v a l u e r e g i s t e r s
to t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y E P . * /
# define S A V E _ C A L L _ C L O B B E R E D _ R E G S _ N O _ R V A L \
SAVE_ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S ; \
SAVE_ A R G _ R E G S ; \
SAVE_ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L
/ * Restore ` c a l l c l o b b e r e d ' r e g i s t e r s e x c e p t f o r t h e r e t u r n - v a l u e r e g i s t e r s
from t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y E P . * /
# define R E S T O R E _ C A L L _ C L O B B E R E D _ R E G S _ N O _ R V A L \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S _ B E F O R E _ A R G S ; \
RESTORE_ A R G _ R E G S ; \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S _ A F T E R _ R V A L
/* Save `call saved' registers to the state-save-frame pointed to by EP. */
# define S A V E _ C A L L _ S A V E D _ R E G S \
sst. w r2 , P T O + P T _ G P R ( 2 ) [ e p ] ; \
sst. w r20 , P T O + P T _ G P R ( 2 0 ) [ e p ] ; \
sst. w r21 , P T O + P T _ G P R ( 2 1 ) [ e p ] ; \
sst. w r22 , P T O + P T _ G P R ( 2 2 ) [ e p ] ; \
sst. w r23 , P T O + P T _ G P R ( 2 3 ) [ e p ] ; \
sst. w r24 , P T O + P T _ G P R ( 2 4 ) [ e p ] ; \
sst. w r25 , P T O + P T _ G P R ( 2 5 ) [ e p ] ; \
sst. w r26 , P T O + P T _ G P R ( 2 6 ) [ e p ] ; \
sst. w r27 , P T O + P T _ G P R ( 2 7 ) [ e p ] ; \
sst. w r28 , P T O + P T _ G P R ( 2 8 ) [ e p ] ; \
sst. w r29 , P T O + P T _ G P R ( 2 9 ) [ e p ]
/* Restore `call saved' registers from the state-save-frame pointed to by EP. */
# define R E S T O R E _ C A L L _ S A V E D _ R E G S \
sld. w P T O + P T _ G P R ( 2 ) [ e p ] , r2 ; \
sld. w P T O + P T _ G P R ( 2 0 ) [ e p ] , r20 ; \
sld. w P T O + P T _ G P R ( 2 1 ) [ e p ] , r21 ; \
sld. w P T O + P T _ G P R ( 2 2 ) [ e p ] , r22 ; \
sld. w P T O + P T _ G P R ( 2 3 ) [ e p ] , r23 ; \
sld. w P T O + P T _ G P R ( 2 4 ) [ e p ] , r24 ; \
sld. w P T O + P T _ G P R ( 2 5 ) [ e p ] , r25 ; \
sld. w P T O + P T _ G P R ( 2 6 ) [ e p ] , r26 ; \
sld. w P T O + P T _ G P R ( 2 7 ) [ e p ] , r27 ; \
sld. w P T O + P T _ G P R ( 2 8 ) [ e p ] , r28 ; \
sld. w P T O + P T _ G P R ( 2 9 ) [ e p ] , r29
/ * Save t h e P C s t o r e d i n t h e s p e c i a l r e g i s t e r S A V E R E G t o t h e s t a t e - s a v e - f r a m e
pointed t o b y E P . r19 i s c l o b b e r e d . * /
# define S A V E _ P C ( s a v e r e g ) \
stsr S R _ ## s a v e r e g , r 19 ; \
sst. w r19 , P T O + P T _ P C [ e p ]
/ * Restore t h e P C f r o m t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y E P , t o t h e s p e c i a l
register S A V E R E G . L P i s c l o b b e r e d ( i t i s u s e d a s a s c r a t c h r e g i s t e r
because t h e P O P _ S T A T E m a c r o r e s t o r e s i t , a n d t h i s m a c r o i s u s u a l l y u s e d
inside P O P _ S T A T E ) . * /
# define R E S T O R E _ P C ( s a v e r e g ) \
sld. w P T O + P T _ P C [ e p ] , l p ; \
ldsr l p , S R _ ## s a v e r e g
/ * Save t h e P S W r e g i s t e r s t o r e d i n t h e s p e c i a l r e g i s t e r S A V R E G t o t h e
state- s a v e - f r a m e p o i n t e d t o b y E P . r19 i s c l o b b e r e d . * /
# define S A V E _ P S W ( s a v e r e g ) \
stsr S R _ ## s a v e r e g , r 19 ; \
sst. w r19 , P T O + P T _ P S W [ e p ]
/ * Restore t h e P S W r e g i s t e r f r o m t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y E P , t o
the s p e c i a l r e g i s t e r S A V E R E G . L P i s c l o b b e r e d ( i t i s u s e d a s a s c r a t c h
register b e c a u s e t h e P O P _ S T A T E m a c r o r e s t o r e s i t , a n d t h i s m a c r o i s
usually u s e d i n s i d e P O P _ S T A T E ) . * /
# define R E S T O R E _ P S W ( s a v e r e g ) \
sld. w P T O + P T _ P S W [ e p ] , l p ; \
ldsr l p , S R _ ## s a v e r e g
/ * Save C T P C / C T P S W / C T B P r e g i s t e r s t o t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y R E G .
r1 9 i s c l o b b e r e d . * /
# define S A V E _ C T _ R E G S \
stsr S R _ C T P C , r19 ; \
sst. w r19 , P T O + P T _ C T P C [ e p ] ; \
stsr S R _ C T P S W , r19 ; \
sst. w r19 , P T O + P T _ C T P S W [ e p ] ; \
stsr S R _ C T B P , r19 ; \
sst. w r19 , P T O + P T _ C T B P [ e p ]
/ * Restore C T P C / C T P S W / C T B P r e g i s t e r s f r o m t h e s t a t e - s a v e - f r a m e p o i n t e d t o b y E P .
LP i s c l o b b e r e d ( i t i s u s e d a s a s c r a t c h r e g i s t e r b e c a u s e t h e P O P _ S T A T E
macro r e s t o r e s i t , a n d t h i s m a c r o i s u s u a l l y u s e d i n s i d e P O P _ S T A T E ) . * /
# define R E S T O R E _ C T _ R E G S \
sld. w P T O + P T _ C T P C [ e p ] , l p ; \
ldsr l p , S R _ C T P C ; \
sld. w P T O + P T _ C T P S W [ e p ] , l p ; \
ldsr l p , S R _ C T P S W ; \
sld. w P T O + P T _ C T B P [ e p ] , l p ; \
ldsr l p , S R _ C T B P
/ * Push r e g i s t e r s t a t e , e x c e p t f o r t h e s t a c k p o i n t e r , o n t h e s t a c k i n t h e
form o f a s t a t e - s a v e - f r a m e ( p l u s s o m e e x t r a p a d d i n g ) , i n p r e p a r a t i o n f o r
a s y s t e m c a l l . T h i s m a c r o m a k e s s u r e t h a t t h e E P , G P , a n d L P
registers a r e s a v e d , a n d T Y P E i d e n t i f i e s t h e s e t o f e x t r a r e g i s t e r s t o
be s a v e d a s w e l l . A l s o c o p i e s ( t h e n e w v a l u e o f ) S P t o E P . * /
# define P U S H _ S T A T E ( t y p e ) \
addi - S T A T E _ S A V E _ S I Z E , s p , s p ; /* Make room on the stack. */ \
st. w e p , P T O + P T _ G P R ( G P R _ E P ) [ s p ] ; \
mov s p , e p ; \
sst. w g p , P T O + P T _ G P R ( G P R _ G P ) [ e p ] ; \
sst. w l p , P T O + P T _ G P R ( G P R _ L P ) [ e p ] ; \
type ## _ S T A T E _ S A V E R
/ * Pop a r e g i s t e r s t a t e p u s h e d b y P U S H _ S T A T E , e x c e p t f o r t h e s t a c k p o i n t e r ,
2006-10-04 00:21:02 +04:00
from t h e s t a c k . * /
2005-04-17 02:20:36 +04:00
# define P O P _ S T A T E ( t y p e ) \
mov s p , e p ; \
type ## _ S T A T E _ R E S T O R E R ; \
sld. w P T O + P T _ G P R ( G P R _ G P ) [ e p ] , g p ; \
sld. w P T O + P T _ G P R ( G P R _ L P ) [ e p ] , l p ; \
sld. w P T O + P T _ G P R ( G P R _ E P ) [ e p ] , e p ; \
addi S T A T E _ S A V E _ S I Z E , s p , s p / * C l e a n u p o u r s t a c k s p a c e . * /
/ * Switch t o t h e k e r n e l s t a c k i f n e c e s s a r y , a n d p u s h r e g i s t e r s t a t e o n t h e
stack i n t h e f o r m o f a s t a t e - s a v e - f r a m e . A l s o l o a d t h e c u r r e n t t a s k
pointer i f s w i t c h i n g f r o m u s e r m o d e . T h e s t a c k - p o i n t e r ( r3 ) s h o u l d h a v e
already b e e n s a v e d t o t h e m e m o r y l o c a t i o n S P _ S A V E _ L O C ( t h e r e a s o n f o r
this i s t h a t t h e i n t e r r u p t v e c t o r s m a y b e b e y o n d a 2 2 - b i t s i g n e d o f f s e t
jump f r o m t h e a c t u a l i n t e r r u p t h a n d l e r , a n d t h i s a l l o w s t h e m t o s a v e t h e
stack- p o i n t e r a n d u s e t h a t r e g i s t e r t o d o a n i n d i r e c t j u m p ) . T h i s m a c r o
makes s u r e t h a t ` s p e c i a l ' r e g i s t e r s , s y s t e m r e g i s t e r s , a n d t h e s t a c k
pointer a r e s a v e d ; TYPE identifies the set of extra registers to be
saved a s w e l l . S Y S C A L L _ N U M i s t h e r e g i s t e r i n w h i c h t h e s y s t e m - c a l l
number t h i s s t a t e i s f o r i s s t o r e d ( r0 i f t h i s i s n ' t a s y s t e m c a l l ) .
Interrupts s h o u l d a l r e a d y b e d i s a b l e d w h e n c a l l i n g t h i s . * /
# define S A V E _ S T A T E ( t y p e , s y s c a l l _ n u m , s p _ s a v e _ l o c ) \
tst1 0 , K M ; /* See if already in kernel mode. */ \
bz 1 f ; \
ld. w s p _ s a v e _ l o c , s p ; /* ... yes, use saved SP. */ \
br 2 f ; \
1 : ld. w K S P , s p ; /* ... no, switch to kernel stack. */ \
2 : PUSH_ S T A T E ( t y p e ) ; \
ld. b K M , r19 ; /* Remember old kernel-mode. */ \
sst. w r19 , P T O + P T _ K E R N E L _ M O D E [ e p ] ; \
ld. w s p _ s a v e _ l o c , r19 ; /* Remember old SP. */ \
sst. w r19 , P T O + P T _ G P R ( G P R _ S P ) [ e p ] ; \
mov 1 , r19 ; /* Now definitely in kernel-mode. */ \
st. b r19 , K M ; \
GET_ C U R R E N T _ T A S K ( C U R R E N T _ T A S K ) ; /* Fetch the current task pointer. */ \
/* Save away the syscall number. */ \
sst. w s y s c a l l _ n u m , P T O + P T _ C U R _ S Y S C A L L [ e p ]
/ * Save r e g i s t e r s t a t e n o t n o r m a l l y s a v e d b y P U S H _ S T A T E f o r T Y P E , t o t h e
state- s a v e - f r a m e o n t h e s t a c k ; also copies SP to EP. r19 may be trashed. */
# define S A V E _ E X T R A _ S T A T E ( t y p e ) \
mov s p , e p ; \
type ## _ E X T R A _ S T A T E _ S A V E R
/ * Restore r e g i s t e r s t a t e n o t n o r m a l l y r e s t o r e d b y P O P _ S T A T E f o r T Y P E ,
from t h e s t a t e - s a v e - f r a m e o n t h e s t a c k ; also copies SP to EP.
r1 9 m a y b e t r a s h e d . * /
# define R E S T O R E _ E X T R A _ S T A T E ( t y p e ) \
mov s p , e p ; \
type ## _ E X T R A _ S T A T E _ R E S T O R E R
/ * Save a n y c a l l - c l o b b e r e d r e g i s t e r s n o t n o r m a l l y s a v e d b y P U S H _ S T A T E f o r
TYPE, t o t h e s t a t e - s a v e - f r a m e o n t h e s t a c k .
EP m a y b e t r a s h e d , b u t i s n o t g u a r a n t e e d t o c o n t a i n a c o p y o f S P
( unlike a f t e r m o s t S A V E _ . . . m a c r o s ) . r19 m a y b e t r a s h e d . * /
# define S A V E _ E X T R A _ S T A T E _ F O R _ S C H E D U L E ( t y p e ) \
type ## _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R
/ * Restore a n y c a l l - c l o b b e r e d r e g i s t e r s n o t n o r m a l l y r e s t o r e d b y
POP_ S T A T E f o r T Y P E , t o t h e s t a t e - s a v e - f r a m e o n t h e s t a c k .
EP m a y b e t r a s h e d , b u t i s n o t g u a r a n t e e d t o c o n t a i n a c o p y o f S P
( unlike a f t e r m o s t R E S T O R E _ . . . m a c r o s ) . r19 m a y b e t r a s h e d . * /
# define R E S T O R E _ E X T R A _ S T A T E _ F O R _ S C H E D U L E ( t y p e ) \
type ## _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R
/ * These a r e e x t r a _ s t a t e _ s a v e r / r e s t o r e r v a l u e s f o r a u s e r t r a p . N o t e
that w e s a v e t h e a r g u m e n t r e g i s t e r s s o t h a t r e s t a r t e d s y s c a l l s w i l l
function p r o p e r l y ( o t h e r w i s e i t w o u l d n ' t b e n e c e s s a r y ) , a n d w e m u s t
_ not_ r e s t o r e t h e r e t u r n - v a l u e r e g i s t e r s ( s o t h a t t r a p s c a n r e t u r n a
value! ) , b u t c a l l - c l o b b e r e d r e g i s t e r s a r e n o t s a v e d a t a l l , a s t h e
caller o f t h e s y s c a l l f u n c t i o n s h o u l d h a v e s a v e d t h e m . * /
# define T R A P _ R E T r e t i
/ * Traps d o n ' t s a v e c a l l - c l o b b e r e d r e g i s t e r s ( b u t d o s t i l l s a v e a r g r e g s ) .
We p r e s e r v e P S w t o k e e p l o n g - t e r m s t a t e , n a m e l y i n t e r r u p t s t a t u s ( f o r t r a p s
from k e r n e l - m o d e ) , a n d t h e s i n g l e - s t e p f l a g ( f o r u s e r t r a p s ) . * /
# define T R A P _ S T A T E _ S A V E R \
SAVE_ A R G _ R E G S ; \
SAVE_ P C ( E I P C ) ; \
SAVE_ P S W ( E I P S W )
/ * When t r a p s r e t u r n , t h e y j u s t l e a v e c a l l - c l o b b e r e d r e g i s t e r s ( e x c e p t f o r a r g
regs) w i t h w h a t e v e r v a l u e t h e y h a v e f r o m t h e k e r n e l . T r a p s d o n ' t p r e s e r v e
the P S W , b u t w e z e r o E I P S W t o e n s u r e i t d o e s n ' t c o n t a i n a n y t h i n g d a n g e r o u s
( in p a r t i c u l a r , t h e s i n g l e - s t e p f l a g ) . * /
# define T R A P _ S T A T E _ R E S T O R E R \
RESTORE_ A R G _ R E G S ; \
RESTORE_ P C ( E I P C ) ; \
RESTORE_ P S W ( E I P S W )
/ * Save r e g i s t e r s n o t n o r m a l l y s a v e d b y t r a p s . W e n e e d t o s a v e r12 , e v e n
though i t ' s n o m i n a l l y c a l l - c l o b b e r e d , b e c a u s e i t ' s u s e d w h e n r e s t a r t i n g
a s y s t e m c a l l ( t h e s i g n a l - h a n d l i n g p a t h u s e s S A V E _ E X T R A _ S T A T E , a n d
expects r12 t o b e r e s t o r e d w h e n t h e t r a p r e t u r n s ) . * /
# define T R A P _ E X T R A _ S T A T E _ S A V E R \
SAVE_ R V A L _ R E G S ; \
sst. w r12 , P T O + P T _ G P R ( 1 2 ) [ e p ] ; \
SAVE_ C A L L _ S A V E D _ R E G S ; \
SAVE_ C T _ R E G S
# define T R A P _ E X T R A _ S T A T E _ R E S T O R E R \
RESTORE_ R V A L _ R E G S ; \
sld. w P T O + P T _ G P R ( 1 2 ) [ e p ] , r12 ; \
RESTORE_ C A L L _ S A V E D _ R E G S ; \
RESTORE_ C T _ R E G S
/ * Save r e g i s t e r s p r i o r t o c a l l i n g s c h e d u l e r ( j u s t b e f o r e t r a p r e t u r n s ) .
We h a v e t o s a v e t h e r e t u r n - v a l u e r e g i s t e r s t o p r e s e r v e t h e t r a p ' s r e t u r n
value. N o t e t h a t . . . _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R , u n l i k e m o s t . . . _ S A V E R
macros, i s r e q u i r e d t o s e t u p E P i t s e l f i f E P i s n e e d e d ( t h i s i s b e c a u s e
in m a n y c a s e s , t h e m a c r o i s e m p t y ) . * /
# define T R A P _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R \
mov s p , e p ; \
SAVE_ R V A L _ R E G S
/ * Note t h a t . . . _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R , u n l i k e m o s t . . . _ R E S T O R E R
macros, i s r e q u i r e d t o s e t u p E P i t s e l f i f E P i s n e e d e d ( t h i s i s b e c a u s e
in m a n y c a s e s , t h e m a c r o i s e m p t y ) . * /
# define T R A P _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R \
mov s p , e p ; \
RESTORE_ R V A L _ R E G S
/* Register saving/restoring for maskable interrupts. */
# define I R Q _ R E T r e t i
# define I R Q _ S T A T E _ S A V E R \
SAVE_ C A L L _ C L O B B E R E D _ R E G S ; \
SAVE_ P C ( E I P C ) ; \
SAVE_ P S W ( E I P S W )
# define I R Q _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S ; \
RESTORE_ P C ( E I P C ) ; \
RESTORE_ P S W ( E I P S W )
# define I R Q _ E X T R A _ S T A T E _ S A V E R \
SAVE_ C A L L _ S A V E D _ R E G S ; \
SAVE_ C T _ R E G S
# define I R Q _ E X T R A _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ S A V E D _ R E G S ; \
RESTORE_ C T _ R E G S
# define I R Q _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R / * n o t h i n g * /
# define I R Q _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R / * n o t h i n g * /
/* Register saving/restoring for non-maskable interrupts. */
# define N M I _ R E T r e t i
# define N M I _ S T A T E _ S A V E R \
SAVE_ C A L L _ C L O B B E R E D _ R E G S ; \
SAVE_ P C ( F E P C ) ; \
SAVE_ P S W ( F E P S W ) ;
# define N M I _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S ; \
RESTORE_ P C ( F E P C ) ; \
RESTORE_ P S W ( F E P S W ) ;
# define N M I _ E X T R A _ S T A T E _ S A V E R \
SAVE_ C A L L _ S A V E D _ R E G S ; \
SAVE_ C T _ R E G S
# define N M I _ E X T R A _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ S A V E D _ R E G S ; \
RESTORE_ C T _ R E G S
# define N M I _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R / * n o t h i n g * /
# define N M I _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R / * n o t h i n g * /
/* Register saving/restoring for debug traps. */
# define D B T R A P _ R E T . l o n g 0 x01 4 6 0 7 E 0 / * ` d b r e t ' , b u t g a s d o e s n ' t s u p p o r t i t . * /
# define D B T R A P _ S T A T E _ S A V E R \
SAVE_ C A L L _ C L O B B E R E D _ R E G S ; \
SAVE_ P C ( D B P C ) ; \
SAVE_ P S W ( D B P S W )
# define D B T R A P _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ C L O B B E R E D _ R E G S ; \
RESTORE_ P C ( D B P C ) ; \
RESTORE_ P S W ( D B P S W )
# define D B T R A P _ E X T R A _ S T A T E _ S A V E R \
SAVE_ C A L L _ S A V E D _ R E G S ; \
SAVE_ C T _ R E G S
# define D B T R A P _ E X T R A _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ S A V E D _ R E G S ; \
RESTORE_ C T _ R E G S
# define D B T R A P _ S C H E D U L E _ E X T R A _ S T A T E _ S A V E R / * n o t h i n g * /
# define D B T R A P _ S C H E D U L E _ E X T R A _ S T A T E _ R E S T O R E R / * n o t h i n g * /
/ * Register s a v i n g / r e s t o r i n g f o r a c o n t e x t s w i t c h . W e d o n ' t n e e d t o s a v e
too m a n y r e g i s t e r s , b e c a u s e c o n t e x t - s w i t c h i n g l o o k s l i k e a f u n c t i o n c a l l
( via t h e f u n c t i o n ` s w i t c h _ t h r e a d ' ) , s o c a l l e r s w i l l s a v e a n y
call- c l o b b e r e d r e g i s t e r s t h e m s e l v e s . W e d o n e e d t o s a v e t h e C T r e g s , a s
they' r e n o r m a l l y n o t s a v e d d u r i n g k e r n e l e n t r y ( t h e k e r n e l d o e s n ' t u s e
them) . W e s a v e P S W s o t h a t i n t e r r u p t - s t a t u s s t a t e w i l l c o r r e c t l y f o l l o w
each t h r e a d ( m o s t l y N M I v s . n o r m a l - I R Q / t r a p ) , t h o u g h f o r t h e m o s t p a r t
it d o e s n ' t m a t t e r s i n c e t h r e a d s a r e a l w a y s i n a l m o s t e x a c t l y t h e s a m e
processor s t a t e d u r i n g a c o n t e x t s w i t c h . T h e s t a c k p o i n t e r a n d r e t u r n
value a r e h a n d l e d b y s w i t c h _ t h r e a d i t s e l f . * /
# define S W I T C H _ S T A T E _ S A V E R \
SAVE_ C A L L _ S A V E D _ R E G S ; \
SAVE_ P S W ( P S W ) ; \
SAVE_ C T _ R E G S
# define S W I T C H _ S T A T E _ R E S T O R E R \
RESTORE_ C A L L _ S A V E D _ R E G S ; \
RESTORE_ P S W ( P S W ) ; \
RESTORE_ C T _ R E G S
/ * Restore r e g i s t e r s t a t e f r o m t h e s t a t e - s a v e - f r a m e o n t h e s t a c k , s w i t c h b a c k
to t h e u s e r s t a c k i f n e c e s s a r y , a n d r e t u r n f r o m t h e t r a p / i n t e r r u p t .
EXTRA_ S T A T E _ R E S T O R E R i s a s e q u e n c e o f a s s e m b l y l a n g u a g e s t a t e m e n t s t o
restore a n y t h i n g n o t r e s t o r e d b y t h i s m a c r o . O n l y r e g i s t e r s n o t s a v e d b y
the C c o m p i l e r a r e r e s t o r e d ( t h a t i s , R 3 ( s p ) , R 4 ( g p ) , R 3 1 ( l p ) , a n d
anything r e s t o r e d b y E X T R A _ S T A T E _ R E S T O R E R ) . * /
# define R E T U R N ( t y p e ) \
ld. b P T O + P T _ K E R N E L _ M O D E [ s p ] , r19 ; \
di; /* Disable interrupts */ \
cmp r19 , r0 ; /* See if returning to kernel mode, */\
bne 2 f ; /* ... if so, skip resched &c. */ \
\
/ * We' r e r e t u r n i n g t o u s e r m o d e , s o c h e c k f o r v a r i o u s c o n d i t i o n s t h a t \
trigger r e s c h e d u l i n g . * / \
GET_ C U R R E N T _ T H R E A D ( r18 ) ; \
ld. w T I _ F L A G S [ r18 ] , r19 ; \
andi _ T I F _ N E E D _ R E S C H E D , r19 , r0 ; \
bnz 3 f ; /* Call the scheduler. */ \
5 : andi _ T I F _ S I G P E N D I N G , r19 , r18 ; \
ld. w T A S K _ P T R A C E [ C U R R E N T _ T A S K ] , r19 ; /* ptrace flags */ \
or r18 , r19 ; /* see if either is non-zero */ \
bnz 4 f ; /* if so, handle them */ \
\
/* Return to user state. */ \
1 : st. b r0 , K M ; /* Now officially in user state. */ \
\
/ * Final r e t u r n . T h e s t a c k - p o i n t e r f i d d l i n g i s n o t n e e d e d w h e n r e t u r n i n g \
to k e r n e l - m o d e , b u t t h e y d o n ' t h u r t , a n d t h i s w a y w e c a n s h a r e t h e \
( sometimes r a t h e r l e n g t h y ) P O P _ S T A T E m a c r o . * / \
2 : POP_ S T A T E ( t y p e ) ; \
st. w s p , K S P ; /* Save the kernel stack pointer. */ \
ld. w P T _ G P R ( G P R _ S P ) - P T _ S I Z E [ s p ] , s p ; /* Restore stack pointer. */ \
type ## _ R E T ; / * R e t u r n f r o m t h e t r a p / i n t e r r u p t . * / \
\
/* Call the scheduler before returning from a syscall/trap. */ \
3 : SAVE_ E X T R A _ S T A T E _ F O R _ S C H E D U L E ( t y p e ) ; /* Prepare to call scheduler. */ \
jarl c a l l _ s c h e d u l e r , l p ; /* Call scheduler */ \
di; /* The scheduler enables interrupts */\
RESTORE_ E X T R A _ S T A T E _ F O R _ S C H E D U L E ( t y p e ) ; \
GET_ C U R R E N T _ T H R E A D ( r18 ) ; \
ld. w T I _ F L A G S [ r18 ] , r19 ; \
br 5 b ; /* Continue with return path. */ \
\
/ * Handle a s i g n a l o r p t r a c e d p r o c e s s r e t u r n . \
r1 8 s h o u l d b e n o n - z e r o i f t h e r e a r e p e n d i n g s i g n a l s . * / \
4 : / * Not a l l r e g i s t e r s a r e s a v e d b y t h e n o r m a l t r a p / i n t e r r u p t e n t r y \
points ( f o r i n s t a n c e , c a l l - s a v e d r e g i s t e r s ( b e c a u s e t h e n o r m a l \
C- c o m p i l e r c a l l i n g s e q u e n c e i n t h e k e r n e l m a k e s s u r e t h e y ' r e \
preserved) , a n d c a l l - c l o b b e r e d r e g i s t e r s i n t h e c a s e o f \
traps) , b u t s i g n a l h a n d l e r s m a y w a n t t o e x a m i n e o r c h a n g e t h e \
complete r e g i s t e r s t a t e . H e r e w e s a v e a n y t h i n g n o t s a v e d b y \
the n o r m a l e n t r y s e q u e n c e , s o t h a t i t m a y b e s a f e l y r e s t o r e d \
( in a p o s s i b l y m o d i f i e d f o r m ) a f t e r d o _ s i g n a l r e t u r n s . * / \
SAVE_ E X T R A _ S T A T E ( t y p e ) ; /* Save state not saved by entry. */ \
jarl h a n d l e _ s i g n a l _ o r _ p t r a c e _ r e t u r n , l p ; \
RESTORE_ E X T R A _ S T A T E ( t y p e ) ; /* Restore extra regs. */ \
br 1 b
/ * Jump t o t h e a p p r o p r i a t e f u n c t i o n f o r t h e s y s t e m c a l l n u m b e r i n r12
( r1 2 i s n o t p r e s e r v e d ) , o r r e t u r n a n e r r o r i f r12 i s n o t v a l i d . T h e
LP r e g i s t e r s h o u l d p o i n t t o t h e l o c a t i o n w h e r e t h e c a l l e d f u n c t i o n
should r e t u r n . [ n o t e t h a t M A K E _ S Y S _ C A L L u s e s l a b e l 1 ] * /
# define M A K E _ S Y S _ C A L L \
/* Figure out which function to use for this system call. */ \
shl 2 , r12 ; \
/* See if the system call number is valid. */ \
addi l o ( C S Y M ( s y s _ c a l l _ t a b l e ) - s y s _ c a l l _ t a b l e _ e n d ) , r12 , r0 ; \
bnh 1 f ; \
mov h i l o ( C S Y M ( s y s _ c a l l _ t a b l e ) ) , r19 ; \
add r19 , r12 ; \
ld. w 0 [ r12 ] , r12 ; \
/* Make the system call. */ \
jmp [ r12 ] ; \
/* The syscall number is invalid, return an error. */ \
1 : addi - E N O S Y S , r0 , r10 ; \
jmp [ l p ]
.text
/ *
* User t r a p .
*
* Trap 0 s y s t e m c a l l s a r e a l s o h a n d l e d h e r e .
*
* The s t a c k - p o i n t e r ( r3 ) s h o u l d h a v e a l r e a d y b e e n s a v e d t o t h e m e m o r y
* location E N T R Y _ S P ( t h e r e a s o n f o r t h i s i s t h a t t h e i n t e r r u p t v e c t o r s m a y b e
* beyond a 2 2 - b i t s i g n e d o f f s e t j u m p f r o m t h e a c t u a l i n t e r r u p t h a n d l e r , a n d
* this a l l o w s t h e m t o s a v e t h e s t a c k - p o i n t e r a n d u s e t h a t r e g i s t e r t o d o a n
* indirect j u m p ) .
*
* Syscall p r o t o c o l :
* Syscall n u m b e r i n r12 , a r g s i n r6 - r9
* Return v a l u e i n r10
* /
G_ E N T R Y ( t r a p ) :
SAVE_ S T A T E ( T R A P , r12 , E N T R Y _ S P ) / / S a v e r e g i s t e r s .
stsr S R _ E C R , r19 / / F i n d o u t w h i c h t r a p i t w a s .
ei / / E n a b l e i n t e r r u p t s .
mov h i l o ( r e t _ f r o m _ t r a p ) , l p / / w h e r e t h e t r a p s h o u l d r e t u r n
/ / The f o l l o w i n g t w o s h i f t s ( 1 ) c l e a r o u t e x t r a n e o u s N M I d a t a i n t h e
/ / upper 1 6 - b i t s , ( 2 ) c o n v e r t t h e 0 x40 - 0 x5 f r a n g e o f t r a p E C R
/ / numbers i n t o t h e ( 0 - 3 1 ) < < 2 r a n g e w e w a n t , ( 3 ) s e t t h e f l a g s .
shl 2 7 , r19 / / c h o p o f f a l l h i g h b i t s
shr 2 5 , r19 / / s c a l e b a c k d o w n a n d t h e n < < 2
bnz 2 f / / S e e i f n o t t r a p 0 .
/ / Trap 0 i s a ` s h o r t ' s y s t e m c a l l , s k i p g e n e r a l t r a p t a b l e .
MAKE_ S Y S _ C A L L / / J u m p t o t h e s y s c a l l f u n c t i o n .
2 : / / For o t h e r t r a p s , u s e a t a b l e l o o k u p .
mov h i l o ( C S Y M ( t r a p _ t a b l e ) ) , r18
add r19 , r18
ld. w 0 [ r18 ] , r18
jmp [ r18 ] / / J u m p t o t h e t r a p h a n d l e r .
END( t r a p )
/ * This i s j u s t l i k e r e t _ f r o m _ t r a p , b u t f i r s t r e s t o r e s e x t r a r e g i s t e r s
saved b y s o m e w r a p p e r s . * /
L_ E N T R Y ( r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p ) :
RESTORE_ E X T R A _ S T A T E ( T R A P )
/ / fall t h r o u g h
END( r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p )
/* Entry point used to return from a syscall/trap. */
L_ E N T R Y ( r e t _ f r o m _ t r a p ) :
RETURN( T R A P )
END( r e t _ f r o m _ t r a p )
/ * This t h e i n i t i a l e n t r y p o i n t f o r a n e w c h i l d t h r e a d , w i t h a n a p p r o p r i a t e
2007-05-09 10:57:56 +04:00
stack i n p l a c e t h a t m a k e s i t l o o k t h a t t h e c h i l d i s i n t h e m i d d l e o f a n
2005-04-17 02:20:36 +04:00
syscall. T h i s f u n c t i o n i s a c t u a l l y ` r e t u r n e d t o ' f r o m s w i t c h _ t h r e a d
( copy_ t h r e a d m a k e s r e t _ f r o m _ f o r k t h e r e t u r n a d d r e s s i n e a c h n e w t h r e a d ' s
saved c o n t e x t ) . * /
C_ E N T R Y ( r e t _ f r o m _ f o r k ) :
mov r10 , r6 / / s w i t c h _ t h r e a d r e t u r n s t h e p r e v t a s k .
jarl C S Y M ( s c h e d u l e _ t a i l ) , l p / / . . . w h i c h i s s c h e d u l e _ t a i l ' s a r g
mov r0 , r10 / / C h i l d ' s f o r k c a l l s h o u l d r e t u r n 0 .
br r e t _ f r o m _ t r a p / / D o n o r m a l t r a p r e t u r n .
C_ E N D ( r e t _ f r o m _ f o r k )
/ *
* Trap 1 : ` l o n g ' s y s t e m c a l l s
* ` Long' s y s c a l l p r o t o c o l :
* Syscall n u m b e r i n r12 , a r g s i n r6 - r9 , r13 - r14
* Return v a l u e i n r10
* /
L_ E N T R Y ( s y s c a l l _ l o n g ) :
/ / Push e x t r a a r g u m e n t s o n t h e s t a c k . N o t e t h a t b y d e f a u l t , t h e t r a p
/ / handler r e s e r v e s e n o u g h s t a c k s p a c e f o r 6 a r g u m e n t s , s o w e d o n ' t
/ / have t o m a k e a n y a d d i t i o n a l r o o m .
st. w r13 , 1 6 [ s p ] / / a r g 5
st. w r14 , 2 0 [ s p ] / / a r g 6
/ / Make s u r e r13 a n d r14 a r e p r e s e r v e d , i n c a s e w e h a v e t o r e s t a r t a
/ / system c a l l b e c a u s e o f a s i g n a l ( e p h a s a l r e a d y b e e n s e t b y c a l l e r ) .
st. w r13 , P T O + P T _ G P R ( 1 3 ) [ s p ]
st. w r14 , P T O + P T _ G P R ( 1 3 ) [ s p ]
mov h i l o ( r e t _ f r o m _ l o n g _ s y s c a l l ) , l p
MAKE_ S Y S _ C A L L / / J u m p t o t h e s y s c a l l f u n c t i o n .
END( s y s c a l l _ l o n g )
/ * Entry p o i n t u s e d t o r e t u r n f r o m a l o n g s y s c a l l . O n l y n e e d e d t o r e s t o r e
r1 3 / r14 i f t h e g e n e r a l t r a p m e c h a n i s m d o e s n t ' d o s o . * /
L_ E N T R Y ( r e t _ f r o m _ l o n g _ s y s c a l l ) :
ld. w P T O + P T _ G P R ( 1 3 ) [ s p ] , r13 / / R e s t o r e t h e e x t r a r e g i s t e r s
ld. w P T O + P T _ G P R ( 1 3 ) [ s p ] , r14
br r e t _ f r o m _ t r a p / / T h e r e s t i s t h e s a m e a s o t h e r t r a p s
END( r e t _ f r o m _ l o n g _ s y s c a l l )
/ * These s y s c a l l s n e e d a c c e s s t o t h e s t r u c t p t _ r e g s o n t h e s t a c k , s o w e
implement t h e m i n a s s e m b l y ( t h e y ' r e b a s i c a l l y a l l w r a p p e r s a n y w a y ) . * /
L_ E N T R Y ( s y s _ f o r k _ w r a p p e r ) :
# ifdef C O N F I G _ M M U
addi S I G C H L D , r0 , r6 / / A r g 0 : f l a g s
ld. w P T O + P T _ G P R ( G P R _ S P ) [ s p ] , r7 / / A r g 1 : c h i l d S P ( u s e p a r e n t ' s )
movea P T O , s p , r8 / / A r g 2 : p a r e n t c o n t e x t
mov r0 , r9 / / A r g 3 / 4 / 5 : 0
st. w r0 , 1 6 [ s p ]
st. w r0 , 2 0 [ s p ]
mov h i l o ( C S Y M ( d o _ f o r k ) ) , r18 / / W h e r e t h e r e a l w o r k g e t s d o n e
br s a v e _ e x t r a _ s t a t e _ t r a m p / / S a v e s t a t e a n d g o t h e r e
# else
/ / fork a l m o s t w o r k s , e n o u g h t o t r i c k y o u i n t o l o o k i n g e l s e w h e r e : - (
addi - E I N V A L , r0 , r10
jmp [ l p ]
# endif
END( s y s _ f o r k _ w r a p p e r )
L_ E N T R Y ( s y s _ v f o r k _ w r a p p e r ) :
addi C L O N E _ V F O R K | C L O N E _ V M | S I G C H L D , r0 , r6 / / A r g 0 : f l a g s
ld. w P T O + P T _ G P R ( G P R _ S P ) [ s p ] , r7 / / A r g 1 : c h i l d S P ( u s e p a r e n t ' s )
movea P T O , s p , r8 / / A r g 2 : p a r e n t c o n t e x t
mov r0 , r9 / / A r g 3 / 4 / 5 : 0
st. w r0 , 1 6 [ s p ]
st. w r0 , 2 0 [ s p ]
mov h i l o ( C S Y M ( d o _ f o r k ) ) , r18 / / W h e r e t h e r e a l w o r k g e t s d o n e
br s a v e _ e x t r a _ s t a t e _ t r a m p / / S a v e s t a t e a n d g o t h e r e
END( s y s _ v f o r k _ w r a p p e r )
L_ E N T R Y ( s y s _ c l o n e _ w r a p p e r ) :
ld. w P T O + P T _ G P R ( G P R _ S P ) [ s p ] , r19 / / p a r e n t ' s s t a c k p o i n t e r
cmp r7 , r0 / / S e e i f c h i l d S P a r g ( a r g 1 ) i s 0 .
cmov z , r19 , r7 , r7 / / . . . a n d u s e t h e p a r e n t ' s i f s o .
movea P T O , s p , r8 / / A r g 2 : p a r e n t c o n t e x t
mov r0 , r9 / / A r g 3 / 4 / 5 : 0
st. w r0 , 1 6 [ s p ]
st. w r0 , 2 0 [ s p ]
mov h i l o ( C S Y M ( d o _ f o r k ) ) , r18 / / W h e r e t h e r e a l w o r k g e t s d o n e
br s a v e _ e x t r a _ s t a t e _ t r a m p / / S a v e s t a t e a n d g o t h e r e
END( s y s _ c l o n e _ w r a p p e r )
L_ E N T R Y ( s y s _ e x e c v e _ w r a p p e r ) :
movea P T O , s p , r9 / / a d d u s e r c o n t e x t a s 4 t h a r g
jr C S Y M ( s y s _ e x e c v e ) / / D o r e a l w o r k ( t a i l - c a l l ) .
END( s y s _ e x e c v e _ w r a p p e r )
L_ E N T R Y ( s y s _ s i g s u s p e n d _ w r a p p e r ) :
movea P T O , s p , r7 / / a d d u s e r c o n t e x t a s 2 n d a r g
mov h i l o ( C S Y M ( s y s _ s i g s u s p e n d ) ) , r18 / / s y s c a l l f u n c t i o n
jarl s a v e _ e x t r a _ s t a t e _ t r a m p , l p / / S a v e s t a t e a n d d o i t
br r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p
END( s y s _ s i g s u s p e n d _ w r a p p e r )
L_ E N T R Y ( s y s _ r t _ s i g s u s p e n d _ w r a p p e r ) :
movea P T O , s p , r8 / / a d d u s e r c o n t e x t a s 3 r d a r g
mov h i l o ( C S Y M ( s y s _ r t _ s i g s u s p e n d ) ) , r18 / / s y s c a l l f u n c t i o n
jarl s a v e _ e x t r a _ s t a t e _ t r a m p , l p / / S a v e s t a t e a n d d o i t
br r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p
END( s y s _ r t _ s i g s u s p e n d _ w r a p p e r )
L_ E N T R Y ( s y s _ s i g r e t u r n _ w r a p p e r ) :
movea P T O , s p , r6 / / a d d u s e r c o n t e x t a s 1 s t a r g
mov h i l o ( C S Y M ( s y s _ s i g r e t u r n ) ) , r18 / / s y s c a l l f u n c t i o n
jarl s a v e _ e x t r a _ s t a t e _ t r a m p , l p / / S a v e s t a t e a n d d o i t
br r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p
END( s y s _ s i g r e t u r n _ w r a p p e r )
L_ E N T R Y ( s y s _ r t _ s i g r e t u r n _ w r a p p e r ) :
movea P T O , s p , r6 / / a d d u s e r c o n t e x t a s 1 s t a r g
mov h i l o ( C S Y M ( s y s _ r t _ s i g r e t u r n ) ) , r18 / / s y s c a l l f u n c t i o n
jarl s a v e _ e x t r a _ s t a t e _ t r a m p , l p / / S a v e s t a t e a n d d o i t
br r e s t o r e _ e x t r a _ r e g s _ a n d _ r e t _ f r o m _ t r a p
END( s y s _ r t _ s i g r e t u r n _ w r a p p e r )
/ * Save a n y s t a t e n o t s a v e d b y S A V E _ S T A T E ( T R A P ) , a n d j u m p t o r18 .
It' s m a i n p u r p o s e i s t o s h a r e t h e r a t h e r l e n g t h y c o d e s e q u e n c e t h a t
SAVE_ S T A T E e x p a n d s i n t o a m o n g t h e a b o v e w r a p p e r f u n c t i o n s . * /
L_ E N T R Y ( s a v e _ e x t r a _ s t a t e _ t r a m p ) :
SAVE_ E X T R A _ S T A T E ( T R A P ) / / S a v e s t a t e n o t s a v e d b y e n t r y .
jmp [ r18 ] / / D o t h e w o r k t h e c a l l e r w a n t s
END( s a v e _ e x t r a _ s t a t e _ t r a m p )
/ *
* Hardware m a s k a b l e i n t e r r u p t s .
*
* The s t a c k - p o i n t e r ( r3 ) s h o u l d h a v e a l r e a d y b e e n s a v e d t o t h e m e m o r y
* location E N T R Y _ S P ( t h e r e a s o n f o r t h i s i s t h a t t h e i n t e r r u p t v e c t o r s m a y b e
* beyond a 2 2 - b i t s i g n e d o f f s e t j u m p f r o m t h e a c t u a l i n t e r r u p t h a n d l e r , a n d
* this a l l o w s t h e m t o s a v e t h e s t a c k - p o i n t e r a n d u s e t h a t r e g i s t e r t o d o a n
* indirect j u m p ) .
* /
G_ E N T R Y ( i r q ) :
SAVE_ S T A T E ( I R Q , r0 , E N T R Y _ S P ) / / S a v e r e g i s t e r s .
stsr S R _ E C R , r6 / / F i n d o u t w h i c h i n t e r r u p t i t w a s .
movea P T O , s p , r7 / / U s e r r e g s a r e a r g 2
/ / All v85 0 i m p l e m e n t a t i o n s I k n o w a b o u t e n c o d e t h e i r i n t e r r u p t s a s
/ / multiples o f 0 x10 , s t a r t i n g a t 0 x80 ( a f t e r N M I s a n d s o f t w a r e
/ / interrupts) . C o n v e r t t h i s n u m b e r i n t o a s i m p l e I R Q i n d e x f o r t h e
/ / rest o f t h e k e r n e l . W e a l s o c l e a r t h e u p p e r 1 6 b i t s , w h i c h h o l d
/ / NMI i n f o , a n d d o n ' t a p p e a r t o b e c l e a r e d w h e n a N M I r e t u r n s .
shl 1 6 , r6 / / c l e a r u p p e r 1 6 b i t s
shr 2 0 , r6 / / s h i f t b a c k , a n d r e m o v e l o w e r n i b b l e
add - 8 , r6 / / r e m o v e b i a s f o r i r q s
/ / Call t h e h i g h - l e v e l i n t e r r u p t h a n d l i n g c o d e .
jarl C S Y M ( h a n d l e _ i r q ) , l p
RETURN( I R Q )
END( i r q )
/ *
* Debug t r a p / i l l e g a l - i n s t r u c t i o n e x c e p t i o n
*
* The s t a c k - p o i n t e r ( r3 ) s h o u l d h a v e a l r e a d y b e e n s a v e d t o t h e m e m o r y
* location E N T R Y _ S P ( t h e r e a s o n f o r t h i s i s t h a t t h e i n t e r r u p t v e c t o r s m a y b e
* beyond a 2 2 - b i t s i g n e d o f f s e t j u m p f r o m t h e a c t u a l i n t e r r u p t h a n d l e r , a n d
* this a l l o w s t h e m t o s a v e t h e s t a c k - p o i n t e r a n d u s e t h a t r e g i s t e r t o d o a n
* indirect j u m p ) .
* /
G_ E N T R Y ( d b t r a p ) :
SAVE_ S T A T E ( D B T R A P , r0 , E N T R Y _ S P ) / / S a v e r e g i s t e r s .
/ * First s e e i f w e c a m e f r o m k e r n e l m o d e ; if so, the dbtrap
instruction h a s a s p e c i a l m e a n i n g , t o s e t t h e D I R ( ` d e b u g
information r e g i s t e r ' ) r e g i s t e r . T h i s i s b e c a u s e t h e D I R r e g i s t e r
can _ o n l y _ b e m a n i p u l a t e d / r e a d w h i l e i n ` d e b u g m o d e ,' a n d d e b u g
mode i s o n l y a c t i v e w h i l e w e ' r e i n s i d e t h e d b t r a p h a n d l e r . T h e
exact f u n c t i o n a l i t y i s : { D I R = ( D I R | r6 ) & ~ r7 ; return DIR; }. */
ld. b P T O + P T _ K E R N E L _ M O D E [ s p ] , r19
cmp r19 , r0
bz 1 f
stsr S R _ D I R , r10
or r6 , r10
not r7 , r7
and r7 , r10
ldsr r10 , S R _ D I R
stsr S R _ D I R , r10 / / C o n f i r m t h e v a l u e w e s e t
st. w r10 , P T O + P T _ G P R ( 1 0 ) [ s p ] / / r e t u r n i t
br 3 f
1 : ei / / E n a b l e i n t e r r u p t s .
/* The default signal type we raise. */
mov S I G T R A P , r6
/* See if it's a single-step trap. */
stsr S R _ D B P S W , r19
andi 0 x08 0 0 , r19 , r19
bnz 2 f
/ * Look t o s e e i f t h e p r e c e d i n g i n s t r u c t i o n w a s i s a d b t r a p o r n o t ,
to d e c i d e w h i c h s i g n a l w e s h o u l d u s e . * /
stsr S R _ D B P C , r19 / / P C f o l l o w i n g t r a p p i n g i n s n
ld. h u - 2 [ r19 ] , r19
ori 0 x f84 0 , r0 , r20 / / D B T R A P i n s n
cmp r19 , r20 / / W a s t h i s t r a p c a u s e d b y D B T R A P ?
cmov n e , S I G I L L , r6 , r6 / / C h o o s e s i g n a l a p p r o p r i a t e l y
/* Raise the desired signal. */
2 : mov C U R R E N T _ T A S K , r7 / / A r g 1 : t a s k
jarl C S Y M ( s e n d _ s i g ) , l p / / t a i l c a l l
3 : RETURN( D B T R A P )
END( d b t r a p )
/ *
* Hardware n o n - m a s k a b l e i n t e r r u p t s .
*
* The s t a c k - p o i n t e r ( r3 ) s h o u l d h a v e a l r e a d y b e e n s a v e d t o t h e m e m o r y
* location E N T R Y _ S P ( t h e r e a s o n f o r t h i s i s t h a t t h e i n t e r r u p t v e c t o r s m a y b e
* beyond a 2 2 - b i t s i g n e d o f f s e t j u m p f r o m t h e a c t u a l i n t e r r u p t h a n d l e r , a n d
* this a l l o w s t h e m t o s a v e t h e s t a c k - p o i n t e r a n d u s e t h a t r e g i s t e r t o d o a n
* indirect j u m p ) .
* /
G_ E N T R Y ( n m i ) :
SAVE_ S T A T E ( N M I , r0 , N M I _ E N T R Y _ S P ) ; /* Save registers. */
stsr S R _ E C R , r6 ; /* Find out which nmi it was. */
shr 2 0 , r6 ; /* Extract NMI code in bits 20-24. */
movea P T O , s p , r7 ; /* User regs are arg2. */
/ * Non- m a s k a b l e i n t e r r u p t s a l w a y s l i e r i g h t a f t e r m a s k a b l e i n t e r r u p t s .
Call t h e g e n e r i c I R Q h a n d l e r , w i t h t w o a r g u m e n t s , t h e I R Q n u m b e r ,
and a p o i n t e r t o t h e u s e r r e g i s t e r s , t o h a n d l e t h e s p e c i f i c s .
( we s u b t r a c t o n e b e c a u s e t h e f i r s t N M I h a s c o d e 1 ) . * /
addi F I R S T _ N M I - 1 , r6 , r6
jarl C S Y M ( h a n d l e _ i r q ) , l p
RETURN( N M I )
END( n m i )
/ *
* Trap w i t h n o h a n d l e r
* /
L_ E N T R Y ( b a d _ t r a p _ w r a p p e r ) :
mov r19 , r6 / / A r g 0 : t r a p n u m b e r
movea P T O , s p , r7 / / A r g 1 : u s e r r e g s
jr C S Y M ( b a d _ t r a p ) / / t a i l c a l l h a n d l e r
END( b a d _ t r a p _ w r a p p e r )
/ *
* Invoke t h e s c h e d u l e r , c a l l e d f r o m t h e t r a p / i r q k e r n e l e x i t p a t h .
*
* This b a s i c a l l y j u s t c a l l s ` s c h e d u l e ' , b u t a l s o a r r a n g e s f o r e x t r a
* registers t o b e s a v e d f o r p t r a c e ' d p r o c e s s e s , s o p t r a c e c a n m o d i f y t h e m .
* /
L_ E N T R Y ( c a l l _ s c h e d u l e r ) :
ld. w T A S K _ P T R A C E [ C U R R E N T _ T A S K ] , r19 / / S e e i f t a s k i s p t r a c e ' d
cmp r19 , r0
bnz 1 f / / . . . y e s , d o s p e c i a l s t u f f
jr C S Y M ( s c h e d u l e ) / / . . . n o , j u s t t a i l - c a l l s c h e d u l e r
/ / Save e x t r a r e g s f o r p t r a c e ' d t a s k . W e w a n t t o s a v e a n y t h i n g
/ / that w o u l d o t h e r w i s e o n l y b e ` i m p l i c i t l y ' s a v e d b y t h e n o r m a l
/ / compiler c a l l i n g - c o n v e n t i o n .
1 : mov s p , e p / / S e t u p E P f o r S A V E _ C A L L _ S A V E D _ R E G S
SAVE_ C A L L _ S A V E D _ R E G S / / S a v e c a l l - s a v e d r e g i s t e r s t o s t a c k
mov l p , r20 / / S a v e L P i n a c a l l e e - s a v e d r e g i s t e r
jarl C S Y M ( s c h e d u l e ) , l p / / C a l l s c h e d u l e r
mov r20 , l p
mov s p , e p / / W e c a n ' t r e l y o n E P a f t e r r e t u r n
RESTORE_ C A L L _ S A V E D _ R E G S / / R e s t o r e ( p o s s i b l y m o d i f i e d ) r e g s
jmp [ l p ] / / R e t u r n t o t h e r e t u r n p a t h
END( c a l l _ s c h e d u l e r )
/ *
* This i s a n o u t - o f - l i n e h a n d l e r f o r t w o s p e c i a l c a s e s d u r i n g t h e k e r n e l
* trap/ i r q e x i t s e q u e n c e :
*
* ( 1 ) If r18 i s n o n - z e r o t h e n a s i g n a l n e e d s t o b e h a n d l e d , w h i c h i s
* done, a n d t h e n t h e c a l l e r r e t u r n e d t o .
*
* ( 2 ) If r18 i s n o n - z e r o t h e n w e ' r e r e t u r n i n g t o a p t r a c e d p r o c e s s , w h i c h
* has s e v e r a l s p e c i a l c a s e s - - s i n g l e - s t e p p i n g a n d t r a p t r a c i n g , b o t h
* of w h i c h r e q u i r e u s i n g t h e ` d b r e t ' i n s t r u c t i o n t o e x i t t h e k e r n e l
* instead o f t h e n o r m a l ` r e t i ' ( t h i s i s b e c a u s e t h e C P U n o t c o r r e c t l y
* single- s t e p a f t e r a r e t i ) . I n t h i s c a s e , o f c o u r s e , t h i s h a n d l e r
* never r e t u r n s t o t h e c a l l e r .
*
* In e i t h e r c a s e , a l l r e g i s t e r s s h o u l d h a v e b e e n s a v e d t o t h e c u r r e n t
* state- s a v e - f r a m e o n t h e s t a c k , e x c e p t f o r c a l l e e - s a v e d r e g i s t e r s .
*
* [ These t w o d i f f e r e n t c a s e s a r e c o m b i n e d m e r e l y t o a v o i d b l o a t i n g t h e
* macro- i n l i n e d c o d e , n o t b e c a u s e t h e y r e a l l y m a k e m u c h s e n s e t o g e t h e r ! ]
* /
L_ E N T R Y ( h a n d l e _ s i g n a l _ o r _ p t r a c e _ r e t u r n ) :
cmp r18 , r0 / / S e e i f h a n d l i n g a s i g n a l
bz 1 f / / . . . n o p e , g o d o p t r a c e r e t u r n
/ / Handle a s i g n a l
mov l p , r20 / / S a v e l i n k - p o i n t e r
mov r10 , r21 / / S a v e r e t u r n - v a l u e s ( f o r t r a p )
mov r11 , r22
movea P T O , s p , r6 / / A r g 1 : s t r u c t p t _ r e g s * r e g s
mov r0 , r7 / / A r g 2 : s i g s e t _ t * o l d s e t
jarl C S Y M ( d o _ s i g n a l ) , l p / / H a n d l e t h e s i g n a l
di / / s i g h a n d l i n g e n a b l e s i n t e r r u p t s
mov r20 , l p / / R e s t o r e l i n k - p o i n t e r
mov r21 , r10 / / R e s t o r e r e t u r n - v a l u e s ( f o r t r a p )
mov r22 , r11
ld. w T A S K _ P T R A C E [ C U R R E N T _ T A S K ] , r19 / / c h e c k p t r a c e f l a g s t o o
cmp r19 , r0
bnz 1 f / / . . . s o m e s e t , s o l o o k m o r e
2 : jmp [ l p ] / / . . . n o n e s e t , s o r e t u r n n o r m a l l y
/ / ptrace r e t u r n
1 : ld. w P T O + P T _ P S W [ s p ] , r19 / / L o o k a t u s e r - p r o c e s s e s ' s f l a g s
andi 0 x08 0 0 , r19 , r19 / / S e e i f s i n g l e - s t e p f l a g i s s e t
bz 2 b / / . . . n o p e , r e t u r n n o r m a l l y
/ / Return a s i f f r o m a d b t r a p i n s n
st. b r0 , K M / / N o w o f f i c i a l l y i n u s e r s t a t e .
POP_ S T A T E ( D B T R A P ) / / R e s t o r e r e g s
st. w s p , K S P / / S a v e t h e k e r n e l s t a c k p o i n t e r .
ld. w P T _ G P R ( G P R _ S P ) - P T _ S I Z E [ s p ] , s p / / R e s t o r e u s e r s t a c k p o i n t e r .
DBTRAP_ R E T / / R e t u r n f r o m t h e t r a p / i n t e r r u p t .
END( h a n d l e _ s i g n a l _ o r _ p t r a c e _ r e t u r n )
/ *
* This i s w h e r e w e s w i t c h b e t w e e n t w o t h r e a d s . T h e a r g u m e n t s a r e :
* r6 - - p o i n t e r t o t h e s t r u c t t h r e a d f o r t h e ` c u r r e n t ' p r o c e s s
* r7 - - p o i n t e r t o t h e s t r u c t t h r e a d f o r t h e ` n e w ' p r o c e s s .
* when t h i s f u n c t i o n r e t u r n s , i t w i l l r e t u r n t o t h e n e w t h r e a d .
* /
C_ E N T R Y ( s w i t c h _ t h r e a d ) :
/ / Return t h e p r e v i o u s t a s k ( r10 i s n o t c l o b b e r e d b y r e s t o r e b e l o w )
mov C U R R E N T _ T A S K , r10
/ / First, p u s h t h e c u r r e n t p r o c e s s o r s t a t e o n t h e s t a c k
PUSH_ S T A T E ( S W I T C H )
/ / Now s a v e t h e l o c a t i o n o f t h e k e r n e l s t a c k p o i n t e r f o r t h i s t h r e a d ;
/ / since w e ' v e p u s h e d a l l o t h e r s t a t e o n t h e s t a c k , t h i s i s e n o u g h t o
/ / restore i t a l l l a t e r .
st. w s p , T H R E A D _ K S P [ r6 ]
/ / Now r e s t o r e t h e s t a c k p o i n t e r f r o m t h e n e w p r o c e s s
ld. w T H R E A D _ K S P [ r7 ] , s p
/ / . . . and r e s t o r e a l l s t a t e f r o m t h a t
POP_ S T A T E ( S W I T C H )
/ / Update t h e c u r r e n t t a s k p o i n t e r
GET_ C U R R E N T _ T A S K ( C U R R E N T _ T A S K )
/ / Now r e t u r n i n t o t h e n e w t h r e a d
jmp [ l p ]
C_ E N D ( s w i t c h _ t h r e a d )
.data
.align 4
C_ D A T A ( t r a p _ t a b l e ) :
.long bad_trap_wrapper / / trap 0 , d o e s n ' t u s e t r a p t a b l e .
.long syscall_long / / trap 1 , ` l o n g ' s y s c a l l .
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
C_ E N D ( t r a p _ t a b l e )
.section .rodata
.align 4
C_ D A T A ( s y s _ c a l l _ t a b l e ) :
.long CSYM( s y s _ r e s t a r t _ s y s c a l l ) / / 0
.long CSYM( s y s _ e x i t )
.long sys_fork_wrapper
.long CSYM( s y s _ r e a d )
.long CSYM( s y s _ w r i t e )
.long CSYM( s y s _ o p e n ) / / 5
.long CSYM( s y s _ c l o s e )
.long CSYM( s y s _ w a i t p i d )
.long CSYM( s y s _ c r e a t )
.long CSYM( s y s _ l i n k )
.long CSYM( s y s _ u n l i n k ) / / 1 0
.long sys_execve_wrapper
.long CSYM( s y s _ c h d i r )
.long CSYM( s y s _ t i m e )
.long CSYM( s y s _ m k n o d )
.long CSYM( s y s _ c h m o d ) / / 1 5
.long CSYM( s y s _ c h o w n )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : b r e a k
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : o l d s t a t ( a k a s t a t )
.long CSYM( s y s _ l s e e k )
.long CSYM( s y s _ g e t p i d ) / / 2 0
.long CSYM( s y s _ m o u n t )
.long CSYM( s y s _ o l d u m o u n t )
.long CSYM( s y s _ s e t u i d )
.long CSYM( s y s _ g e t u i d )
.long CSYM( s y s _ s t i m e ) / / 2 5
.long CSYM( s y s _ p t r a c e )
.long CSYM( s y s _ a l a r m )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : o l d f s t a t ( a k a f s t a t )
.long CSYM( s y s _ p a u s e )
.long CSYM( s y s _ u t i m e ) / / 3 0
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : s t t y
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : g t t y
.long CSYM( s y s _ a c c e s s )
.long CSYM( s y s _ n i c e )
.long CSYM( s y s _ n i _ s y s c a l l ) / / 3 5 , w a s : f t i m e
.long CSYM( s y s _ s y n c )
.long CSYM( s y s _ k i l l )
.long CSYM( s y s _ r e n a m e )
.long CSYM( s y s _ m k d i r )
.long CSYM( s y s _ r m d i r ) / / 4 0
.long CSYM( s y s _ d u p )
.long CSYM( s y s _ p i p e )
.long CSYM( s y s _ t i m e s )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : p r o f
.long CSYM( s y s _ b r k ) / / 4 5
.long CSYM( s y s _ s e t g i d )
.long CSYM( s y s _ g e t g i d )
.long CSYM( s y s _ s i g n a l )
.long CSYM( s y s _ g e t e u i d )
.long CSYM( s y s _ g e t e g i d ) / / 5 0
.long CSYM( s y s _ a c c t )
.long CSYM( s y s _ u m o u n t ) / / r e c y c l e d n e v e r u s e d p h y s ( )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : l o c k
.long CSYM( s y s _ i o c t l )
.long CSYM( s y s _ f c n t l ) / / 5 5
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : m p x
.long CSYM( s y s _ s e t p g i d )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : u l i m i t
.long CSYM( s y s _ n i _ s y s c a l l )
.long CSYM( s y s _ u m a s k ) / / 6 0
.long CSYM( s y s _ c h r o o t )
.long CSYM( s y s _ u s t a t )
.long CSYM( s y s _ d u p2 )
.long CSYM( s y s _ g e t p p i d )
.long CSYM( s y s _ g e t p g r p ) / / 6 5
.long CSYM( s y s _ s e t s i d )
.long CSYM( s y s _ s i g a c t i o n )
.long CSYM( s y s _ s g e t m a s k )
.long CSYM( s y s _ s s e t m a s k )
.long CSYM( s y s _ s e t r e u i d ) / / 7 0
.long CSYM( s y s _ s e t r e g i d )
.long sys_sigsuspend_wrapper
.long CSYM( s y s _ s i g p e n d i n g )
.long CSYM( s y s _ s e t h o s t n a m e )
.long CSYM( s y s _ s e t r l i m i t ) / / 7 5
.long CSYM( s y s _ g e t r l i m i t )
.long CSYM( s y s _ g e t r u s a g e )
.long CSYM( s y s _ g e t t i m e o f d a y )
.long CSYM( s y s _ s e t t i m e o f d a y )
.long CSYM( s y s _ g e t g r o u p s ) / / 8 0
.long CSYM( s y s _ s e t g r o u p s )
.long CSYM( s y s _ s e l e c t )
.long CSYM( s y s _ s y m l i n k )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : o l d l s t a t ( a k a l s t a t )
.long CSYM( s y s _ r e a d l i n k ) / / 8 5
.long CSYM( s y s _ u s e l i b )
.long CSYM( s y s _ s w a p o n )
.long CSYM( s y s _ r e b o o t )
.long CSYM( o l d _ r e a d d i r )
.long CSYM( s y s _ m m a p ) / / 9 0
.long CSYM( s y s _ m u n m a p )
.long CSYM( s y s _ t r u n c a t e )
.long CSYM( s y s _ f t r u n c a t e )
.long CSYM( s y s _ f c h m o d )
.long CSYM( s y s _ f c h o w n ) / / 9 5
.long CSYM( s y s _ g e t p r i o r i t y )
.long CSYM( s y s _ s e t p r i o r i t y )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : p r o f i l
.long CSYM( s y s _ s t a t f s )
.long CSYM( s y s _ f s t a t f s ) / / 1 0 0
.long CSYM( s y s _ n i _ s y s c a l l ) / / i 3 8 6 : i o p e r m
.long CSYM( s y s _ s o c k e t c a l l )
.long CSYM( s y s _ s y s l o g )
.long CSYM( s y s _ s e t i t i m e r )
.long CSYM( s y s _ g e t i t i m e r ) / / 1 0 5
.long CSYM( s y s _ n e w s t a t )
.long CSYM( s y s _ n e w l s t a t )
.long CSYM( s y s _ n e w f s t a t )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : o l d u n a m e ( a k a u n a m e )
.long CSYM( s y s _ n i _ s y s c a l l ) / / 1 1 0 , i 3 8 6 : i o p l
.long CSYM( s y s _ v h a n g u p )
.long CSYM( s y s _ n i _ s y s c a l l ) / / w a s : i d l e
.long CSYM( s y s _ n i _ s y s c a l l ) / / i 3 8 6 : v m 8 6 o l d
.long CSYM( s y s _ w a i t 4 )
.long CSYM( s y s _ s w a p o f f ) / / 1 1 5
.long CSYM( s y s _ s y s i n f o )
.long CSYM( s y s _ i p c )
.long CSYM( s y s _ f s y n c )
.long sys_sigreturn_wrapper
.long sys_clone_wrapper / / 1 2 0
.long CSYM( s y s _ s e t d o m a i n n a m e )
.long CSYM( s y s _ n e w u n a m e )
.long CSYM( s y s _ n i _ s y s c a l l ) / / i 3 8 6 : m o d i f y _ l d t , m 6 8 k : c a c h e f l u s h
.long CSYM( s y s _ a d j t i m e x )
.long CSYM( s y s _ n i _ s y s c a l l ) / / 1 2 5 - s y s _ m p r o t e c t
.long CSYM( s y s _ s i g p r o c m a s k )
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ c r e a t e _ m o d u l e
.long CSYM( s y s _ i n i t _ m o d u l e )
.long CSYM( s y s _ d e l e t e _ m o d u l e )
.long CSYM( s y s _ n i _ s y s c a l l ) / / 1 3 0 - s y s _ g e t _ k e r n e l _ s y m s
.long CSYM( s y s _ q u o t a c t l )
.long CSYM( s y s _ g e t p g i d )
.long CSYM( s y s _ f c h d i r )
.long CSYM( s y s _ b d f l u s h )
.long CSYM( s y s _ s y s f s ) / / 1 3 5
.long CSYM( s y s _ p e r s o n a l i t y )
.long CSYM( s y s _ n i _ s y s c a l l ) / / f o r a f s _ s y s c a l l
.long CSYM( s y s _ s e t f s u i d )
.long CSYM( s y s _ s e t f s g i d )
.long CSYM( s y s _ l l s e e k ) / / 1 4 0
.long CSYM( s y s _ g e t d e n t s )
.long CSYM( s y s _ s e l e c t ) / / f o r b a c k w a r d c o m p a t ; remove someday
.long CSYM( s y s _ f l o c k )
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ m s y n c
.long CSYM( s y s _ r e a d v ) / / 1 4 5
.long CSYM( s y s _ w r i t e v )
.long CSYM( s y s _ g e t s i d )
.long CSYM( s y s _ f d a t a s y n c )
.long CSYM( s y s _ s y s c t l )
.long CSYM( s y s _ n i _ s y s c a l l ) / / 1 5 0 - s y s _ m l o c k
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ m u n l o c k
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ m l o c k a l l
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ m u n l o c k a l l
.long CSYM( s y s _ s c h e d _ s e t p a r a m )
.long CSYM( s y s _ s c h e d _ g e t p a r a m ) / / 1 5 5
.long CSYM( s y s _ s c h e d _ s e t s c h e d u l e r )
.long CSYM( s y s _ s c h e d _ g e t s c h e d u l e r )
.long CSYM( s y s _ s c h e d _ y i e l d )
.long CSYM( s y s _ s c h e d _ g e t _ p r i o r i t y _ m a x )
.long CSYM( s y s _ s c h e d _ g e t _ p r i o r i t y _ m i n ) / / 1 6 0
.long CSYM( s y s _ s c h e d _ r r _ g e t _ i n t e r v a l )
.long CSYM( s y s _ n a n o s l e e p )
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ m r e m a p
.long CSYM( s y s _ s e t r e s u i d )
.long CSYM( s y s _ g e t r e s u i d ) / / 1 6 5
.long CSYM( s y s _ n i _ s y s c a l l ) / / f o r v m 8 6
.long CSYM( s y s _ n i _ s y s c a l l ) / / s y s _ q u e r y _ m o d u l e
.long CSYM( s y s _ p o l l )
.long CSYM( s y s _ n f s s e r v c t l )
.long CSYM( s y s _ s e t r e s g i d ) / / 1 7 0
.long CSYM( s y s _ g e t r e s g i d )
.long CSYM( s y s _ p r c t l )
.long sys_rt_sigreturn_wrapper
.long CSYM( s y s _ r t _ s i g a c t i o n )
.long CSYM( s y s _ r t _ s i g p r o c m a s k ) / / 1 7 5
.long CSYM( s y s _ r t _ s i g p e n d i n g )
.long CSYM( s y s _ r t _ s i g t i m e d w a i t )
.long CSYM( s y s _ r t _ s i g q u e u e i n f o )
.long sys_rt_sigsuspend_wrapper
.long CSYM( s y s _ p r e a d64 ) / / 1 8 0
.long CSYM( s y s _ p w r i t e 6 4 )
.long CSYM( s y s _ l c h o w n )
.long CSYM( s y s _ g e t c w d )
.long CSYM( s y s _ c a p g e t )
.long CSYM( s y s _ c a p s e t ) / / 1 8 5
.long CSYM( s y s _ s i g a l t s t a c k )
.long CSYM( s y s _ s e n d f i l e )
.long CSYM( s y s _ n i _ s y s c a l l ) / / s t r e a m s1
.long CSYM( s y s _ n i _ s y s c a l l ) / / s t r e a m s2
.long sys_vfork_wrapper / / 1 9 0
.long CSYM( s y s _ n i _ s y s c a l l )
.long CSYM( s y s _ m m a p2 )
.long CSYM( s y s _ t r u n c a t e 6 4 )
.long CSYM( s y s _ f t r u n c a t e 6 4 )
.long CSYM( s y s _ s t a t 6 4 ) / / 1 9 5
.long CSYM( s y s _ l s t a t 6 4 )
.long CSYM( s y s _ f s t a t 6 4 )
.long CSYM( s y s _ f c n t l 6 4 )
.long CSYM( s y s _ g e t d e n t s64 )
.long CSYM( s y s _ p i v o t _ r o o t ) / / 2 0 0
.long CSYM( s y s _ g e t t i d )
.long CSYM( s y s _ t k i l l )
sys_call_table_end :
C_ E N D ( s y s _ c a l l _ t a b l e )