2017-07-10 18:04:30 -07:00
/ *
* Copyright ( C ) 2 0 1 2 R e g e n t s o f t h e U n i v e r s i t y o f C a l i f o r n i a
* Copyright ( C ) 2 0 1 7 S i F i v e
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* as p u b l i s h e d b y t h e F r e e S o f t w a r e F o u n d a t i o n , v e r s i o n 2 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
* /
# include < l i n u x / i n i t . h >
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s m . h >
# include < a s m / c s r . h >
# include < a s m / u n i s t d . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / a s m - o f f s e t s . h >
.text
.altmacro
/ *
* Prepares t o e n t e r a s y s t e m c a l l o r e x c e p t i o n b y s a v i n g a l l r e g i s t e r s t o t h e
* stack.
* /
.macro SAVE_ALL
LOCAL _ r e s t o r e _ k e r n e l _ t p s p
LOCAL _ s a v e _ c o n t e x t
/ *
* If c o m i n g f r o m u s e r s p a c e , p r e s e r v e t h e u s e r t h r e a d p o i n t e r a n d l o a d
* the k e r n e l t h r e a d p o i n t e r . I f w e c a m e f r o m t h e k e r n e l , s s c r a t c h
* will c o n t a i n 0 , a n d w e s h o u l d c o n t i n u e o n t h e c u r r e n t T P .
* /
csrrw t p , s s c r a t c h , t p
bnez t p , _ s a v e _ c o n t e x t
_restore_kernel_tpsp :
csrr t p , s s c r a t c h
REG_ S s p , T A S K _ T I _ K E R N E L _ S P ( t p )
_save_context :
REG_ S s p , T A S K _ T I _ U S E R _ S P ( t p )
REG_ L s p , T A S K _ T I _ K E R N E L _ S P ( t p )
addi s p , s p , - ( P T _ S I Z E _ O N _ S T A C K )
REG_ S x1 , P T _ R A ( s p )
REG_ S x3 , P T _ G P ( s p )
REG_ S x5 , P T _ T 0 ( s p )
REG_ S x6 , P T _ T 1 ( s p )
REG_ S x7 , P T _ T 2 ( s p )
REG_ S x8 , P T _ S 0 ( s p )
REG_ S x9 , P T _ S 1 ( s p )
REG_ S x10 , P T _ A 0 ( s p )
REG_ S x11 , P T _ A 1 ( s p )
REG_ S x12 , P T _ A 2 ( s p )
REG_ S x13 , P T _ A 3 ( s p )
REG_ S x14 , P T _ A 4 ( s p )
REG_ S x15 , P T _ A 5 ( s p )
REG_ S x16 , P T _ A 6 ( s p )
REG_ S x17 , P T _ A 7 ( s p )
REG_ S x18 , P T _ S 2 ( s p )
REG_ S x19 , P T _ S 3 ( s p )
REG_ S x20 , P T _ S 4 ( s p )
REG_ S x21 , P T _ S 5 ( s p )
REG_ S x22 , P T _ S 6 ( s p )
REG_ S x23 , P T _ S 7 ( s p )
REG_ S x24 , P T _ S 8 ( s p )
REG_ S x25 , P T _ S 9 ( s p )
REG_ S x26 , P T _ S 1 0 ( s p )
REG_ S x27 , P T _ S 1 1 ( s p )
REG_ S x28 , P T _ T 3 ( s p )
REG_ S x29 , P T _ T 4 ( s p )
REG_ S x30 , P T _ T 5 ( s p )
REG_ S x31 , P T _ T 6 ( s p )
/ *
2018-01-04 19:55:55 +01:00
* Disable u s e r - m o d e m e m o r y a c c e s s a s i t s h o u l d o n l y b e s e t i n t h e
* actual u s e r c o p y r o u t i n e s .
*
* Disable t h e F P U t o d e t e c t i l l e g a l u s a g e o f f l o a t i n g p o i n t i n k e r n e l
* space.
2017-07-10 18:04:30 -07:00
* /
2018-01-04 19:55:55 +01:00
li t 0 , S R _ S U M | S R _ F S
2017-07-10 18:04:30 -07:00
REG_ L s0 , T A S K _ T I _ U S E R _ S P ( t p )
csrrc s1 , s s t a t u s , t 0
csrr s2 , s e p c
csrr s3 , s b a d a d d r
csrr s4 , s c a u s e
csrr s5 , s s c r a t c h
REG_ S s0 , P T _ S P ( s p )
REG_ S s1 , P T _ S S T A T U S ( s p )
REG_ S s2 , P T _ S E P C ( s p )
REG_ S s3 , P T _ S B A D A D D R ( s p )
REG_ S s4 , P T _ S C A U S E ( s p )
REG_ S s5 , P T _ T P ( s p )
.endm
/ *
* Prepares t o r e t u r n f r o m a s y s t e m c a l l o r e x c e p t i o n b y r e s t o r i n g a l l
* registers f r o m t h e s t a c k .
* /
.macro RESTORE_ALL
REG_ L a0 , P T _ S S T A T U S ( s p )
REG_ L a2 , P T _ S E P C ( s p )
csrw s s t a t u s , a0
csrw s e p c , a2
REG_ L x1 , P T _ R A ( s p )
REG_ L x3 , P T _ G P ( s p )
REG_ L x4 , P T _ T P ( s p )
REG_ L x5 , P T _ T 0 ( s p )
REG_ L x6 , P T _ T 1 ( s p )
REG_ L x7 , P T _ T 2 ( s p )
REG_ L x8 , P T _ S 0 ( s p )
REG_ L x9 , P T _ S 1 ( s p )
REG_ L x10 , P T _ A 0 ( s p )
REG_ L x11 , P T _ A 1 ( s p )
REG_ L x12 , P T _ A 2 ( s p )
REG_ L x13 , P T _ A 3 ( s p )
REG_ L x14 , P T _ A 4 ( s p )
REG_ L x15 , P T _ A 5 ( s p )
REG_ L x16 , P T _ A 6 ( s p )
REG_ L x17 , P T _ A 7 ( s p )
REG_ L x18 , P T _ S 2 ( s p )
REG_ L x19 , P T _ S 3 ( s p )
REG_ L x20 , P T _ S 4 ( s p )
REG_ L x21 , P T _ S 5 ( s p )
REG_ L x22 , P T _ S 6 ( s p )
REG_ L x23 , P T _ S 7 ( s p )
REG_ L x24 , P T _ S 8 ( s p )
REG_ L x25 , P T _ S 9 ( s p )
REG_ L x26 , P T _ S 1 0 ( s p )
REG_ L x27 , P T _ S 1 1 ( s p )
REG_ L x28 , P T _ T 3 ( s p )
REG_ L x29 , P T _ T 4 ( s p )
REG_ L x30 , P T _ T 5 ( s p )
REG_ L x31 , P T _ T 6 ( s p )
REG_ L x2 , P T _ S P ( s p )
.endm
ENTRY( h a n d l e _ e x c e p t i o n )
SAVE_ A L L
/ *
* Set s s c r a t c h r e g i s t e r t o 0 , s o t h a t i f a r e c u r s i v e e x c e p t i o n
* occurs, t h e e x c e p t i o n v e c t o r k n o w s i t c a m e f r o m t h e k e r n e l
* /
csrw s s c r a t c h , x0
/* Load the global pointer */
.option push
.option norelax
la g p , _ _ g l o b a l _ p o i n t e r $
.option pop
la r a , r e t _ f r o m _ e x c e p t i o n
/ *
* MSB o f c a u s e d i f f e r e n t i a t e s b e t w e e n
* interrupts a n d e x c e p t i o n s
* /
bge s4 , z e r o , 1 f
/* Handle interrupts */
slli a0 , s4 , 1
srli a0 , a0 , 1
move a1 , s p / * p t _ r e g s * /
tail d o _ I R Q
1 :
/* Handle syscalls */
li t 0 , E X C _ S Y S C A L L
beq s4 , t 0 , h a n d l e _ s y s c a l l
/* Handle other exceptions */
slli t 0 , s4 , R I S C V _ L G P T R
la t 1 , e x c p _ v e c t _ t a b l e
la t 2 , e x c p _ v e c t _ t a b l e _ e n d
move a0 , s p / * p t _ r e g s * /
add t 0 , t 1 , t 0
/* Check if exception code lies within bounds */
bgeu t 0 , t 2 , 1 f
REG_ L t 0 , 0 ( t 0 )
jr t 0
1 :
tail d o _ t r a p _ u n k n o w n
handle_syscall :
/* save the initial A0 value (needed in signal handlers) */
REG_ S a0 , P T _ O R I G _ A 0 ( s p )
/ *
* Advance S E P C t o a v o i d e x e c u t i n g t h e o r i g i n a l
* scall i n s t r u c t i o n o n s r e t
* /
addi s2 , s2 , 0 x4
REG_ S s2 , P T _ S E P C ( s p )
/* System calls run with interrupts enabled */
2018-01-04 18:35:03 +01:00
csrs s s t a t u s , S R _ S I E
2017-07-10 18:04:30 -07:00
/* Trace syscalls, but only if requested by the user. */
REG_ L t 0 , T A S K _ T I _ F L A G S ( t p )
andi t 0 , t 0 , _ T I F _ S Y S C A L L _ T R A C E
bnez t 0 , h a n d l e _ s y s c a l l _ t r a c e _ e n t e r
check_syscall_nr :
/* Check to make sure we don't jump to a bogus syscall number. */
li t 0 , _ _ N R _ s y s c a l l s
la s0 , s y s _ n i _ s y s c a l l
/* Syscall number held in a7 */
bgeu a7 , t 0 , 1 f
la s0 , s y s _ c a l l _ t a b l e
slli t 0 , a7 , R I S C V _ L G P T R
add s0 , s0 , t 0
REG_ L s0 , 0 ( s0 )
1 :
jalr s0
ret_from_syscall :
/* Set user a0 to kernel a0 */
REG_ S a0 , P T _ A 0 ( s p )
/* Trace syscalls, but only if requested by the user. */
REG_ L t 0 , T A S K _ T I _ F L A G S ( t p )
andi t 0 , t 0 , _ T I F _ S Y S C A L L _ T R A C E
bnez t 0 , h a n d l e _ s y s c a l l _ t r a c e _ e x i t
ret_from_exception :
REG_ L s0 , P T _ S S T A T U S ( s p )
2018-01-04 18:35:03 +01:00
csrc s s t a t u s , S R _ S I E
andi s0 , s0 , S R _ S P P
2017-07-10 18:04:30 -07:00
bnez s0 , r e s t o r e _ a l l
resume_userspace :
/* Interrupts must be disabled here so flags are checked atomically */
REG_ L s0 , T A S K _ T I _ F L A G S ( t p ) / * c u r r e n t _ t h r e a d _ i n f o - > f l a g s * /
andi s1 , s0 , _ T I F _ W O R K _ M A S K
bnez s1 , w o r k _ p e n d i n g
/* Save unwound kernel stack pointer in thread_info */
addi s0 , s p , P T _ S I Z E _ O N _ S T A C K
REG_ S s0 , T A S K _ T I _ K E R N E L _ S P ( t p )
/ *
* Save T P i n t o s s c r a t c h , s o w e c a n f i n d t h e k e r n e l d a t a s t r u c t u r e s
* again.
* /
csrw s s c r a t c h , t p
restore_all :
RESTORE_ A L L
sret
work_pending :
/* Enter slow path for supplementary processing */
la r a , r e t _ f r o m _ e x c e p t i o n
andi s1 , s0 , _ T I F _ N E E D _ R E S C H E D
bnez s1 , w o r k _ r e s c h e d
work_notifysig :
/* Handle pending signals and notify-resume requests */
2018-01-04 18:35:03 +01:00
csrs s s t a t u s , S R _ S I E / * E n a b l e i n t e r r u p t s f o r d o _ n o t i f y _ r e s u m e ( ) * /
2017-07-10 18:04:30 -07:00
move a0 , s p / * p t _ r e g s * /
move a1 , s0 / * c u r r e n t _ t h r e a d _ i n f o - > f l a g s * /
tail d o _ n o t i f y _ r e s u m e
work_resched :
tail s c h e d u l e
/* Slow paths for ptrace. */
handle_syscall_trace_enter :
move a0 , s p
call d o _ s y s c a l l _ t r a c e _ e n t e r
REG_ L a0 , P T _ A 0 ( s p )
REG_ L a1 , P T _ A 1 ( s p )
REG_ L a2 , P T _ A 2 ( s p )
REG_ L a3 , P T _ A 3 ( s p )
REG_ L a4 , P T _ A 4 ( s p )
REG_ L a5 , P T _ A 5 ( s p )
REG_ L a6 , P T _ A 6 ( s p )
REG_ L a7 , P T _ A 7 ( s p )
j c h e c k _ s y s c a l l _ n r
handle_syscall_trace_exit :
move a0 , s p
call d o _ s y s c a l l _ t r a c e _ e x i t
j r e t _ f r o m _ e x c e p t i o n
END( h a n d l e _ e x c e p t i o n )
ENTRY( r e t _ f r o m _ f o r k )
la r a , r e t _ f r o m _ e x c e p t i o n
tail s c h e d u l e _ t a i l
ENDPROC( r e t _ f r o m _ f o r k )
ENTRY( r e t _ f r o m _ k e r n e l _ t h r e a d )
call s c h e d u l e _ t a i l
/* Call fn(arg) */
la r a , r e t _ f r o m _ e x c e p t i o n
move a0 , s1
jr s0
ENDPROC( r e t _ f r o m _ k e r n e l _ t h r e a d )
/ *
* Integer r e g i s t e r c o n t e x t s w i t c h
* The c a l l e e - s a v e d r e g i s t e r s m u s t b e s a v e d a n d r e s t o r e d .
*
* a0 : previous t a s k _ s t r u c t ( m u s t b e p r e s e r v e d a c r o s s t h e s w i t c h )
* a1 : next t a s k _ s t r u c t
*
* The v a l u e o f a0 a n d a1 m u s t b e p r e s e r v e d b y t h i s f u n c t i o n , a s t h a t ' s h o w
* arguments a r e p a s s e d t o s c h e d u l e _ t a i l .
* /
ENTRY( _ _ s w i t c h _ t o )
/* Save context into prev->thread */
li a4 , T A S K _ T H R E A D _ R A
add a3 , a0 , a4
add a4 , a1 , a4
REG_ S r a , T A S K _ T H R E A D _ R A _ R A ( a3 )
REG_ S s p , T A S K _ T H R E A D _ S P _ R A ( a3 )
REG_ S s0 , T A S K _ T H R E A D _ S 0 _ R A ( a3 )
REG_ S s1 , T A S K _ T H R E A D _ S 1 _ R A ( a3 )
REG_ S s2 , T A S K _ T H R E A D _ S 2 _ R A ( a3 )
REG_ S s3 , T A S K _ T H R E A D _ S 3 _ R A ( a3 )
REG_ S s4 , T A S K _ T H R E A D _ S 4 _ R A ( a3 )
REG_ S s5 , T A S K _ T H R E A D _ S 5 _ R A ( a3 )
REG_ S s6 , T A S K _ T H R E A D _ S 6 _ R A ( a3 )
REG_ S s7 , T A S K _ T H R E A D _ S 7 _ R A ( a3 )
REG_ S s8 , T A S K _ T H R E A D _ S 8 _ R A ( a3 )
REG_ S s9 , T A S K _ T H R E A D _ S 9 _ R A ( a3 )
REG_ S s10 , T A S K _ T H R E A D _ S 1 0 _ R A ( a3 )
REG_ S s11 , T A S K _ T H R E A D _ S 1 1 _ R A ( a3 )
/* Restore context from next->thread */
REG_ L r a , T A S K _ T H R E A D _ R A _ R A ( a4 )
REG_ L s p , T A S K _ T H R E A D _ S P _ R A ( a4 )
REG_ L s0 , T A S K _ T H R E A D _ S 0 _ R A ( a4 )
REG_ L s1 , T A S K _ T H R E A D _ S 1 _ R A ( a4 )
REG_ L s2 , T A S K _ T H R E A D _ S 2 _ R A ( a4 )
REG_ L s3 , T A S K _ T H R E A D _ S 3 _ R A ( a4 )
REG_ L s4 , T A S K _ T H R E A D _ S 4 _ R A ( a4 )
REG_ L s5 , T A S K _ T H R E A D _ S 5 _ R A ( a4 )
REG_ L s6 , T A S K _ T H R E A D _ S 6 _ R A ( a4 )
REG_ L s7 , T A S K _ T H R E A D _ S 7 _ R A ( a4 )
REG_ L s8 , T A S K _ T H R E A D _ S 8 _ R A ( a4 )
REG_ L s9 , T A S K _ T H R E A D _ S 9 _ R A ( a4 )
REG_ L s10 , T A S K _ T H R E A D _ S 1 0 _ R A ( a4 )
REG_ L s11 , T A S K _ T H R E A D _ S 1 1 _ R A ( a4 )
/* Swap the CPU entry around. */
lw a3 , T A S K _ T I _ C P U ( a0 )
lw a4 , T A S K _ T I _ C P U ( a1 )
sw a3 , T A S K _ T I _ C P U ( a1 )
sw a4 , T A S K _ T I _ C P U ( a0 )
# if T A S K _ T I ! = 0
# error " T A S K _ T I ! = 0 : t p w i l l c o n t a i n a ' s t r u c t t h r e a d _ i n f o ' , n o t a ' s t r u c t t a s k _ s t r u c t ' s o g e t _ c u r r e n t ( ) w o n ' t w o r k . "
addi t p , a1 , T A S K _ T I
# else
move t p , a1
# endif
ret
ENDPROC( _ _ s w i t c h _ t o )
ENTRY( _ _ f s t a t e _ s a v e )
li a2 , T A S K _ T H R E A D _ F 0
add a0 , a0 , a2
li t 1 , S R _ F S
csrs s s t a t u s , t 1
frcsr t 0
fsd f0 , T A S K _ T H R E A D _ F 0 _ F 0 ( a0 )
fsd f1 , T A S K _ T H R E A D _ F 1 _ F 0 ( a0 )
fsd f2 , T A S K _ T H R E A D _ F 2 _ F 0 ( a0 )
fsd f3 , T A S K _ T H R E A D _ F 3 _ F 0 ( a0 )
fsd f4 , T A S K _ T H R E A D _ F 4 _ F 0 ( a0 )
fsd f5 , T A S K _ T H R E A D _ F 5 _ F 0 ( a0 )
fsd f6 , T A S K _ T H R E A D _ F 6 _ F 0 ( a0 )
fsd f7 , T A S K _ T H R E A D _ F 7 _ F 0 ( a0 )
fsd f8 , T A S K _ T H R E A D _ F 8 _ F 0 ( a0 )
fsd f9 , T A S K _ T H R E A D _ F 9 _ F 0 ( a0 )
fsd f10 , T A S K _ T H R E A D _ F 1 0 _ F 0 ( a0 )
fsd f11 , T A S K _ T H R E A D _ F 1 1 _ F 0 ( a0 )
fsd f12 , T A S K _ T H R E A D _ F 1 2 _ F 0 ( a0 )
fsd f13 , T A S K _ T H R E A D _ F 1 3 _ F 0 ( a0 )
fsd f14 , T A S K _ T H R E A D _ F 1 4 _ F 0 ( a0 )
fsd f15 , T A S K _ T H R E A D _ F 1 5 _ F 0 ( a0 )
fsd f16 , T A S K _ T H R E A D _ F 1 6 _ F 0 ( a0 )
fsd f17 , T A S K _ T H R E A D _ F 1 7 _ F 0 ( a0 )
fsd f18 , T A S K _ T H R E A D _ F 1 8 _ F 0 ( a0 )
fsd f19 , T A S K _ T H R E A D _ F 1 9 _ F 0 ( a0 )
fsd f20 , T A S K _ T H R E A D _ F 2 0 _ F 0 ( a0 )
fsd f21 , T A S K _ T H R E A D _ F 2 1 _ F 0 ( a0 )
fsd f22 , T A S K _ T H R E A D _ F 2 2 _ F 0 ( a0 )
fsd f23 , T A S K _ T H R E A D _ F 2 3 _ F 0 ( a0 )
fsd f24 , T A S K _ T H R E A D _ F 2 4 _ F 0 ( a0 )
fsd f25 , T A S K _ T H R E A D _ F 2 5 _ F 0 ( a0 )
fsd f26 , T A S K _ T H R E A D _ F 2 6 _ F 0 ( a0 )
fsd f27 , T A S K _ T H R E A D _ F 2 7 _ F 0 ( a0 )
fsd f28 , T A S K _ T H R E A D _ F 2 8 _ F 0 ( a0 )
fsd f29 , T A S K _ T H R E A D _ F 2 9 _ F 0 ( a0 )
fsd f30 , T A S K _ T H R E A D _ F 3 0 _ F 0 ( a0 )
fsd f31 , T A S K _ T H R E A D _ F 3 1 _ F 0 ( a0 )
sw t 0 , T A S K _ T H R E A D _ F C S R _ F 0 ( a0 )
csrc s s t a t u s , t 1
ret
ENDPROC( _ _ f s t a t e _ s a v e )
ENTRY( _ _ f s t a t e _ r e s t o r e )
li a2 , T A S K _ T H R E A D _ F 0
add a0 , a0 , a2
li t 1 , S R _ F S
lw t 0 , T A S K _ T H R E A D _ F C S R _ F 0 ( a0 )
csrs s s t a t u s , t 1
fld f0 , T A S K _ T H R E A D _ F 0 _ F 0 ( a0 )
fld f1 , T A S K _ T H R E A D _ F 1 _ F 0 ( a0 )
fld f2 , T A S K _ T H R E A D _ F 2 _ F 0 ( a0 )
fld f3 , T A S K _ T H R E A D _ F 3 _ F 0 ( a0 )
fld f4 , T A S K _ T H R E A D _ F 4 _ F 0 ( a0 )
fld f5 , T A S K _ T H R E A D _ F 5 _ F 0 ( a0 )
fld f6 , T A S K _ T H R E A D _ F 6 _ F 0 ( a0 )
fld f7 , T A S K _ T H R E A D _ F 7 _ F 0 ( a0 )
fld f8 , T A S K _ T H R E A D _ F 8 _ F 0 ( a0 )
fld f9 , T A S K _ T H R E A D _ F 9 _ F 0 ( a0 )
fld f10 , T A S K _ T H R E A D _ F 1 0 _ F 0 ( a0 )
fld f11 , T A S K _ T H R E A D _ F 1 1 _ F 0 ( a0 )
fld f12 , T A S K _ T H R E A D _ F 1 2 _ F 0 ( a0 )
fld f13 , T A S K _ T H R E A D _ F 1 3 _ F 0 ( a0 )
fld f14 , T A S K _ T H R E A D _ F 1 4 _ F 0 ( a0 )
fld f15 , T A S K _ T H R E A D _ F 1 5 _ F 0 ( a0 )
fld f16 , T A S K _ T H R E A D _ F 1 6 _ F 0 ( a0 )
fld f17 , T A S K _ T H R E A D _ F 1 7 _ F 0 ( a0 )
fld f18 , T A S K _ T H R E A D _ F 1 8 _ F 0 ( a0 )
fld f19 , T A S K _ T H R E A D _ F 1 9 _ F 0 ( a0 )
fld f20 , T A S K _ T H R E A D _ F 2 0 _ F 0 ( a0 )
fld f21 , T A S K _ T H R E A D _ F 2 1 _ F 0 ( a0 )
fld f22 , T A S K _ T H R E A D _ F 2 2 _ F 0 ( a0 )
fld f23 , T A S K _ T H R E A D _ F 2 3 _ F 0 ( a0 )
fld f24 , T A S K _ T H R E A D _ F 2 4 _ F 0 ( a0 )
fld f25 , T A S K _ T H R E A D _ F 2 5 _ F 0 ( a0 )
fld f26 , T A S K _ T H R E A D _ F 2 6 _ F 0 ( a0 )
fld f27 , T A S K _ T H R E A D _ F 2 7 _ F 0 ( a0 )
fld f28 , T A S K _ T H R E A D _ F 2 8 _ F 0 ( a0 )
fld f29 , T A S K _ T H R E A D _ F 2 9 _ F 0 ( a0 )
fld f30 , T A S K _ T H R E A D _ F 3 0 _ F 0 ( a0 )
fld f31 , T A S K _ T H R E A D _ F 3 1 _ F 0 ( a0 )
fscsr t 0
csrc s s t a t u s , t 1
ret
ENDPROC( _ _ f s t a t e _ r e s t o r e )
.section " .rodata "
/* Exception vector table */
ENTRY( e x c p _ v e c t _ t a b l e )
RISCV_ P T R d o _ t r a p _ i n s n _ m i s a l i g n e d
RISCV_ P T R d o _ t r a p _ i n s n _ f a u l t
RISCV_ P T R d o _ t r a p _ i n s n _ i l l e g a l
RISCV_ P T R d o _ t r a p _ b r e a k
RISCV_ P T R d o _ t r a p _ l o a d _ m i s a l i g n e d
RISCV_ P T R d o _ t r a p _ l o a d _ f a u l t
RISCV_ P T R d o _ t r a p _ s t o r e _ m i s a l i g n e d
RISCV_ P T R d o _ t r a p _ s t o r e _ f a u l t
RISCV_ P T R d o _ t r a p _ e c a l l _ u / * s y s t e m c a l l , g e t s i n t e r c e p t e d * /
RISCV_ P T R d o _ t r a p _ e c a l l _ s
RISCV_ P T R d o _ t r a p _ u n k n o w n
RISCV_ P T R d o _ t r a p _ e c a l l _ m
RISCV_ P T R d o _ p a g e _ f a u l t / * i n s t r u c t i o n p a g e f a u l t * /
RISCV_ P T R d o _ p a g e _ f a u l t / * l o a d p a g e f a u l t * /
RISCV_ P T R d o _ t r a p _ u n k n o w n
RISCV_ P T R d o _ p a g e _ f a u l t / * s t o r e p a g e f a u l t * /
excp_vect_table_end :
END( e x c p _ v e c t _ t a b l e )