2021-09-27 17:10:05 +05:30
/* SPDX-License-Identifier: GPL-2.0 */
/ *
* Copyright ( C ) 2 0 1 9 W e s t e r n D i g i t a l C o r p o r a t i o n o r i t s a f f i l i a t e s .
*
* Authors :
* Anup P a t e l < a n u p . p a t e l @wdc.com>
* /
# 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 / a s m - o f f s e t s . h >
# include < a s m / c s r . h >
.text
.altmacro
.option norelax
ENTRY( _ _ k v m _ r i s c v _ s w i t c h _ t o )
/* Save Host GPRs (except A0 and T0-T6) */
REG_ S r a , ( K V M _ A R C H _ H O S T _ R A ) ( a0 )
REG_ S s p , ( K V M _ A R C H _ H O S T _ S P ) ( a0 )
REG_ S g p , ( K V M _ A R C H _ H O S T _ G P ) ( a0 )
REG_ S t p , ( K V M _ A R C H _ H O S T _ T P ) ( a0 )
REG_ S s0 , ( K V M _ A R C H _ H O S T _ S 0 ) ( a0 )
REG_ S s1 , ( K V M _ A R C H _ H O S T _ S 1 ) ( a0 )
REG_ S a1 , ( K V M _ A R C H _ H O S T _ A 1 ) ( a0 )
REG_ S a2 , ( K V M _ A R C H _ H O S T _ A 2 ) ( a0 )
REG_ S a3 , ( K V M _ A R C H _ H O S T _ A 3 ) ( a0 )
REG_ S a4 , ( K V M _ A R C H _ H O S T _ A 4 ) ( a0 )
REG_ S a5 , ( K V M _ A R C H _ H O S T _ A 5 ) ( a0 )
REG_ S a6 , ( K V M _ A R C H _ H O S T _ A 6 ) ( a0 )
REG_ S a7 , ( K V M _ A R C H _ H O S T _ A 7 ) ( a0 )
REG_ S s2 , ( K V M _ A R C H _ H O S T _ S 2 ) ( a0 )
REG_ S s3 , ( K V M _ A R C H _ H O S T _ S 3 ) ( a0 )
REG_ S s4 , ( K V M _ A R C H _ H O S T _ S 4 ) ( a0 )
REG_ S s5 , ( K V M _ A R C H _ H O S T _ S 5 ) ( a0 )
REG_ S s6 , ( K V M _ A R C H _ H O S T _ S 6 ) ( a0 )
REG_ S s7 , ( K V M _ A R C H _ H O S T _ S 7 ) ( a0 )
REG_ S s8 , ( K V M _ A R C H _ H O S T _ S 8 ) ( a0 )
REG_ S s9 , ( K V M _ A R C H _ H O S T _ S 9 ) ( a0 )
REG_ S s10 , ( K V M _ A R C H _ H O S T _ S 1 0 ) ( a0 )
REG_ S s11 , ( K V M _ A R C H _ H O S T _ S 1 1 ) ( a0 )
2022-02-23 09:13:31 +08:00
/* Load Guest CSR values */
2021-09-27 17:10:05 +05:30
REG_ L t 0 , ( K V M _ A R C H _ G U E S T _ S S T A T U S ) ( a0 )
2022-02-23 09:13:31 +08:00
REG_ L t 1 , ( K V M _ A R C H _ G U E S T _ H S T A T U S ) ( a0 )
REG_ L t 2 , ( K V M _ A R C H _ G U E S T _ S C O U N T E R E N ) ( a0 )
la t 4 , _ _ k v m _ s w i t c h _ r e t u r n
REG_ L t 5 , ( K V M _ A R C H _ G U E S T _ S E P C ) ( a0 )
/* Save Host and Restore Guest SSTATUS */
2021-09-27 17:10:05 +05:30
csrrw t 0 , C S R _ S S T A T U S , t 0
/* Save Host and Restore Guest HSTATUS */
csrrw t 1 , C S R _ H S T A T U S , t 1
/* Save Host and Restore Guest SCOUNTEREN */
csrrw t 2 , C S R _ S C O U N T E R E N , t 2
/* Save Host STVEC and change it to return path */
csrrw t 4 , C S R _ S T V E C , t 4
2022-02-23 09:13:31 +08:00
/* Save Host SSCRATCH and change it to struct kvm_vcpu_arch pointer */
csrrw t 3 , C S R _ S S C R A T C H , a0
2021-09-27 17:10:05 +05:30
/* Restore Guest SEPC */
2022-02-23 09:13:31 +08:00
csrw C S R _ S E P C , t 5
/* Store Host CSR values */
REG_ S t 0 , ( K V M _ A R C H _ H O S T _ S S T A T U S ) ( a0 )
REG_ S t 1 , ( K V M _ A R C H _ H O S T _ H S T A T U S ) ( a0 )
REG_ S t 2 , ( K V M _ A R C H _ H O S T _ S C O U N T E R E N ) ( a0 )
REG_ S t 3 , ( K V M _ A R C H _ H O S T _ S S C R A T C H ) ( a0 )
REG_ S t 4 , ( K V M _ A R C H _ H O S T _ S T V E C ) ( a0 )
2021-09-27 17:10:05 +05:30
/* Restore Guest GPRs (except A0) */
REG_ L r a , ( K V M _ A R C H _ G U E S T _ R A ) ( a0 )
REG_ L s p , ( K V M _ A R C H _ G U E S T _ S P ) ( a0 )
REG_ L g p , ( K V M _ A R C H _ G U E S T _ G P ) ( a0 )
REG_ L t p , ( K V M _ A R C H _ G U E S T _ T P ) ( a0 )
REG_ L t 0 , ( K V M _ A R C H _ G U E S T _ T 0 ) ( a0 )
REG_ L t 1 , ( K V M _ A R C H _ G U E S T _ T 1 ) ( a0 )
REG_ L t 2 , ( K V M _ A R C H _ G U E S T _ T 2 ) ( a0 )
REG_ L s0 , ( K V M _ A R C H _ G U E S T _ S 0 ) ( a0 )
REG_ L s1 , ( K V M _ A R C H _ G U E S T _ S 1 ) ( a0 )
REG_ L a1 , ( K V M _ A R C H _ G U E S T _ A 1 ) ( a0 )
REG_ L a2 , ( K V M _ A R C H _ G U E S T _ A 2 ) ( a0 )
REG_ L a3 , ( K V M _ A R C H _ G U E S T _ A 3 ) ( a0 )
REG_ L a4 , ( K V M _ A R C H _ G U E S T _ A 4 ) ( a0 )
REG_ L a5 , ( K V M _ A R C H _ G U E S T _ A 5 ) ( a0 )
REG_ L a6 , ( K V M _ A R C H _ G U E S T _ A 6 ) ( a0 )
REG_ L a7 , ( K V M _ A R C H _ G U E S T _ A 7 ) ( a0 )
REG_ L s2 , ( K V M _ A R C H _ G U E S T _ S 2 ) ( a0 )
REG_ L s3 , ( K V M _ A R C H _ G U E S T _ S 3 ) ( a0 )
REG_ L s4 , ( K V M _ A R C H _ G U E S T _ S 4 ) ( a0 )
REG_ L s5 , ( K V M _ A R C H _ G U E S T _ S 5 ) ( a0 )
REG_ L s6 , ( K V M _ A R C H _ G U E S T _ S 6 ) ( a0 )
REG_ L s7 , ( K V M _ A R C H _ G U E S T _ S 7 ) ( a0 )
REG_ L s8 , ( K V M _ A R C H _ G U E S T _ S 8 ) ( a0 )
REG_ L s9 , ( K V M _ A R C H _ G U E S T _ S 9 ) ( a0 )
REG_ L s10 , ( K V M _ A R C H _ G U E S T _ S 1 0 ) ( a0 )
REG_ L s11 , ( K V M _ A R C H _ G U E S T _ S 1 1 ) ( a0 )
REG_ L t 3 , ( K V M _ A R C H _ G U E S T _ T 3 ) ( a0 )
REG_ L t 4 , ( K V M _ A R C H _ G U E S T _ T 4 ) ( a0 )
REG_ L t 5 , ( K V M _ A R C H _ G U E S T _ T 5 ) ( a0 )
REG_ L t 6 , ( K V M _ A R C H _ G U E S T _ T 6 ) ( a0 )
/* Restore Guest A0 */
REG_ L a0 , ( K V M _ A R C H _ G U E S T _ A 0 ) ( a0 )
/* Resume Guest */
sret
/* Back to Host */
.align 2
__kvm_switch_return :
/* Swap Guest A0 with SSCRATCH */
csrrw a0 , C S R _ S S C R A T C H , a0
/* Save Guest GPRs (except A0) */
REG_ S r a , ( K V M _ A R C H _ G U E S T _ R A ) ( a0 )
REG_ S s p , ( K V M _ A R C H _ G U E S T _ S P ) ( a0 )
REG_ S g p , ( K V M _ A R C H _ G U E S T _ G P ) ( a0 )
REG_ S t p , ( K V M _ A R C H _ G U E S T _ T P ) ( a0 )
REG_ S t 0 , ( K V M _ A R C H _ G U E S T _ T 0 ) ( a0 )
REG_ S t 1 , ( K V M _ A R C H _ G U E S T _ T 1 ) ( a0 )
REG_ S t 2 , ( K V M _ A R C H _ G U E S T _ T 2 ) ( a0 )
REG_ S s0 , ( K V M _ A R C H _ G U E S T _ S 0 ) ( a0 )
REG_ S s1 , ( K V M _ A R C H _ G U E S T _ S 1 ) ( a0 )
REG_ S a1 , ( K V M _ A R C H _ G U E S T _ A 1 ) ( a0 )
REG_ S a2 , ( K V M _ A R C H _ G U E S T _ A 2 ) ( a0 )
REG_ S a3 , ( K V M _ A R C H _ G U E S T _ A 3 ) ( a0 )
REG_ S a4 , ( K V M _ A R C H _ G U E S T _ A 4 ) ( a0 )
REG_ S a5 , ( K V M _ A R C H _ G U E S T _ A 5 ) ( a0 )
REG_ S a6 , ( K V M _ A R C H _ G U E S T _ A 6 ) ( a0 )
REG_ S a7 , ( K V M _ A R C H _ G U E S T _ A 7 ) ( a0 )
REG_ S s2 , ( K V M _ A R C H _ G U E S T _ S 2 ) ( a0 )
REG_ S s3 , ( K V M _ A R C H _ G U E S T _ S 3 ) ( a0 )
REG_ S s4 , ( K V M _ A R C H _ G U E S T _ S 4 ) ( a0 )
REG_ S s5 , ( K V M _ A R C H _ G U E S T _ S 5 ) ( a0 )
REG_ S s6 , ( K V M _ A R C H _ G U E S T _ S 6 ) ( a0 )
REG_ S s7 , ( K V M _ A R C H _ G U E S T _ S 7 ) ( a0 )
REG_ S s8 , ( K V M _ A R C H _ G U E S T _ S 8 ) ( a0 )
REG_ S s9 , ( K V M _ A R C H _ G U E S T _ S 9 ) ( a0 )
REG_ S s10 , ( K V M _ A R C H _ G U E S T _ S 1 0 ) ( a0 )
REG_ S s11 , ( K V M _ A R C H _ G U E S T _ S 1 1 ) ( a0 )
REG_ S t 3 , ( K V M _ A R C H _ G U E S T _ T 3 ) ( a0 )
REG_ S t 4 , ( K V M _ A R C H _ G U E S T _ T 4 ) ( a0 )
REG_ S t 5 , ( K V M _ A R C H _ G U E S T _ T 5 ) ( a0 )
REG_ S t 6 , ( K V M _ A R C H _ G U E S T _ T 6 ) ( a0 )
2022-02-23 09:13:31 +08:00
/* Load Host CSR values */
REG_ L t 1 , ( K V M _ A R C H _ H O S T _ S T V E C ) ( a0 )
REG_ L t 2 , ( K V M _ A R C H _ H O S T _ S S C R A T C H ) ( a0 )
REG_ L t 3 , ( K V M _ A R C H _ H O S T _ S C O U N T E R E N ) ( a0 )
REG_ L t 4 , ( K V M _ A R C H _ H O S T _ H S T A T U S ) ( a0 )
REG_ L t 5 , ( K V M _ A R C H _ H O S T _ S S T A T U S ) ( a0 )
2021-09-27 17:10:05 +05:30
/* Save Guest SEPC */
csrr t 0 , C S R _ S E P C
/* Save Guest A0 and Restore Host SSCRATCH */
csrrw t 2 , C S R _ S S C R A T C H , t 2
2022-02-23 09:13:31 +08:00
/* Restore Host STVEC */
csrw C S R _ S T V E C , t 1
2021-09-27 17:10:05 +05:30
/* Save Guest and Restore Host SCOUNTEREN */
csrrw t 3 , C S R _ S C O U N T E R E N , t 3
/* Save Guest and Restore Host HSTATUS */
csrrw t 4 , C S R _ H S T A T U S , t 4
/* Save Guest and Restore Host SSTATUS */
csrrw t 5 , C S R _ S S T A T U S , t 5
2022-02-23 09:13:31 +08:00
/* Store Guest CSR values */
REG_ S t 0 , ( K V M _ A R C H _ G U E S T _ S E P C ) ( a0 )
REG_ S t 2 , ( K V M _ A R C H _ G U E S T _ A 0 ) ( a0 )
REG_ S t 3 , ( K V M _ A R C H _ G U E S T _ S C O U N T E R E N ) ( a0 )
REG_ S t 4 , ( K V M _ A R C H _ G U E S T _ H S T A T U S ) ( a0 )
2021-09-27 17:10:05 +05:30
REG_ S t 5 , ( K V M _ A R C H _ G U E S T _ S S T A T U S ) ( a0 )
/* Restore Host GPRs (except A0 and T0-T6) */
REG_ L r a , ( K V M _ A R C H _ H O S T _ R A ) ( a0 )
REG_ L s p , ( K V M _ A R C H _ H O S T _ S P ) ( a0 )
REG_ L g p , ( K V M _ A R C H _ H O S T _ G P ) ( a0 )
REG_ L t p , ( K V M _ A R C H _ H O S T _ T P ) ( a0 )
REG_ L s0 , ( K V M _ A R C H _ H O S T _ S 0 ) ( a0 )
REG_ L s1 , ( K V M _ A R C H _ H O S T _ S 1 ) ( a0 )
REG_ L a1 , ( K V M _ A R C H _ H O S T _ A 1 ) ( a0 )
REG_ L a2 , ( K V M _ A R C H _ H O S T _ A 2 ) ( a0 )
REG_ L a3 , ( K V M _ A R C H _ H O S T _ A 3 ) ( a0 )
REG_ L a4 , ( K V M _ A R C H _ H O S T _ A 4 ) ( a0 )
REG_ L a5 , ( K V M _ A R C H _ H O S T _ A 5 ) ( a0 )
REG_ L a6 , ( K V M _ A R C H _ H O S T _ A 6 ) ( a0 )
REG_ L a7 , ( K V M _ A R C H _ H O S T _ A 7 ) ( a0 )
REG_ L s2 , ( K V M _ A R C H _ H O S T _ S 2 ) ( a0 )
REG_ L s3 , ( K V M _ A R C H _ H O S T _ S 3 ) ( a0 )
REG_ L s4 , ( K V M _ A R C H _ H O S T _ S 4 ) ( a0 )
REG_ L s5 , ( K V M _ A R C H _ H O S T _ S 5 ) ( a0 )
REG_ L s6 , ( K V M _ A R C H _ H O S T _ S 6 ) ( a0 )
REG_ L s7 , ( K V M _ A R C H _ H O S T _ S 7 ) ( a0 )
REG_ L s8 , ( K V M _ A R C H _ H O S T _ S 8 ) ( a0 )
REG_ L s9 , ( K V M _ A R C H _ H O S T _ S 9 ) ( a0 )
REG_ L s10 , ( K V M _ A R C H _ H O S T _ S 1 0 ) ( a0 )
REG_ L s11 , ( K V M _ A R C H _ H O S T _ S 1 1 ) ( a0 )
/* Return to C code */
ret
ENDPROC( _ _ k v m _ r i s c v _ s w i t c h _ t o )
2021-09-27 17:10:06 +05:30
ENTRY( _ _ k v m _ r i s c v _ u n p r i v _ t r a p )
/ *
* We a s s u m e t h a t f a u l t i n g u n p r i v l o a d / s t o r e i n s t r u c t i o n i s
* 4 - byte l o n g a n d b l i n d l y i n c r e m e n t S E P C b y 4 .
*
* The t r a p d e t a i l s w i l l b e s a v e d a t a d d r e s s p o i n t e d b y ' A 0 '
* register a n d w e u s e ' A 1 ' r e g i s t e r a s t e m p o r a r y .
* /
csrr a1 , C S R _ S E P C
REG_ S a1 , ( K V M _ A R C H _ T R A P _ S E P C ) ( a0 )
addi a1 , a1 , 4
csrw C S R _ S E P C , a1
csrr a1 , C S R _ S C A U S E
REG_ S a1 , ( K V M _ A R C H _ T R A P _ S C A U S E ) ( a0 )
csrr a1 , C S R _ S T V A L
REG_ S a1 , ( K V M _ A R C H _ T R A P _ S T V A L ) ( a0 )
csrr a1 , C S R _ H T V A L
REG_ S a1 , ( K V M _ A R C H _ T R A P _ H T V A L ) ( a0 )
csrr a1 , C S R _ H T I N S T
REG_ S a1 , ( K V M _ A R C H _ T R A P _ H T I N S T ) ( a0 )
sret
ENDPROC( _ _ k v m _ r i s c v _ u n p r i v _ t r a p )
2021-09-27 17:10:12 +05:30
# ifdef C O N F I G _ F P U
.align 3
.global __kvm_riscv_fp_f_save
__kvm_riscv_fp_f_save :
csrr t 2 , C S R _ S S T A T U S
li t 1 , S R _ F S
csrs C S R _ S S T A T U S , t 1
frcsr t 0
fsw f0 , K V M _ A R C H _ F P _ F _ F 0 ( a0 )
fsw f1 , K V M _ A R C H _ F P _ F _ F 1 ( a0 )
fsw f2 , K V M _ A R C H _ F P _ F _ F 2 ( a0 )
fsw f3 , K V M _ A R C H _ F P _ F _ F 3 ( a0 )
fsw f4 , K V M _ A R C H _ F P _ F _ F 4 ( a0 )
fsw f5 , K V M _ A R C H _ F P _ F _ F 5 ( a0 )
fsw f6 , K V M _ A R C H _ F P _ F _ F 6 ( a0 )
fsw f7 , K V M _ A R C H _ F P _ F _ F 7 ( a0 )
fsw f8 , K V M _ A R C H _ F P _ F _ F 8 ( a0 )
fsw f9 , K V M _ A R C H _ F P _ F _ F 9 ( a0 )
fsw f10 , K V M _ A R C H _ F P _ F _ F 1 0 ( a0 )
fsw f11 , K V M _ A R C H _ F P _ F _ F 1 1 ( a0 )
fsw f12 , K V M _ A R C H _ F P _ F _ F 1 2 ( a0 )
fsw f13 , K V M _ A R C H _ F P _ F _ F 1 3 ( a0 )
fsw f14 , K V M _ A R C H _ F P _ F _ F 1 4 ( a0 )
fsw f15 , K V M _ A R C H _ F P _ F _ F 1 5 ( a0 )
fsw f16 , K V M _ A R C H _ F P _ F _ F 1 6 ( a0 )
fsw f17 , K V M _ A R C H _ F P _ F _ F 1 7 ( a0 )
fsw f18 , K V M _ A R C H _ F P _ F _ F 1 8 ( a0 )
fsw f19 , K V M _ A R C H _ F P _ F _ F 1 9 ( a0 )
fsw f20 , K V M _ A R C H _ F P _ F _ F 2 0 ( a0 )
fsw f21 , K V M _ A R C H _ F P _ F _ F 2 1 ( a0 )
fsw f22 , K V M _ A R C H _ F P _ F _ F 2 2 ( a0 )
fsw f23 , K V M _ A R C H _ F P _ F _ F 2 3 ( a0 )
fsw f24 , K V M _ A R C H _ F P _ F _ F 2 4 ( a0 )
fsw f25 , K V M _ A R C H _ F P _ F _ F 2 5 ( a0 )
fsw f26 , K V M _ A R C H _ F P _ F _ F 2 6 ( a0 )
fsw f27 , K V M _ A R C H _ F P _ F _ F 2 7 ( a0 )
fsw f28 , K V M _ A R C H _ F P _ F _ F 2 8 ( a0 )
fsw f29 , K V M _ A R C H _ F P _ F _ F 2 9 ( a0 )
fsw f30 , K V M _ A R C H _ F P _ F _ F 3 0 ( a0 )
fsw f31 , K V M _ A R C H _ F P _ F _ F 3 1 ( a0 )
sw t 0 , K V M _ A R C H _ F P _ F _ F C S R ( a0 )
csrw C S R _ S S T A T U S , t 2
ret
.align 3
.global __kvm_riscv_fp_d_save
__kvm_riscv_fp_d_save :
csrr t 2 , C S R _ S S T A T U S
li t 1 , S R _ F S
csrs C S R _ S S T A T U S , t 1
frcsr t 0
fsd f0 , K V M _ A R C H _ F P _ D _ F 0 ( a0 )
fsd f1 , K V M _ A R C H _ F P _ D _ F 1 ( a0 )
fsd f2 , K V M _ A R C H _ F P _ D _ F 2 ( a0 )
fsd f3 , K V M _ A R C H _ F P _ D _ F 3 ( a0 )
fsd f4 , K V M _ A R C H _ F P _ D _ F 4 ( a0 )
fsd f5 , K V M _ A R C H _ F P _ D _ F 5 ( a0 )
fsd f6 , K V M _ A R C H _ F P _ D _ F 6 ( a0 )
fsd f7 , K V M _ A R C H _ F P _ D _ F 7 ( a0 )
fsd f8 , K V M _ A R C H _ F P _ D _ F 8 ( a0 )
fsd f9 , K V M _ A R C H _ F P _ D _ F 9 ( a0 )
fsd f10 , K V M _ A R C H _ F P _ D _ F 1 0 ( a0 )
fsd f11 , K V M _ A R C H _ F P _ D _ F 1 1 ( a0 )
fsd f12 , K V M _ A R C H _ F P _ D _ F 1 2 ( a0 )
fsd f13 , K V M _ A R C H _ F P _ D _ F 1 3 ( a0 )
fsd f14 , K V M _ A R C H _ F P _ D _ F 1 4 ( a0 )
fsd f15 , K V M _ A R C H _ F P _ D _ F 1 5 ( a0 )
fsd f16 , K V M _ A R C H _ F P _ D _ F 1 6 ( a0 )
fsd f17 , K V M _ A R C H _ F P _ D _ F 1 7 ( a0 )
fsd f18 , K V M _ A R C H _ F P _ D _ F 1 8 ( a0 )
fsd f19 , K V M _ A R C H _ F P _ D _ F 1 9 ( a0 )
fsd f20 , K V M _ A R C H _ F P _ D _ F 2 0 ( a0 )
fsd f21 , K V M _ A R C H _ F P _ D _ F 2 1 ( a0 )
fsd f22 , K V M _ A R C H _ F P _ D _ F 2 2 ( a0 )
fsd f23 , K V M _ A R C H _ F P _ D _ F 2 3 ( a0 )
fsd f24 , K V M _ A R C H _ F P _ D _ F 2 4 ( a0 )
fsd f25 , K V M _ A R C H _ F P _ D _ F 2 5 ( a0 )
fsd f26 , K V M _ A R C H _ F P _ D _ F 2 6 ( a0 )
fsd f27 , K V M _ A R C H _ F P _ D _ F 2 7 ( a0 )
fsd f28 , K V M _ A R C H _ F P _ D _ F 2 8 ( a0 )
fsd f29 , K V M _ A R C H _ F P _ D _ F 2 9 ( a0 )
fsd f30 , K V M _ A R C H _ F P _ D _ F 3 0 ( a0 )
fsd f31 , K V M _ A R C H _ F P _ D _ F 3 1 ( a0 )
sw t 0 , K V M _ A R C H _ F P _ D _ F C S R ( a0 )
csrw C S R _ S S T A T U S , t 2
ret
.align 3
.global __kvm_riscv_fp_f_restore
__kvm_riscv_fp_f_restore :
csrr t 2 , C S R _ S S T A T U S
li t 1 , S R _ F S
lw t 0 , K V M _ A R C H _ F P _ F _ F C S R ( a0 )
csrs C S R _ S S T A T U S , t 1
flw f0 , K V M _ A R C H _ F P _ F _ F 0 ( a0 )
flw f1 , K V M _ A R C H _ F P _ F _ F 1 ( a0 )
flw f2 , K V M _ A R C H _ F P _ F _ F 2 ( a0 )
flw f3 , K V M _ A R C H _ F P _ F _ F 3 ( a0 )
flw f4 , K V M _ A R C H _ F P _ F _ F 4 ( a0 )
flw f5 , K V M _ A R C H _ F P _ F _ F 5 ( a0 )
flw f6 , K V M _ A R C H _ F P _ F _ F 6 ( a0 )
flw f7 , K V M _ A R C H _ F P _ F _ F 7 ( a0 )
flw f8 , K V M _ A R C H _ F P _ F _ F 8 ( a0 )
flw f9 , K V M _ A R C H _ F P _ F _ F 9 ( a0 )
flw f10 , K V M _ A R C H _ F P _ F _ F 1 0 ( a0 )
flw f11 , K V M _ A R C H _ F P _ F _ F 1 1 ( a0 )
flw f12 , K V M _ A R C H _ F P _ F _ F 1 2 ( a0 )
flw f13 , K V M _ A R C H _ F P _ F _ F 1 3 ( a0 )
flw f14 , K V M _ A R C H _ F P _ F _ F 1 4 ( a0 )
flw f15 , K V M _ A R C H _ F P _ F _ F 1 5 ( a0 )
flw f16 , K V M _ A R C H _ F P _ F _ F 1 6 ( a0 )
flw f17 , K V M _ A R C H _ F P _ F _ F 1 7 ( a0 )
flw f18 , K V M _ A R C H _ F P _ F _ F 1 8 ( a0 )
flw f19 , K V M _ A R C H _ F P _ F _ F 1 9 ( a0 )
flw f20 , K V M _ A R C H _ F P _ F _ F 2 0 ( a0 )
flw f21 , K V M _ A R C H _ F P _ F _ F 2 1 ( a0 )
flw f22 , K V M _ A R C H _ F P _ F _ F 2 2 ( a0 )
flw f23 , K V M _ A R C H _ F P _ F _ F 2 3 ( a0 )
flw f24 , K V M _ A R C H _ F P _ F _ F 2 4 ( a0 )
flw f25 , K V M _ A R C H _ F P _ F _ F 2 5 ( a0 )
flw f26 , K V M _ A R C H _ F P _ F _ F 2 6 ( a0 )
flw f27 , K V M _ A R C H _ F P _ F _ F 2 7 ( a0 )
flw f28 , K V M _ A R C H _ F P _ F _ F 2 8 ( a0 )
flw f29 , K V M _ A R C H _ F P _ F _ F 2 9 ( a0 )
flw f30 , K V M _ A R C H _ F P _ F _ F 3 0 ( a0 )
flw f31 , K V M _ A R C H _ F P _ F _ F 3 1 ( a0 )
fscsr t 0
csrw C S R _ S S T A T U S , t 2
ret
.align 3
.global __kvm_riscv_fp_d_restore
__kvm_riscv_fp_d_restore :
csrr t 2 , C S R _ S S T A T U S
li t 1 , S R _ F S
lw t 0 , K V M _ A R C H _ F P _ D _ F C S R ( a0 )
csrs C S R _ S S T A T U S , t 1
fld f0 , K V M _ A R C H _ F P _ D _ F 0 ( a0 )
fld f1 , K V M _ A R C H _ F P _ D _ F 1 ( a0 )
fld f2 , K V M _ A R C H _ F P _ D _ F 2 ( a0 )
fld f3 , K V M _ A R C H _ F P _ D _ F 3 ( a0 )
fld f4 , K V M _ A R C H _ F P _ D _ F 4 ( a0 )
fld f5 , K V M _ A R C H _ F P _ D _ F 5 ( a0 )
fld f6 , K V M _ A R C H _ F P _ D _ F 6 ( a0 )
fld f7 , K V M _ A R C H _ F P _ D _ F 7 ( a0 )
fld f8 , K V M _ A R C H _ F P _ D _ F 8 ( a0 )
fld f9 , K V M _ A R C H _ F P _ D _ F 9 ( a0 )
fld f10 , K V M _ A R C H _ F P _ D _ F 1 0 ( a0 )
fld f11 , K V M _ A R C H _ F P _ D _ F 1 1 ( a0 )
fld f12 , K V M _ A R C H _ F P _ D _ F 1 2 ( a0 )
fld f13 , K V M _ A R C H _ F P _ D _ F 1 3 ( a0 )
fld f14 , K V M _ A R C H _ F P _ D _ F 1 4 ( a0 )
fld f15 , K V M _ A R C H _ F P _ D _ F 1 5 ( a0 )
fld f16 , K V M _ A R C H _ F P _ D _ F 1 6 ( a0 )
fld f17 , K V M _ A R C H _ F P _ D _ F 1 7 ( a0 )
fld f18 , K V M _ A R C H _ F P _ D _ F 1 8 ( a0 )
fld f19 , K V M _ A R C H _ F P _ D _ F 1 9 ( a0 )
fld f20 , K V M _ A R C H _ F P _ D _ F 2 0 ( a0 )
fld f21 , K V M _ A R C H _ F P _ D _ F 2 1 ( a0 )
fld f22 , K V M _ A R C H _ F P _ D _ F 2 2 ( a0 )
fld f23 , K V M _ A R C H _ F P _ D _ F 2 3 ( a0 )
fld f24 , K V M _ A R C H _ F P _ D _ F 2 4 ( a0 )
fld f25 , K V M _ A R C H _ F P _ D _ F 2 5 ( a0 )
fld f26 , K V M _ A R C H _ F P _ D _ F 2 6 ( a0 )
fld f27 , K V M _ A R C H _ F P _ D _ F 2 7 ( a0 )
fld f28 , K V M _ A R C H _ F P _ D _ F 2 8 ( a0 )
fld f29 , K V M _ A R C H _ F P _ D _ F 2 9 ( a0 )
fld f30 , K V M _ A R C H _ F P _ D _ F 3 0 ( a0 )
fld f31 , K V M _ A R C H _ F P _ D _ F 3 1 ( a0 )
fscsr t 0
csrw C S R _ S S T A T U S , t 2
ret
# endif