2005-04-17 02:20:36 +04:00
/ *
* r6 0 0 0 _ f p u . S : S a v e / r e s t o r e f l o a t i n g p o i n t c o n t e x t f o r s i g n a l h a n d l e r s .
*
* 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 P u b l i c
* License. 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 a r c h i v e
* for m o r e d e t a i l s .
*
* Copyright ( C ) 1 9 9 6 b y R a l f B a e c h l e
*
* Multi- a r c h a b s t r a c t i o n a n d a s m m a c r o s f o r e a s i e r r e a d i n g :
* Copyright ( C ) 1 9 9 6 D a v i d S . M i l l e r ( d m @engr.sgi.com)
* /
# include < a s m / a s m . h >
# include < a s m / f p r e g d e f . h >
# include < a s m / m i p s r e g s . h >
2005-09-10 00:32:31 +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
# include < a s m / r e g d e f . h >
.set noreorder
.set mips2
/* Save floating point context */
LEAF( _ s a v e _ f p _ c o n t e x t )
mfc0 t 0 ,C P 0 _ S T A T U S
sll t 0 ,t 0 ,2
bgez t 0 ,1 f
nop
cfc1 t 1 ,f c r31
/* Store the 16 double precision registers */
sdc1 $ f0 ,( S C _ F P R E G S + 0 ) ( a0 )
sdc1 $ f2 ,( S C _ F P R E G S + 1 6 ) ( a0 )
sdc1 $ f4 ,( S C _ F P R E G S + 3 2 ) ( a0 )
sdc1 $ f6 ,( S C _ F P R E G S + 4 8 ) ( a0 )
sdc1 $ f8 ,( S C _ F P R E G S + 6 4 ) ( a0 )
sdc1 $ f10 ,( S C _ F P R E G S + 8 0 ) ( a0 )
sdc1 $ f12 ,( S C _ F P R E G S + 9 6 ) ( a0 )
sdc1 $ f14 ,( S C _ F P R E G S + 1 1 2 ) ( a0 )
sdc1 $ f16 ,( S C _ F P R E G S + 1 2 8 ) ( a0 )
sdc1 $ f18 ,( S C _ F P R E G S + 1 4 4 ) ( a0 )
sdc1 $ f20 ,( S C _ F P R E G S + 1 6 0 ) ( a0 )
sdc1 $ f22 ,( S C _ F P R E G S + 1 7 6 ) ( a0 )
sdc1 $ f24 ,( S C _ F P R E G S + 1 9 2 ) ( a0 )
sdc1 $ f26 ,( S C _ F P R E G S + 2 0 8 ) ( a0 )
sdc1 $ f28 ,( S C _ F P R E G S + 2 2 4 ) ( a0 )
sdc1 $ f30 ,( S C _ F P R E G S + 2 4 0 ) ( a0 )
jr r a
sw t 0 ,S C _ F P C _ C S R ( a0 )
1 : jr r a
nop
END( _ s a v e _ f p _ c o n t e x t )
/ * Restore F P U s t a t e :
* - fp g p r e g i s t e r s
* - cp1 s t a t u s / c o n t r o l r e g i s t e r
*
* We b a s e t h e d e c i s i o n w h i c h r e g i s t e r s t o r e s t o r e f r o m t h e s i g n a l s t a c k
* frame o n t h e c u r r e n t c o n t e n t o f c0 _ s t a t u s , n o t o n t h e c o n t e n t o f t h e
* stack f r a m e w h i c h m i g h t h a v e b e e n c h a n g e d b y t h e u s e r .
* /
LEAF( _ r e s t o r e _ f p _ c o n t e x t )
mfc0 t 0 ,C P 0 _ S T A T U S
sll t 0 ,t 0 ,2
bgez t 0 ,1 f
lw t 0 ,S C _ F P C _ C S R ( a0 )
/* Restore the 16 double precision registers */
ldc1 $ f0 ,( S C _ F P R E G S + 0 ) ( a0 )
ldc1 $ f2 ,( S C _ F P R E G S + 1 6 ) ( a0 )
ldc1 $ f4 ,( S C _ F P R E G S + 3 2 ) ( a0 )
ldc1 $ f6 ,( S C _ F P R E G S + 4 8 ) ( a0 )
ldc1 $ f8 ,( S C _ F P R E G S + 6 4 ) ( a0 )
ldc1 $ f10 ,( S C _ F P R E G S + 8 0 ) ( a0 )
ldc1 $ f12 ,( S C _ F P R E G S + 9 6 ) ( a0 )
ldc1 $ f14 ,( S C _ F P R E G S + 1 1 2 ) ( a0 )
ldc1 $ f16 ,( S C _ F P R E G S + 1 2 8 ) ( a0 )
ldc1 $ f18 ,( S C _ F P R E G S + 1 4 4 ) ( a0 )
ldc1 $ f20 ,( S C _ F P R E G S + 1 6 0 ) ( a0 )
ldc1 $ f22 ,( S C _ F P R E G S + 1 7 6 ) ( a0 )
ldc1 $ f24 ,( S C _ F P R E G S + 1 9 2 ) ( a0 )
ldc1 $ f26 ,( S C _ F P R E G S + 2 0 8 ) ( a0 )
ldc1 $ f28 ,( S C _ F P R E G S + 2 2 4 ) ( a0 )
ldc1 $ f30 ,( S C _ F P R E G S + 2 4 0 ) ( a0 )
jr r a
ctc1 t 0 ,f c r31
1 : jr r a
nop
END( _ r e s t o r e _ f p _ c o n t e x t )