@ -12,11 +12,32 @@
.text
.set noat
.cfi_sections .debug_frame
/* Stack offsets. */
# define S P _ O F F 1 8 4
# define S W I T C H _ S T A C K _ S I Z E 3 2 0
.macro CFI_START_OSF_FRAME func
.align 4
.globl \ func
.type \ func,@function
\ func :
.cfi_startproc simple
.cfi_return_column 64
.cfi_def_cfa $ sp, 4 8
.cfi_rel_offset 6 4 , 8
.cfi_rel_offset $ gp, 1 6
.cfi_rel_offset $ 1 6 , 2 4
.cfi_rel_offset $ 1 7 , 3 2
.cfi_rel_offset $ 1 8 , 4 0
.endm
.macro CFI_END_OSF_FRAME func
.cfi_endproc
.size \ func, . - \ f u n c
.endm
/ *
* This d e f i n e s t h e n o r m a l k e r n e l p t - r e g s l a y o u t .
*
@ -27,100 +48,158 @@
* the p a l c o d e - p r o v i d e d v a l u e s a r e a v a i l a b l e t o t h e s i g n a l h a n d l e r .
* /
# define S A V E _ A L L \
subq $ s p , S P _ O F F , $ s p ; \
stq $ 0 , 0 ( $ s p ) ; \
stq $ 1 , 8 ( $ s p ) ; \
stq $ 2 , 1 6 ( $ s p ) ; \
stq $ 3 , 2 4 ( $ s p ) ; \
stq $ 4 , 3 2 ( $ s p ) ; \
stq $ 2 8 , 1 4 4 ( $ s p ) ; \
lda $ 2 , a l p h a _ m v ; \
stq $ 5 , 4 0 ( $ s p ) ; \
stq $ 6 , 4 8 ( $ s p ) ; \
stq $ 7 , 5 6 ( $ s p ) ; \
stq $ 8 , 6 4 ( $ s p ) ; \
stq $ 1 9 , 7 2 ( $ s p ) ; \
stq $ 2 0 , 8 0 ( $ s p ) ; \
stq $ 2 1 , 8 8 ( $ s p ) ; \
ldq $ 2 , H A E _ C A C H E ( $ 2 ) ; \
stq $ 2 2 , 9 6 ( $ s p ) ; \
stq $ 2 3 , 1 0 4 ( $ s p ) ; \
stq $ 2 4 , 1 1 2 ( $ s p ) ; \
stq $ 2 5 , 1 2 0 ( $ s p ) ; \
stq $ 2 6 , 1 2 8 ( $ s p ) ; \
stq $ 2 7 , 1 3 6 ( $ s p ) ; \
stq $ 2 , 1 5 2 ( $ s p ) ; \
stq $ 1 6 , 1 6 0 ( $ s p ) ; \
stq $ 1 7 , 1 6 8 ( $ s p ) ; \
.macro SAVE_ALL
subq $ s p , S P _ O F F , $ s p
.cfi_adjust_cfa_offset SP_OFF
stq $ 0 , 0 ( $ s p )
stq $ 1 , 8 ( $ s p )
stq $ 2 , 1 6 ( $ s p )
stq $ 3 , 2 4 ( $ s p )
stq $ 4 , 3 2 ( $ s p )
stq $ 2 8 , 1 4 4 ( $ s p )
.cfi_rel_offset $ 0 , 0
.cfi_rel_offset $ 1 , 8
.cfi_rel_offset $ 2 , 1 6
.cfi_rel_offset $ 3 , 2 4
.cfi_rel_offset $ 4 , 3 2
.cfi_rel_offset $ 2 8 , 1 4 4
lda $ 2 , a l p h a _ m v
stq $ 5 , 4 0 ( $ s p )
stq $ 6 , 4 8 ( $ s p )
stq $ 7 , 5 6 ( $ s p )
stq $ 8 , 6 4 ( $ s p )
stq $ 1 9 , 7 2 ( $ s p )
stq $ 2 0 , 8 0 ( $ s p )
stq $ 2 1 , 8 8 ( $ s p )
ldq $ 2 , H A E _ C A C H E ( $ 2 )
stq $ 2 2 , 9 6 ( $ s p )
stq $ 2 3 , 1 0 4 ( $ s p )
stq $ 2 4 , 1 1 2 ( $ s p )
stq $ 2 5 , 1 2 0 ( $ s p )
stq $ 2 6 , 1 2 8 ( $ s p )
stq $ 2 7 , 1 3 6 ( $ s p )
stq $ 2 , 1 5 2 ( $ s p )
stq $ 1 6 , 1 6 0 ( $ s p )
stq $ 1 7 , 1 6 8 ( $ s p )
stq $ 1 8 , 1 7 6 ( $ s p )
.cfi_rel_offset $ 5 , 4 0
.cfi_rel_offset $ 6 , 4 8
.cfi_rel_offset $ 7 , 5 6
.cfi_rel_offset $ 8 , 6 4
.cfi_rel_offset $ 1 9 , 7 2
.cfi_rel_offset $ 2 0 , 8 0
.cfi_rel_offset $ 2 1 , 8 8
.cfi_rel_offset $ 2 2 , 9 6
.cfi_rel_offset $ 2 3 , 1 0 4
.cfi_rel_offset $ 2 4 , 1 1 2
.cfi_rel_offset $ 2 5 , 1 2 0
.cfi_rel_offset $ 2 6 , 1 2 8
.cfi_rel_offset $ 2 7 , 1 3 6
.endm
# define R E S T O R E _ A L L \
lda $ 1 9 , a l p h a _ m v ; \
ldq $ 0 , 0 ( $ s p ) ; \
ldq $ 1 , 8 ( $ s p ) ; \
ldq $ 2 , 1 6 ( $ s p ) ; \
ldq $ 3 , 2 4 ( $ s p ) ; \
ldq $ 2 1 , 1 5 2 ( $ s p ) ; \
ldq $ 2 0 , H A E _ C A C H E ( $ 1 9 ) ; \
ldq $ 4 , 3 2 ( $ s p ) ; \
ldq $ 5 , 4 0 ( $ s p ) ; \
ldq $ 6 , 4 8 ( $ s p ) ; \
ldq $ 7 , 5 6 ( $ s p ) ; \
subq $ 2 0 , $ 2 1 , $ 2 0 ; \
ldq $ 8 , 6 4 ( $ s p ) ; \
beq $ 2 0 , 9 9 f ; \
ldq $ 2 0 , H A E _ R E G ( $ 1 9 ) ; \
stq $ 2 1 , H A E _ C A C H E ( $ 1 9 ) ; \
stq $ 2 1 , 0 ( $ 2 0 ) ; \
99 : ; \
ldq $ 1 9 , 7 2 ( $ s p ) ; \
ldq $ 2 0 , 8 0 ( $ s p ) ; \
ldq $ 2 1 , 8 8 ( $ s p ) ; \
ldq $ 2 2 , 9 6 ( $ s p ) ; \
ldq $ 2 3 , 1 0 4 ( $ s p ) ; \
ldq $ 2 4 , 1 1 2 ( $ s p ) ; \
ldq $ 2 5 , 1 2 0 ( $ s p ) ; \
ldq $ 2 6 , 1 2 8 ( $ s p ) ; \
ldq $ 2 7 , 1 3 6 ( $ s p ) ; \
ldq $ 2 8 , 1 4 4 ( $ s p ) ; \
.macro RESTORE_ALL
lda $ 1 9 , a l p h a _ m v
ldq $ 0 , 0 ( $ s p )
ldq $ 1 , 8 ( $ s p )
ldq $ 2 , 1 6 ( $ s p )
ldq $ 3 , 2 4 ( $ s p )
ldq $ 2 1 , 1 5 2 ( $ s p )
ldq $ 2 0 , H A E _ C A C H E ( $ 1 9 )
ldq $ 4 , 3 2 ( $ s p )
ldq $ 5 , 4 0 ( $ s p )
ldq $ 6 , 4 8 ( $ s p )
ldq $ 7 , 5 6 ( $ s p )
subq $ 2 0 , $ 2 1 , $ 2 0
ldq $ 8 , 6 4 ( $ s p )
beq $ 2 0 , 9 9 f
ldq $ 2 0 , H A E _ R E G ( $ 1 9 )
stq $ 2 1 , H A E _ C A C H E ( $ 1 9 )
stq $ 2 1 , 0 ( $ 2 0 )
99 : ldq $ 1 9 , 7 2 ( $ s p )
ldq $ 2 0 , 8 0 ( $ s p )
ldq $ 2 1 , 8 8 ( $ s p )
ldq $ 2 2 , 9 6 ( $ s p )
ldq $ 2 3 , 1 0 4 ( $ s p )
ldq $ 2 4 , 1 1 2 ( $ s p )
ldq $ 2 5 , 1 2 0 ( $ s p )
ldq $ 2 6 , 1 2 8 ( $ s p )
ldq $ 2 7 , 1 3 6 ( $ s p )
ldq $ 2 8 , 1 4 4 ( $ s p )
addq $ s p , S P _ O F F , $ s p
.cfi_restore $ 0
.cfi_restore $ 1
.cfi_restore $ 2
.cfi_restore $ 3
.cfi_restore $ 4
.cfi_restore $ 5
.cfi_restore $ 6
.cfi_restore $ 7
.cfi_restore $ 8
.cfi_restore $ 1 9
.cfi_restore $ 2 0
.cfi_restore $ 2 1
.cfi_restore $ 2 2
.cfi_restore $ 2 3
.cfi_restore $ 2 4
.cfi_restore $ 2 5
.cfi_restore $ 2 6
.cfi_restore $ 2 7
.cfi_restore $ 2 8
.cfi_adjust_cfa_offset - SP_ O F F
.endm
.macro DO_SWITCH_STACK
bsr $ 1 , d o _ s w i t c h _ s t a c k
.cfi_adjust_cfa_offset SWITCH_STACK_SIZE
.cfi_rel_offset $ 9 , 0
.cfi_rel_offset $ 1 0 , 8
.cfi_rel_offset $ 1 1 , 1 6
.cfi_rel_offset $ 1 2 , 2 4
.cfi_rel_offset $ 1 3 , 3 2
.cfi_rel_offset $ 1 4 , 4 0
.cfi_rel_offset $ 1 5 , 4 8
/* We don't really care about the FP registers for debugging. */
.endm
.macro UNDO_SWITCH_STACK
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
.cfi_restore $ 9
.cfi_restore $ 1 0
.cfi_restore $ 1 1
.cfi_restore $ 1 2
.cfi_restore $ 1 3
.cfi_restore $ 1 4
.cfi_restore $ 1 5
.cfi_adjust_cfa_offset - SWITCH_ S T A C K _ S I Z E
.endm
/ *
* Non- s y s c a l l k e r n e l e n t r y p o i n t s .
* /
.align 4
.globl entInt
.ent entInt
entInt :
CFI_ S T A R T _ O S F _ F R A M E e n t I n t
SAVE_ A L L
lda $ 8 , 0 x3 f f f
lda $ 2 6 , r e t _ f r o m _ s y s _ c a l l
bic $ s p , $ 8 , $ 8
mov $ s p , $ 1 9
jsr $ 3 1 , d o _ e n t I n t
.end entInt
CFI_ E N D _ O S F _ F R A M E e n t I n t
.align 4
.globl entArith
.ent entArith
entArith :
CFI_ S T A R T _ O S F _ F R A M E e n t A r i t h
SAVE_ A L L
lda $ 8 , 0 x3 f f f
lda $ 2 6 , r e t _ f r o m _ s y s _ c a l l
bic $ s p , $ 8 , $ 8
mov $ s p , $ 1 8
jsr $ 3 1 , d o _ e n t A r i t h
.end entArith
CFI_ E N D _ O S F _ F R A M E e n t A r i t h
.align 4
.globl entMM
.ent entMM
entMM :
CFI_ S T A R T _ O S F _ F R A M E e n t M M
SAVE_ A L L
/* save $9 - $15 so the inline exception code can manipulate them. */
subq $ s p , 5 6 , $ s p
.cfi_adjust_cfa_offset 56
stq $ 9 , 0 ( $ s p )
stq $ 1 0 , 8 ( $ s p )
stq $ 1 1 , 1 6 ( $ s p )
@ -128,6 +207,13 @@ entMM:
stq $ 1 3 , 3 2 ( $ s p )
stq $ 1 4 , 4 0 ( $ s p )
stq $ 1 5 , 4 8 ( $ s p )
.cfi_rel_offset $ 9 , 0
.cfi_rel_offset $ 1 0 , 8
.cfi_rel_offset $ 1 1 , 1 6
.cfi_rel_offset $ 1 2 , 2 4
.cfi_rel_offset $ 1 3 , 3 2
.cfi_rel_offset $ 1 4 , 4 0
.cfi_rel_offset $ 1 5 , 4 8
addq $ s p , 5 6 , $ 1 9
/* handle the fault */
lda $ 8 , 0 x3 f f f
@ -142,28 +228,33 @@ entMM:
ldq $ 1 4 , 4 0 ( $ s p )
ldq $ 1 5 , 4 8 ( $ s p )
addq $ s p , 5 6 , $ s p
.cfi_restore $ 9
.cfi_restore $ 1 0
.cfi_restore $ 1 1
.cfi_restore $ 1 2
.cfi_restore $ 1 3
.cfi_restore $ 1 4
.cfi_restore $ 1 5
.cfi_adjust_cfa_offset - 5 6
/* finish up the syscall as normal. */
br r e t _ f r o m _ s y s _ c a l l
.end entMM
CFI_ E N D _ O S F _ F R A M E e n t M M
.align 4
.globl entIF
.ent entIF
entIF :
CFI_ S T A R T _ O S F _ F R A M E e n t I F
SAVE_ A L L
lda $ 8 , 0 x3 f f f
lda $ 2 6 , r e t _ f r o m _ s y s _ c a l l
bic $ s p , $ 8 , $ 8
mov $ s p , $ 1 7
jsr $ 3 1 , d o _ e n t I F
.end entIF
CFI_ E N D _ O S F _ F R A M E e n t I F
.align 4
.globl entUna
.ent entUna
entUna :
CFI_ S T A R T _ O S F _ F R A M E e n t U n a
lda $ s p , - 2 5 6 ( $ s p )
.cfi_adjust_cfa_offset 256
stq $ 0 , 0 ( $ s p )
.cfi_rel_offset $ 0 , 0
.cfi_remember_state
ldq $ 0 , 2 5 6 ( $ s p ) / * g e t P S * /
stq $ 1 , 8 ( $ s p )
stq $ 2 , 1 6 ( $ s p )
@ -195,6 +286,32 @@ entUna:
stq $ 2 8 , 2 2 4 ( $ s p )
mov $ s p , $ 1 9
stq $ g p , 2 3 2 ( $ s p )
.cfi_rel_offset $ 1 , 1 * 8
.cfi_rel_offset $ 2 , 2 * 8
.cfi_rel_offset $ 3 , 3 * 8
.cfi_rel_offset $ 4 , 4 * 8
.cfi_rel_offset $ 5 , 5 * 8
.cfi_rel_offset $ 6 , 6 * 8
.cfi_rel_offset $ 7 , 7 * 8
.cfi_rel_offset $ 8 , 8 * 8
.cfi_rel_offset $ 9 , 9 * 8
.cfi_rel_offset $ 1 0 , 1 0 * 8
.cfi_rel_offset $ 1 1 , 1 1 * 8
.cfi_rel_offset $ 1 2 , 1 2 * 8
.cfi_rel_offset $ 1 3 , 1 3 * 8
.cfi_rel_offset $ 1 4 , 1 4 * 8
.cfi_rel_offset $ 1 5 , 1 5 * 8
.cfi_rel_offset $ 1 9 , 1 9 * 8
.cfi_rel_offset $ 2 0 , 2 0 * 8
.cfi_rel_offset $ 2 1 , 2 1 * 8
.cfi_rel_offset $ 2 2 , 2 2 * 8
.cfi_rel_offset $ 2 3 , 2 3 * 8
.cfi_rel_offset $ 2 4 , 2 4 * 8
.cfi_rel_offset $ 2 5 , 2 5 * 8
.cfi_rel_offset $ 2 6 , 2 6 * 8
.cfi_rel_offset $ 2 7 , 2 7 * 8
.cfi_rel_offset $ 2 8 , 2 8 * 8
.cfi_rel_offset $ 2 9 , 2 9 * 8
lda $ 8 , 0 x3 f f f
stq $ 3 1 , 2 4 8 ( $ s p )
bic $ s p , $ 8 , $ 8
@ -228,16 +345,45 @@ entUna:
ldq $ 2 8 , 2 2 4 ( $ s p )
ldq $ g p , 2 3 2 ( $ s p )
lda $ s p , 2 5 6 ( $ s p )
.cfi_restore $ 1
.cfi_restore $ 2
.cfi_restore $ 3
.cfi_restore $ 4
.cfi_restore $ 5
.cfi_restore $ 6
.cfi_restore $ 7
.cfi_restore $ 8
.cfi_restore $ 9
.cfi_restore $ 1 0
.cfi_restore $ 1 1
.cfi_restore $ 1 2
.cfi_restore $ 1 3
.cfi_restore $ 1 4
.cfi_restore $ 1 5
.cfi_restore $ 1 9
.cfi_restore $ 2 0
.cfi_restore $ 2 1
.cfi_restore $ 2 2
.cfi_restore $ 2 3
.cfi_restore $ 2 4
.cfi_restore $ 2 5
.cfi_restore $ 2 6
.cfi_restore $ 2 7
.cfi_restore $ 2 8
.cfi_restore $ 2 9
.cfi_adjust_cfa_offset - 2 5 6
call_ p a l P A L _ r t i
.end entUna
.align 4
.ent entUnaUser
entUnaUser :
.cfi_restore_state
ldq $ 0 , 0 ( $ s p ) / * r e s t o r e o r i g i n a l $ 0 * /
lda $ s p , 2 5 6 ( $ s p ) / * p o p e n t U n a ' s s t a c k f r a m e * /
.cfi_restore $ 0
.cfi_adjust_cfa_offset - 2 5 6
SAVE_ A L L / * s e t u p n o r m a l k e r n e l s t a c k * /
lda $ s p , - 5 6 ( $ s p )
.cfi_adjust_cfa_offset 56
stq $ 9 , 0 ( $ s p )
stq $ 1 0 , 8 ( $ s p )
stq $ 1 1 , 1 6 ( $ s p )
@ -245,6 +391,13 @@ entUnaUser:
stq $ 1 3 , 3 2 ( $ s p )
stq $ 1 4 , 4 0 ( $ s p )
stq $ 1 5 , 4 8 ( $ s p )
.cfi_rel_offset $ 9 , 0
.cfi_rel_offset $ 1 0 , 8
.cfi_rel_offset $ 1 1 , 1 6
.cfi_rel_offset $ 1 2 , 2 4
.cfi_rel_offset $ 1 3 , 3 2
.cfi_rel_offset $ 1 4 , 4 0
.cfi_rel_offset $ 1 5 , 4 8
lda $ 8 , 0 x3 f f f
addq $ s p , 5 6 , $ 1 9
bic $ s p , $ 8 , $ 8
@ -257,20 +410,25 @@ entUnaUser:
ldq $ 1 4 , 4 0 ( $ s p )
ldq $ 1 5 , 4 8 ( $ s p )
lda $ s p , 5 6 ( $ s p )
.cfi_restore $ 9
.cfi_restore $ 1 0
.cfi_restore $ 1 1
.cfi_restore $ 1 2
.cfi_restore $ 1 3
.cfi_restore $ 1 4
.cfi_restore $ 1 5
.cfi_adjust_cfa_offset - 5 6
br r e t _ f r o m _ s y s _ c a l l
.end entUnaUser
CFI_ E N D _ O S F _ F R A M E e n t U n a
.align 4
.globl entDbg
.ent entDbg
entDbg :
CFI_ S T A R T _ O S F _ F R A M E e n t D b g
SAVE_ A L L
lda $ 8 , 0 x3 f f f
lda $ 2 6 , r e t _ f r o m _ s y s _ c a l l
bic $ s p , $ 8 , $ 8
mov $ s p , $ 1 6
jsr $ 3 1 , d o _ e n t D b g
.end entDbg
CFI_ E N D _ O S F _ F R A M E e n t D b g
/ *
* The s y s t e m c a l l e n t r y p o i n t i s s p e c i a l . M o s t i m p o r t a n t l y , i t l o o k s
@ -285,8 +443,12 @@ entDbg:
.align 4
.globl entSys
.globl ret_from_sys_call
.ent entSys
.type entSys, @function
.cfi_startproc simple
.cfi_return_column 64
.cfi_def_cfa $ sp, 4 8
.cfi_rel_offset 6 4 , 8
.cfi_rel_offset $ gp, 1 6
entSys :
SAVE_ A L L
lda $ 8 , 0 x3 f f f
@ -300,6 +462,9 @@ entSys:
stq $ 1 7 , S P _ O F F + 3 2 ( $ s p )
s8 a d d q $ 0 , $ 5 , $ 5
stq $ 1 8 , S P _ O F F + 4 0 ( $ s p )
.cfi_rel_offset $ 1 6 , SP_ O F F + 2 4
.cfi_rel_offset $ 1 7 , SP_ O F F + 3 2
.cfi_rel_offset $ 1 8 , SP_ O F F + 4 0
blbs $ 3 , s t r a c e
beq $ 4 , 1 f
ldq $ 2 7 , 0 ( $ 5 )
@ -310,6 +475,7 @@ entSys:
stq $ 3 1 , 7 2 ( $ s p ) / * a3 =0 = > n o e r r o r * /
.align 4
.globl ret_from_sys_call
ret_from_sys_call :
cmovne $ 2 6 , 0 , $ 1 8 / * $ 1 8 = 0 = > n o n - r e s t a r t a b l e * /
ldq $ 0 , S P _ O F F ( $ s p )
@ -324,10 +490,12 @@ ret_to_user:
and $ 1 7 , _ T I F _ W O R K _ M A S K , $ 2
bne $ 2 , w o r k _ p e n d i n g
restore_all :
.cfi_remember_state
RESTORE_ A L L
call_ p a l P A L _ r t i
ret_to_kernel :
.cfi_restore_state
lda $ 1 6 , 7
call_ p a l P A L _ s w p i p l
br r e s t o r e _ a l l
@ -356,7 +524,6 @@ $ret_success:
stq $ 0 , 0 ( $ s p )
stq $ 3 1 , 7 2 ( $ s p ) / * a3 =0 = > n o e r r o r * /
br r e t _ f r o m _ s y s _ c a l l
.end entSys
/ *
* Do a l l c l e a n u p w h e n r e t u r n i n g f r o m a l l i n t e r r u p t s a n d s y s t e m c a l l s .
@ -370,7 +537,7 @@ $ret_success:
* /
.align 4
.ent work_pen ding
.typ e work_ p e n d i n g , @function
work_pending :
and $ 1 7 , _ T I F _ N O T I F Y _ R E S U M E | _ T I F _ S I G P E N D I N G , $ 2
bne $ 2 , $ w o r k _ n o t i f y s i g
@ -387,23 +554,22 @@ $work_resched:
$ work_notifysig :
mov $ s p , $ 1 6
bsr $ 1 , d o _ s w i t c h _ s t a c k
DO_ S W I T C H _ S T A C K
jsr $ 2 6 , d o _ w o r k _ p e n d i n g
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
UNDO_ S W I T C H _ S T A C K
br r e s t o r e _ a l l
.end work_pending
/ *
* PTRACE s y s c a l l h a n d l e r
* /
.align 4
.ent strace
.typ e strace, @function
strace :
/* set up signal stack, call syscall_trace */
bsr $ 1 , d o _ s w i t c h _ s t a c k
DO_ S W I T C H _ S T A C K
jsr $ 2 6 , s y s c a l l _ t r a c e _ e n t e r / * r e t u r n s t h e s y s c a l l n u m b e r * /
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
UNDO_ S W I T C H _ S T A C K
/* get the arguments back.. */
ldq $ 1 6 , S P _ O F F + 2 4 ( $ s p )
@ -431,9 +597,9 @@ ret_from_straced:
$ strace_success :
stq $ 0 , 0 ( $ s p ) / * s a v e r e t u r n v a l u e * /
bsr $ 1 , d o _ s w i t c h _ s t a c k
DO_ S W I T C H _ S T A C K
jsr $ 2 6 , s y s c a l l _ t r a c e _ l e a v e
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
UNDO_ S W I T C H _ S T A C K
br $ 3 1 , r e t _ f r o m _ s y s _ c a l l
.align 3
@ -447,26 +613,31 @@ $strace_error:
stq $ 0 , 0 ( $ s p )
stq $ 1 , 7 2 ( $ s p ) / * a3 f o r r e t u r n * /
bsr $ 1 , d o _ s w i t c h _ s t a c k
DO_ S W I T C H _ S T A C K
mov $ 1 8 , $ 9 / * s a v e o l d s y s c a l l n u m b e r * /
mov $ 1 9 , $ 1 0 / * s a v e o l d a3 * /
jsr $ 2 6 , s y s c a l l _ t r a c e _ l e a v e
mov $ 9 , $ 1 8
mov $ 1 0 , $ 1 9
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
UNDO_ S W I T C H _ S T A C K
mov $ 3 1 , $ 2 6 / * t e l l " r e t _ f r o m _ s y s _ c a l l " w e c a n r e s t a r t * /
br r e t _ f r o m _ s y s _ c a l l
.end strace
CFI_ E N D _ O S F _ F R A M E e n t S y s
/ *
* Save a n d r e s t o r e t h e s w i t c h s t a c k - - a k a t h e b a l a n c e o f t h e u s e r c o n t e x t .
* /
.align 4
.ent do_switch_stack
.type do_ s w i t c h _ s t a c k , @function
.cfi_startproc simple
.cfi_return_column 64
.cfi_def_cfa $ sp, 0
.cfi_register 6 4 , $ 1
do_switch_stack :
lda $ s p , - S W I T C H _ S T A C K _ S I Z E ( $ s p )
.cfi_adjust_cfa_offset SWITCH_STACK_SIZE
stq $ 9 , 0 ( $ s p )
stq $ 1 0 , 8 ( $ s p )
stq $ 1 1 , 1 6 ( $ s p )
@ -510,10 +681,14 @@ do_switch_stack:
stt $ f0 , 3 1 2 ( $ s p ) # s a v e f p c r i n s l o t o f $ f 31
ldt $ f0 , 6 4 ( $ s p ) # d o n t l e t " do_switch_stack " c h a n g e f p s t a t e .
ret $ 3 1 , ( $ 1 ) , 1
.end do_switch_stack
.cfi_endproc
.size do_ s w i t c h _ s t a c k , . - d o _ s w i t c h _ s t a c k
.align 4
.ent undo_switch_stack
.type undo_ s w i t c h _ s t a c k , @function
.cfi_startproc simple
.cfi_def_cfa $ sp, 0
.cfi_register 6 4 , $ 1
undo_switch_stack :
ldq $ 9 , 0 ( $ s p )
ldq $ 1 0 , 8 ( $ s p )
@ -558,7 +733,8 @@ undo_switch_stack:
ldt $ f30 , 3 0 4 ( $ s p )
lda $ s p , S W I T C H _ S T A C K _ S I Z E ( $ s p )
ret $ 3 1 , ( $ 1 ) , 1
.end undo_switch_stack
.cfi_endproc
.size undo_ s w i t c h _ s t a c k , . - u n d o _ s w i t c h _ s t a c k
/ *
* The m e a t o f t h e c o n t e x t s w i t c h c o d e .
@ -566,17 +742,18 @@ undo_switch_stack:
.align 4
.globl alpha_switch_to
.ent alpha_switch_to
.type alpha_ s w i t c h _ t o , @function
.cfi_startproc
alpha_switch_to :
.prologue 0
bsr $ 1 , d o _ s w i t c h _ s t a c k
DO_ S W I T C H _ S T A C K
call_ p a l P A L _ s w p c t x
lda $ 8 , 0 x3 f f f
bsr $ 1 , u n d o _ s w i t c h _ s t a c k
UNDO_ S W I T C H _ S T A C K
bic $ s p , $ 8 , $ 8
mov $ 1 7 , $ 0
ret
.end alpha_switch_to
.cfi_endproc
.size alpha_ s w i t c h _ t o , . - a l p h a _ s w i t c h _ t o
/ *
* New p r o c e s s e s b e g i n l i f e h e r e .