2005-04-16 15:20:36 -07:00
/ *
* 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 , 9 8 , 9 9 , 2 0 0 0 , 0 1 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 :
2011-04-04 14:15:29 -07:00
* Copyright ( C ) 1 9 9 6 D a v i d S . M i l l e r ( d a v e m @davemloft.net)
2005-04-16 15:20:36 -07:00
*
* Carsten L a n g g a a r d , c a r s t e n l @mips.com
* Copyright ( C ) 2 0 0 0 M I P S T e c h n o l o g i e s , I n c .
* Copyright ( C ) 1 9 9 9 , 2 0 0 1 S i l i c o n G r a p h i c s , I n c .
* /
# include < a s m / a s m . h >
2015-06-22 12:20:59 +01:00
# include < a s m / a s m m a c r o . h >
2005-04-16 15:20:36 -07:00
# include < a s m / e r r n o . 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-09 22:32:31 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
# include < a s m / r e g d e f . h >
2014-11-07 14:13:54 +01:00
/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
# undef f p
2005-04-16 15:20:36 -07:00
.macro EX insn, r e g , s r c
.set push
2014-11-07 14:13:54 +01:00
SET_ H A R D F L O A T
2005-04-16 15:20:36 -07:00
.set nomacro
.ex \ @: \insn \reg, \src
.set pop
.section _ _ ex_ t a b l e ," a "
PTR . e x \ @, fault
.previous
.endm
.set noreorder
2005-05-31 11:49:19 +00:00
2015-07-27 12:58:15 -07:00
/ * *
* _ save_ f p _ c o n t e x t ( ) - s a v e F P c o n t e x t f r o m t h e F P U
* @a0 - pointer to fpregs field of sigcontext
* @a1 - pointer to fpc_csr field of sigcontext
*
* Save F P c o n t e x t , i n c l u d i n g t h e 3 2 F P d a t a r e g i s t e r s a n d t h e F P
* control & s t a t u s r e g i s t e r , f r o m t h e F P U t o s i g n a l c o n t e x t .
* /
2005-04-16 15:20:36 -07:00
LEAF( _ s a v e _ f p _ c o n t e x t )
2014-11-07 14:13:54 +01:00
.set push
SET_ H A R D F L O A T
2005-04-16 15:20:36 -07:00
cfc1 t 1 , f c r31
2014-11-07 14:13:54 +01:00
.set pop
2005-04-16 15:20:36 -07:00
2014-11-25 10:08:45 +00:00
# if d e f i n e d ( C O N F I G _ 6 4 B I T ) | | d e f i n e d ( C O N F I G _ C P U _ M I P S 3 2 _ R 2 ) | | \
defined( C O N F I G _ C P U _ M I P S 3 2 _ R 6 )
2013-11-22 13:12:07 +00:00
.set push
2014-11-07 14:13:54 +01:00
SET_ H A R D F L O A T
2014-02-09 14:32:25 +01:00
# ifdef C O N F I G _ C P U _ M I P S 3 2 _ R 2
2014-11-07 14:13:54 +01:00
.set mips32r2
.set fp=64
2013-11-22 13:12:07 +00:00
mfc0 t 0 , C P 0 _ S T A T U S
sll t 0 , t 0 , 5
bgez t 0 , 1 f # s k i p s t o r i n g o d d i f F R = 0
nop
# endif
2005-04-16 15:20:36 -07:00
/* Store the 16 odd double precision registers */
2015-07-27 12:58:15 -07:00
EX s d c1 $ f1 , 8 ( a0 )
EX s d c1 $ f3 , 2 4 ( a0 )
EX s d c1 $ f5 , 4 0 ( a0 )
EX s d c1 $ f7 , 5 6 ( a0 )
EX s d c1 $ f9 , 7 2 ( a0 )
EX s d c1 $ f11 , 8 8 ( a0 )
EX s d c1 $ f13 , 1 0 4 ( a0 )
EX s d c1 $ f15 , 1 2 0 ( a0 )
EX s d c1 $ f17 , 1 3 6 ( a0 )
EX s d c1 $ f19 , 1 5 2 ( a0 )
EX s d c1 $ f21 , 1 6 8 ( a0 )
EX s d c1 $ f23 , 1 8 4 ( a0 )
EX s d c1 $ f25 , 2 0 0 ( a0 )
EX s d c1 $ f27 , 2 1 6 ( a0 )
EX s d c1 $ f29 , 2 3 2 ( a0 )
EX s d c1 $ f31 , 2 4 8 ( a0 )
2013-11-22 13:12:07 +00:00
1 : .set p o p
2005-04-16 15:20:36 -07:00
# endif
2014-11-07 14:13:54 +01:00
.set push
SET_ H A R D F L O A T
2005-04-16 15:20:36 -07:00
/* Store the 16 even double precision registers */
2015-07-27 12:58:15 -07:00
EX s d c1 $ f0 , 0 ( a0 )
EX s d c1 $ f2 , 1 6 ( a0 )
EX s d c1 $ f4 , 3 2 ( a0 )
EX s d c1 $ f6 , 4 8 ( a0 )
EX s d c1 $ f8 , 6 4 ( a0 )
EX s d c1 $ f10 , 8 0 ( a0 )
EX s d c1 $ f12 , 9 6 ( a0 )
EX s d c1 $ f14 , 1 1 2 ( a0 )
EX s d c1 $ f16 , 1 2 8 ( a0 )
EX s d c1 $ f18 , 1 4 4 ( a0 )
EX s d c1 $ f20 , 1 6 0 ( a0 )
EX s d c1 $ f22 , 1 7 6 ( a0 )
EX s d c1 $ f24 , 1 9 2 ( a0 )
EX s d c1 $ f26 , 2 0 8 ( a0 )
EX s d c1 $ f28 , 2 2 4 ( a0 )
EX s d c1 $ f30 , 2 4 0 ( a0 )
EX s w t 1 , 0 ( a1 )
2005-04-16 15:20:36 -07:00
jr r a
li v0 , 0 # s u c c e s s
2014-11-07 14:13:54 +01:00
.set pop
2005-04-16 15:20:36 -07:00
END( _ s a v e _ f p _ c o n t e x t )
2015-07-27 12:58:15 -07:00
/ * *
* _ restore_ f p _ c o n t e x t ( ) - r e s t o r e F P c o n t e x t t o t h e F P U
* @a0 - pointer to fpregs field of sigcontext
* @a1 - pointer to fpc_csr field of sigcontext
*
* Restore F P c o n t e x t , i n c l u d i n g t h e 3 2 F P d a t a r e g i s t e r s a n d t h e F P
* control & s t a t u s r e g i s t e r , f r o m s i g n a l c o n t e x t t o t h e F P U .
2005-04-16 15:20:36 -07:00
* /
LEAF( _ r e s t o r e _ f p _ c o n t e x t )
2015-07-27 12:58:15 -07:00
EX l w t 1 , 0 ( a1 )
2013-11-22 13:12:07 +00:00
2014-11-25 10:08:45 +00:00
# if d e f i n e d ( C O N F I G _ 6 4 B I T ) | | d e f i n e d ( C O N F I G _ C P U _ M I P S 3 2 _ R 2 ) | | \
defined( C O N F I G _ C P U _ M I P S 3 2 _ R 6 )
2013-11-22 13:12:07 +00:00
.set push
2014-11-07 14:13:54 +01:00
SET_ H A R D F L O A T
2014-02-09 14:32:25 +01:00
# ifdef C O N F I G _ C P U _ M I P S 3 2 _ R 2
2014-11-07 14:13:54 +01:00
.set mips32r2
.set fp=64
2013-11-22 13:12:07 +00:00
mfc0 t 0 , C P 0 _ S T A T U S
sll t 0 , t 0 , 5
bgez t 0 , 1 f # s k i p l o a d i n g o d d i f F R = 0
nop
# endif
2015-07-27 12:58:15 -07:00
EX l d c1 $ f1 , 8 ( a0 )
EX l d c1 $ f3 , 2 4 ( a0 )
EX l d c1 $ f5 , 4 0 ( a0 )
EX l d c1 $ f7 , 5 6 ( a0 )
EX l d c1 $ f9 , 7 2 ( a0 )
EX l d c1 $ f11 , 8 8 ( a0 )
EX l d c1 $ f13 , 1 0 4 ( a0 )
EX l d c1 $ f15 , 1 2 0 ( a0 )
EX l d c1 $ f17 , 1 3 6 ( a0 )
EX l d c1 $ f19 , 1 5 2 ( a0 )
EX l d c1 $ f21 , 1 6 8 ( a0 )
EX l d c1 $ f23 , 1 8 4 ( a0 )
EX l d c1 $ f25 , 2 0 0 ( a0 )
EX l d c1 $ f27 , 2 1 6 ( a0 )
EX l d c1 $ f29 , 2 3 2 ( a0 )
EX l d c1 $ f31 , 2 4 8 ( a0 )
2013-11-22 13:12:07 +00:00
1 : .set p o p
2005-04-16 15:20:36 -07:00
# endif
2014-11-07 14:13:54 +01:00
.set push
SET_ H A R D F L O A T
2015-07-27 12:58:15 -07:00
EX l d c1 $ f0 , 0 ( a0 )
EX l d c1 $ f2 , 1 6 ( a0 )
EX l d c1 $ f4 , 3 2 ( a0 )
EX l d c1 $ f6 , 4 8 ( a0 )
EX l d c1 $ f8 , 6 4 ( a0 )
EX l d c1 $ f10 , 8 0 ( a0 )
EX l d c1 $ f12 , 9 6 ( a0 )
EX l d c1 $ f14 , 1 1 2 ( a0 )
EX l d c1 $ f16 , 1 2 8 ( a0 )
EX l d c1 $ f18 , 1 4 4 ( a0 )
EX l d c1 $ f20 , 1 6 0 ( a0 )
EX l d c1 $ f22 , 1 7 6 ( a0 )
EX l d c1 $ f24 , 1 9 2 ( a0 )
EX l d c1 $ f26 , 2 0 8 ( a0 )
EX l d c1 $ f28 , 2 2 4 ( a0 )
EX l d c1 $ f30 , 2 4 0 ( a0 )
2014-02-07 22:31:33 +08:00
ctc1 t 1 , f c r31
2014-11-07 14:13:54 +01:00
.set pop
2005-04-16 15:20:36 -07:00
jr r a
li v0 , 0 # s u c c e s s
END( _ r e s t o r e _ f p _ c o n t e x t )
2015-06-22 12:20:59 +01:00
# ifdef C O N F I G _ C P U _ H A S _ M S A
.macro op_one_wr op, i d x , b a s e
.align 4
\ idx : \ op \ i d x , 0 , \ b a s e
jr r a
nop
.endm
.macro op_msa_wr name, o p
LEAF( \ n a m e )
.set push
.set noreorder
sll t 0 , a0 , 4
PTR_ L A t 1 , 0 f
PTR_ A D D U t 0 , t 0 , t 1
jr t 0
nop
op_ o n e _ w r \ o p , 0 , a1
op_ o n e _ w r \ o p , 1 , a1
op_ o n e _ w r \ o p , 2 , a1
op_ o n e _ w r \ o p , 3 , a1
op_ o n e _ w r \ o p , 4 , a1
op_ o n e _ w r \ o p , 5 , a1
op_ o n e _ w r \ o p , 6 , a1
op_ o n e _ w r \ o p , 7 , a1
op_ o n e _ w r \ o p , 8 , a1
op_ o n e _ w r \ o p , 9 , a1
op_ o n e _ w r \ o p , 1 0 , a1
op_ o n e _ w r \ o p , 1 1 , a1
op_ o n e _ w r \ o p , 1 2 , a1
op_ o n e _ w r \ o p , 1 3 , a1
op_ o n e _ w r \ o p , 1 4 , a1
op_ o n e _ w r \ o p , 1 5 , a1
op_ o n e _ w r \ o p , 1 6 , a1
op_ o n e _ w r \ o p , 1 7 , a1
op_ o n e _ w r \ o p , 1 8 , a1
op_ o n e _ w r \ o p , 1 9 , a1
op_ o n e _ w r \ o p , 2 0 , a1
op_ o n e _ w r \ o p , 2 1 , a1
op_ o n e _ w r \ o p , 2 2 , a1
op_ o n e _ w r \ o p , 2 3 , a1
op_ o n e _ w r \ o p , 2 4 , a1
op_ o n e _ w r \ o p , 2 5 , a1
op_ o n e _ w r \ o p , 2 6 , a1
op_ o n e _ w r \ o p , 2 7 , a1
op_ o n e _ w r \ o p , 2 8 , a1
op_ o n e _ w r \ o p , 2 9 , a1
op_ o n e _ w r \ o p , 3 0 , a1
op_ o n e _ w r \ o p , 3 1 , a1
.set pop
END( \ n a m e )
.endm
op_ m s a _ w r r e a d _ m s a _ w r _ b , s t _ b
op_ m s a _ w r r e a d _ m s a _ w r _ h , s t _ h
op_ m s a _ w r r e a d _ m s a _ w r _ w , s t _ w
op_ m s a _ w r r e a d _ m s a _ w r _ d , s t _ d
op_ m s a _ w r w r i t e _ m s a _ w r _ b , l d _ b
op_ m s a _ w r w r i t e _ m s a _ w r _ h , l d _ h
op_ m s a _ w r w r i t e _ m s a _ w r _ w , l d _ w
op_ m s a _ w r w r i t e _ m s a _ w r _ d , l d _ d
# endif / * C O N F I G _ C P U _ H A S _ M S A * /
2007-02-01 19:54:13 +00:00
.set reorder
2005-04-16 15:20:36 -07:00
.type fault@function
.ent fault
fault : li v0 , - E F A U L T # f a i l u r e
jr r a
.end fault