2022-05-31 13:04:11 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
/ *
* Copyright ( C ) 2 0 2 0 - 2 0 2 2 L o o n g s o n T e c h n o l o g y C o r p o r a t i o n L i m i t e d
*
* Derived f r o m M I P S :
* Copyright ( C ) 1 9 9 4 - 2 0 0 0 , 2 0 0 1 , 2 0 0 3 R a l f B a e c h l e
* Copyright ( C ) 1 9 9 9 , 2 0 0 0 S i l i c o n G r a p h i c s , I n c .
* Copyright ( C ) 2 0 0 1 M I P S T e c h n o l o g i e s , I n c .
* /
# include < a s m / a s m . h >
# include < a s m / a s m m a c r o . h >
# include < a s m / l o o n g a r c h . h >
# include < a s m / r e g d e f . h >
# include < a s m / s t a c k f r a m e . h >
# include < a s m / t h r e a d _ i n f o . h >
.text
.cfi_sections .debug_frame
.align 5
SYM_ F U N C _ S T A R T ( h a n d l e _ s y s c a l l )
csrrd t 0 , P E R C P U _ B A S E _ K S
la. a b s t 1 , k e r n e l s p
add. d t 1 , t 1 , t 0
move t 2 , s p
ld. d s p , t 1 , 0
addi. d s p , s p , - P T _ S I Z E
cfi_ s t t 2 , P T _ R 3
2022-07-26 18:57:22 +03:00
cfi_ r e l _ o f f s e t s p , P T _ R 3
2022-05-31 13:04:11 +03:00
st. d z e r o , s p , P T _ R 0
csrrd t 2 , L O O N G A R C H _ C S R _ P R M D
st. d t 2 , s p , P T _ P R M D
csrrd t 2 , L O O N G A R C H _ C S R _ C R M D
st. d t 2 , s p , P T _ C R M D
csrrd t 2 , L O O N G A R C H _ C S R _ E U E N
st. d t 2 , s p , P T _ E U E N
csrrd t 2 , L O O N G A R C H _ C S R _ E C F G
st. d t 2 , s p , P T _ E C F G
csrrd t 2 , L O O N G A R C H _ C S R _ E S T A T
st. d t 2 , s p , P T _ E S T A T
cfi_ s t r a , P T _ R 1
cfi_ s t a0 , P T _ R 4
cfi_ s t a1 , P T _ R 5
cfi_ s t a2 , P T _ R 6
cfi_ s t a3 , P T _ R 7
cfi_ s t a4 , P T _ R 8
cfi_ s t a5 , P T _ R 9
cfi_ s t a6 , P T _ R 1 0
cfi_ s t a7 , P T _ R 1 1
csrrd r a , L O O N G A R C H _ C S R _ E R A
st. d r a , s p , P T _ E R A
2022-07-26 18:57:22 +03:00
cfi_ r e l _ o f f s e t r a , P T _ E R A
2022-05-31 13:04:11 +03:00
cfi_ s t t p , P T _ R 2
cfi_ s t u 0 , P T _ R 2 1
cfi_ s t f p , P T _ R 2 2
SAVE_ S T A T I C
move u 0 , t 0
li. d t p , ~ _ T H R E A D _ M A S K
and t p , t p , s p
move a0 , s p
bl d o _ s y s c a l l
RESTORE_ A L L _ A N D _ R E T
SYM_ F U N C _ E N D ( h a n d l e _ s y s c a l l )
SYM_ C O D E _ S T A R T ( r e t _ f r o m _ f o r k )
bl s c h e d u l e _ t a i l # a 0 = s t r u c t t a s k _ s t r u c t * p r e v
move a0 , s p
bl s y s c a l l _ e x i t _ t o _ u s e r _ m o d e
RESTORE_ S T A T I C
RESTORE_ S O M E
RESTORE_ S P _ A N D _ R E T
SYM_ C O D E _ E N D ( r e t _ f r o m _ f o r k )
SYM_ C O D E _ S T A R T ( r e t _ f r o m _ k e r n e l _ t h r e a d )
bl s c h e d u l e _ t a i l # a 0 = s t r u c t t a s k _ s t r u c t * p r e v
move a0 , s1
jirl r a , s0 , 0
move a0 , s p
bl s y s c a l l _ e x i t _ t o _ u s e r _ m o d e
RESTORE_ S T A T I C
RESTORE_ S O M E
RESTORE_ S P _ A N D _ R E T
SYM_ C O D E _ E N D ( r e t _ f r o m _ k e r n e l _ t h r e a d )