2019-05-29 07:18:00 -07:00
/* SPDX-License-Identifier: GPL-2.0-only */
2017-07-10 18:00:26 -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
* /
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / a s m . h >
# 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 / t h r e a d _ i n f o . h >
# include < a s m / p a g e . h >
2021-04-13 02:35:14 -04:00
# include < a s m / p g t a b l e . h >
2017-07-10 18:00:26 -07:00
# include < a s m / c s r . h >
2019-10-28 13:10:40 +01:00
# include < a s m / h w c a p . h >
2019-06-06 16:08:00 -07:00
# include < a s m / i m a g e . h >
2023-09-27 22:48:02 +00:00
# include < a s m / s c s . h >
2022-04-19 20:02:16 -07:00
# include < a s m / x i p _ f i x u p . h >
2020-09-17 15:37:13 -07:00
# include " e f i - h e a d e r . S "
2017-07-10 18:00:26 -07:00
2020-03-17 18:11:39 -07:00
_ _ HEAD
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ S T A R T ( _ s t a r t )
2019-06-06 16:08:00 -07:00
/ *
* Image h e a d e r e x p e c t e d b y L i n u x b o o t - l o a d e r s . T h e i m a g e h e a d e r d a t a
* structure i s d e s c r i b e d i n a s m / i m a g e . h .
* Do n o t m o d i f y i t w i t h o u t m o d i f y i n g t h e s t r u c t u r e a n d a l l b o o t l o a d e r s
* that e x p e c t s t h i s h e a d e r f o r m a t ! !
* /
2020-09-17 15:37:13 -07:00
# ifdef C O N F I G _ E F I
/ *
* This i n s t r u c t i o n d e c o d e s t o " M Z " A S C I I r e q u i r e d b y U E F I .
* /
c. l i s4 ,- 1 3
j _ s t a r t _ k e r n e l
# else
2019-06-06 16:08:00 -07:00
/* jump to start kernel */
j _ s t a r t _ k e r n e l
/* reserved */
.word 0
2020-09-17 15:37:13 -07:00
# endif
2019-06-06 16:08:00 -07:00
.balign 8
2020-10-22 16:30:12 -04:00
# ifdef C O N F I G _ R I S C V _ M _ M O D E
/* Image load offset (0MB) from start of RAM for M-mode */
.dword 0
# else
2019-06-06 16:08:00 -07:00
# if _ _ r i s c v _ x l e n = = 6 4
/* Image load offset(2MB) from start of RAM */
.dword 0x200000
# else
/* Image load offset(4MB) from start of RAM */
.dword 0x400000
2020-10-22 16:30:12 -04:00
# endif
2019-06-06 16:08:00 -07:00
# endif
/* Effective size of kernel image */
.dword _end - _ start
.dword __HEAD_FLAGS
.word RISCV_HEADER_VERSION
.word 0
.dword 0
2019-09-13 18:35:50 -07:00
.ascii RISCV_IMAGE_MAGIC
2019-06-06 16:08:00 -07:00
.balign 4
2019-09-13 18:35:50 -07:00
.ascii RISCV_IMAGE_MAGIC2
2020-09-17 15:37:13 -07:00
# ifdef C O N F I G _ E F I
.word pe_head_start - _ start
pe_head_start :
_ _ EFI_ P E _ H E A D E R
# else
2019-06-06 16:08:00 -07:00
.word 0
2020-09-17 15:37:13 -07:00
# endif
2019-06-06 16:08:00 -07:00
2020-03-17 18:11:39 -07:00
.align 2
# ifdef C O N F I G _ M M U
2022-02-10 11:19:41 +05:30
.global relocate_enable_mmu
relocate_enable_mmu :
2020-03-17 18:11:39 -07:00
/* Relocate return address */
2021-06-17 15:53:07 +02:00
la a1 , k e r n e l _ m a p
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a1
2021-06-17 15:53:07 +02:00
REG_ L a1 , K E R N E L _ M A P _ V I R T _ A D D R ( a1 )
2020-03-17 18:11:39 -07:00
la a2 , _ s t a r t
sub a1 , a1 , a2
add r a , r a , a1
/* Point stvec to virtual address of intruction after satp write */
la a2 , 1 f
add a2 , a2 , a1
csrw C S R _ T V E C , a2
/* Compute satp for kernel page tables, but don't load it yet */
srl a2 , a0 , P A G E _ S H I F T
2021-12-06 11:46:51 +01:00
la a1 , s a t p _ m o d e
2023-12-12 14:01:12 +01:00
XIP_ F I X U P _ O F F S E T a1
2021-12-06 11:46:51 +01:00
REG_ L a1 , 0 ( a1 )
2020-03-17 18:11:39 -07:00
or a2 , a2 , a1
/ *
* Load t r a m p o l i n e p a g e d i r e c t o r y , w h i c h w i l l c a u s e u s t o t r a p t o
* stvec i f V A ! = P A , o r s i m p l y f a l l t h r o u g h i f V A = = P A . W e n e e d a
* full f e n c e h e r e b e c a u s e s e t u p _ v m ( ) j u s t w r o t e t h e s e P T E s a n d w e n e e d
* to e n s u r e t h e n e w t r a n s l a t i o n s a r e i n u s e .
* /
la a0 , t r a m p o l i n e _ p g _ d i r
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a0
2020-03-17 18:11:39 -07:00
srl a0 , a0 , P A G E _ S H I F T
or a0 , a0 , a1
sfence. v m a
csrw C S R _ S A T P , a0
.align 2
1 :
2020-08-13 11:38:04 +08:00
/* Set trap vector to spin forever to help debug */
la a0 , . L s e c o n d a r y _ p a r k
2020-03-17 18:11:39 -07:00
csrw C S R _ T V E C , a0
/* Reload the global pointer */
2023-09-27 22:48:01 +00:00
load_ g l o b a l _ p o i n t e r
2020-03-17 18:11:39 -07:00
/ *
* Switch t o k e r n e l p a g e t a b l e s . A f u l l f e n c e i s n e c e s s a r y i n o r d e r t o
* avoid u s i n g t h e t r a m p o l i n e t r a n s l a t i o n s , w h i c h a r e o n l y c o r r e c t f o r
2021-11-20 09:26:05 -05:00
* the f i r s t s u p e r p a g e . F e t c h i n g t h e f e n c e i s g u a r a n t e e d t o w o r k
2020-03-17 18:11:39 -07:00
* because t h a t f i r s t s u p e r p a g e i s t r a n s l a t e d t h e s a m e w a y .
* /
csrw C S R _ S A T P , a2
sfence. v m a
ret
# endif / * C O N F I G _ M M U * /
# ifdef C O N F I G _ S M P
2020-03-17 18:11:43 -07:00
.global secondary_start_sbi
secondary_start_sbi :
/* Mask all interrupts */
csrw C S R _ I E , z e r o
csrw C S R _ I P , z e r o
/* Load the global pointer */
2023-09-27 22:48:01 +00:00
load_ g l o b a l _ p o i n t e r
2020-03-17 18:11:43 -07:00
/ *
2023-06-05 11:07:03 +00:00
* Disable F P U & V E C T O R t o d e t e c t i l l e g a l u s a g e o f
* floating p o i n t o r v e c t o r i n k e r n e l s p a c e
2020-03-17 18:11:43 -07:00
* /
2023-06-05 11:07:03 +00:00
li t 0 , S R _ F S _ V S
2020-03-17 18:11:43 -07:00
csrc C S R _ S T A T U S , t 0
2020-03-17 18:11:39 -07:00
/* Set trap vector to spin forever to help debug */
la a3 , . L s e c o n d a r y _ p a r k
csrw C S R _ T V E C , a3
2022-01-20 01:09:13 -08:00
/* a0 contains the hartid & a1 contains boot data */
li a2 , S B I _ H A R T _ B O O T _ T A S K _ P T R _ O F F S E T
XIP_ F I X U P _ O F F S E T a2
add a2 , a2 , a1
REG_ L t p , ( a2 )
li a3 , S B I _ H A R T _ B O O T _ S T A C K _ P T R _ O F F S E T
XIP_ F I X U P _ O F F S E T a3
add a3 , a3 , a1
REG_ L s p , ( a3 )
2020-03-17 18:11:43 -07:00
2021-11-29 00:07:38 +08:00
.Lsecondary_start_common :
2020-03-17 18:11:39 -07:00
# ifdef C O N F I G _ M M U
/* Enable virtual memory and relocate to virtual address */
la a0 , s w a p p e r _ p g _ d i r
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a0
2022-02-10 11:19:41 +05:30
call r e l o c a t e _ e n a b l e _ m m u
2020-03-17 18:11:39 -07:00
# endif
2023-10-24 15:26:51 +02:00
call . L s e t u p _ t r a p _ v e c t o r
2023-11-21 13:19:29 -08:00
scs_ l o a d _ c u r r e n t
2020-03-17 18:11:39 -07:00
tail s m p _ c a l l i n
# endif / * C O N F I G _ S M P * /
2020-08-13 11:38:04 +08:00
.align 2
2023-10-24 15:26:51 +02:00
.Lsetup_trap_vector :
2020-08-13 11:38:04 +08:00
/* Set trap vector to exception handler */
la a0 , h a n d l e _ e x c e p t i o n
csrw C S R _ T V E C , a0
/ *
* Set s u p0 s c r a t c h r e g i s t e r t o 0 , i n d i c a t i n g t o e x c e p t i o n v e c t o r t h a t
* we a r e p r e s e n t l y e x e c u t i n g i n k e r n e l .
* /
csrw C S R _ S C R A T C H , z e r o
ret
2021-10-18 13:22:38 +08:00
.align 2
2020-03-17 18:11:39 -07:00
.Lsecondary_park :
/* We lack SMP support or have too many harts, so park this hart */
wfi
j . L s e c o n d a r y _ p a r k
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ E N D ( _ s t a r t )
2020-03-17 18:11:39 -07:00
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ S T A R T ( _ s t a r t _ k e r n e l )
2019-04-25 08:38:41 +00:00
/* Mask all interrupts */
2019-10-28 13:10:32 +01:00
csrw C S R _ I E , z e r o
csrw C S R _ I P , z e r o
2017-07-10 18:00:26 -07:00
2019-10-28 13:10:39 +01:00
# ifdef C O N F I G _ R I S C V _ M _ M O D E
2019-10-28 13:10:40 +01:00
/* flush the instruction cache */
fence. i
/* Reset all registers except ra, a0, a1 */
call r e s e t _ r e g s
2020-04-07 11:33:40 -07:00
/ *
* Setup a P M P t o p e r m i t a c c e s s t o a l l o f m e m o r y . S o m e m a c h i n e s m a y
* not i m p l e m e n t P M P s , s o w e s e t u p a q u i c k t r a p h a n d l e r t o j u s t s k i p
* touching t h e P M P s o n a n y t r a p .
* /
2023-10-24 15:26:51 +02:00
la a0 , . L p m p _ d o n e
2020-04-07 11:33:40 -07:00
csrw C S R _ T V E C , a0
2020-01-09 11:17:40 +08:00
li a0 , - 1
csrw C S R _ P M P A D D R 0 , a0
li a0 , ( P M P _ A _ N A P O T | P M P _ R | P M P _ W | P M P _ X )
csrw C S R _ P M P C F G 0 , a0
2020-04-07 11:33:40 -07:00
.align 2
2023-10-24 15:26:51 +02:00
.Lpmp_done :
2020-01-09 11:17:40 +08:00
2019-10-28 13:10:39 +01:00
/ *
* The h a r t i d i n a0 i s e x p e c t e d l a t e r o n , a n d w e h a v e n o f i r m w a r e
* to h a n d i t t o u s .
* /
csrr a0 , C S R _ M H A R T I D
2019-10-28 13:10:40 +01:00
# endif / * C O N F I G _ R I S C V _ M _ M O D E * /
2019-10-28 13:10:39 +01:00
2017-07-10 18:00:26 -07:00
/* Load the global pointer */
2023-09-27 22:48:01 +00:00
load_ g l o b a l _ p o i n t e r
2017-07-10 18:00:26 -07:00
/ *
2023-06-05 11:07:03 +00:00
* Disable F P U & V E C T O R t o d e t e c t i l l e g a l u s a g e o f
* floating p o i n t o r v e c t o r i n k e r n e l s p a c e
2017-07-10 18:00:26 -07:00
* /
2023-06-05 11:07:03 +00:00
li t 0 , S R _ F S _ V S
2019-10-28 13:10:32 +01:00
csrc C S R _ S T A T U S , t 0
2017-07-10 18:00:26 -07:00
2022-01-20 01:09:17 -08:00
# ifdef C O N F I G _ R I S C V _ B O O T _ S P I N W A I T
2019-09-06 11:56:09 +08:00
li t 0 , C O N F I G _ N R _ C P U S
2020-01-15 14:54:36 +08:00
blt a0 , t 0 , . L g o o d _ c o r e s
tail . L s e c o n d a r y _ p a r k
.Lgood_cores :
2019-09-06 11:56:09 +08:00
2022-01-20 01:09:16 -08:00
/* The lottery system is only required for spinwait booting method */
2021-04-13 02:35:14 -04:00
# ifndef C O N F I G _ X I P _ K E R N E L
2017-07-10 18:00:26 -07:00
/* Pick one hart to run the main boot sequence */
la a3 , h a r t _ l o t t e r y
li a2 , 1
amoadd. w a3 , a2 , ( a3 )
bnez a3 , . L s e c o n d a r y _ s t a r t
2021-04-13 02:35:14 -04:00
# else
/* hart_lottery in flash contains a magic number */
la a3 , h a r t _ l o t t e r y
mv a2 , a3
XIP_ F I X U P _ O F F S E T a2
2021-10-11 11:14:14 +02:00
XIP_ F I X U P _ F L A S H _ O F F S E T a3
2021-04-13 02:35:14 -04:00
lw t 1 , ( a3 )
amoswap. w t 0 , t 1 , ( a2 )
/* first time here if hart_lottery in RAM is not set */
beq t 0 , t 1 , . L s e c o n d a r y _ s t a r t
2022-01-20 01:09:16 -08:00
# endif / * C O N F I G _ X I P * /
2022-01-20 01:09:17 -08:00
# endif / * C O N F I G _ R I S C V _ B O O T _ S P I N W A I T * /
2022-01-20 01:09:16 -08:00
# ifdef C O N F I G _ X I P _ K E R N E L
2021-04-13 02:35:14 -04:00
la s p , _ e n d + T H R E A D _ S I Z E
XIP_ F I X U P _ O F F S E T s p
mv s0 , a0
2023-12-12 14:01:14 +01:00
mv s1 , a1
2021-04-13 02:35:14 -04:00
call _ _ c o p y _ d a t a
2023-12-12 14:01:14 +01:00
/* Restore a0 & a1 copy */
2021-04-13 02:35:14 -04:00
mv a0 , s0
2023-12-12 14:01:14 +01:00
mv a1 , s1
2021-04-13 02:35:14 -04:00
# endif
# ifndef C O N F I G _ X I P _ K E R N E L
2018-11-12 11:25:15 +05:30
/* Clear BSS for flat non-ELF images */
la a3 , _ _ b s s _ s t a r t
la a4 , _ _ b s s _ s t o p
2023-10-24 15:26:51 +02:00
ble a4 , a3 , . L c l e a r _ b s s _ d o n e
.Lclear_bss :
2018-11-12 11:25:15 +05:30
REG_ S z e r o , ( a3 )
add a3 , a3 , R I S C V _ S Z P T R
2023-10-24 15:26:51 +02:00
blt a3 , a4 , . L c l e a r _ b s s
.Lclear_bss_done :
2021-04-13 02:35:14 -04:00
# endif
2018-10-02 12:15:05 -07:00
la a2 , b o o t _ c p u _ h a r t i d
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a2
2018-10-02 12:15:05 -07:00
REG_ S a0 , ( a2 )
2017-07-10 18:00:26 -07:00
/* Initialize page tables and relocate to virtual addresses */
2021-12-06 11:46:56 +01:00
la t p , i n i t _ t a s k
2017-07-10 18:00:26 -07:00
la s p , i n i t _ t h r e a d _ u n i o n + T H R E A D _ S I Z E
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T s p
2023-06-05 11:07:14 +00:00
addi s p , s p , - P T _ S I Z E _ O N _ S T A C K
2023-09-27 22:48:02 +00:00
scs_ l o a d _ i n i t _ s t a c k
2021-01-16 01:49:48 +02:00
# ifdef C O N F I G _ B U I L T I N _ D T B
la a0 , _ _ d t b _ s t a r t
2021-10-11 11:14:14 +02:00
XIP_ F I X U P _ O F F S E T a0
2021-01-16 01:49:48 +02:00
# else
2023-07-25 07:38:35 +02:00
mv a0 , a1
2021-01-16 01:49:48 +02:00
# endif / * C O N F I G _ B U I L T I N _ D T B * /
2017-07-10 18:00:26 -07:00
call s e t u p _ v m
2019-10-28 13:10:41 +01:00
# ifdef C O N F I G _ M M U
2019-06-28 13:36:21 -07:00
la a0 , e a r l y _ p g _ d i r
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a0
2022-02-10 11:19:41 +05:30
call r e l o c a t e _ e n a b l e _ m m u
2019-10-28 13:10:41 +01:00
# endif / * C O N F I G _ M M U * /
2017-07-10 18:00:26 -07:00
2023-10-24 15:26:51 +02:00
call . L s e t u p _ t r a p _ v e c t o r
2017-07-10 18:00:26 -07:00
/* Restore C environment */
la t p , i n i t _ t a s k
2019-04-15 11:14:37 +02:00
la s p , i n i t _ t h r e a d _ u n i o n + T H R E A D _ S I Z E
2023-06-05 11:07:14 +00:00
addi s p , s p , - P T _ S I Z E _ O N _ S T A C K
2023-09-27 22:48:02 +00:00
scs_ l o a d _ c u r r e n t
2017-07-10 18:00:26 -07:00
2020-01-06 10:38:32 -08:00
# ifdef C O N F I G _ K A S A N
call k a s a n _ e a r l y _ i n i t
# endif
2017-07-10 18:00:26 -07:00
/* Start the kernel */
2020-03-16 09:47:38 +09:00
call s o c _ e a r l y _ i n i t
2017-07-10 18:00:26 -07:00
tail s t a r t _ k e r n e l
2023-01-07 01:12:13 +09:00
# ifdef C O N F I G _ R I S C V _ B O O T _ S P I N W A I T
2022-01-20 01:09:16 -08:00
.Lsecondary_start :
2017-07-10 18:00:26 -07:00
/* Set trap vector to spin forever to help debug */
la a3 , . L s e c o n d a r y _ p a r k
2019-10-28 13:10:32 +01:00
csrw C S R _ T V E C , a3
2017-07-10 18:00:26 -07:00
slli a3 , a0 , L G R E G
2022-01-20 01:09:15 -08:00
la a1 , _ _ c p u _ s p i n w a i t _ s t a c k _ p o i n t e r
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a1
2022-01-20 01:09:15 -08:00
la a2 , _ _ c p u _ s p i n w a i t _ t a s k _ p o i n t e r
2021-04-13 02:35:14 -04:00
XIP_ F I X U P _ O F F S E T a2
2017-07-10 18:00:26 -07:00
add a1 , a3 , a1
add a2 , a3 , a2
/ *
* This h a r t d i d n ' t w i n t h e l o t t e r y , s o w e w a i t f o r t h e w i n n i n g h a r t t o
* get f a r e n o u g h a l o n g t h e b o o t p r o c e s s t h a t i t s h o u l d c o n t i n u e .
* /
.Lwait_for_cpu_up :
/* FIXME: We should WFI to save some energy here. */
REG_ L s p , ( a1 )
REG_ L t p , ( a2 )
beqz s p , . L w a i t _ f o r _ c p u _ u p
beqz t p , . L w a i t _ f o r _ c p u _ u p
fence
2021-11-29 00:07:38 +08:00
tail . L s e c o n d a r y _ s t a r t _ c o m m o n
2022-01-20 01:09:17 -08:00
# endif / * C O N F I G _ R I S C V _ B O O T _ S P I N W A I T * /
2017-07-10 18:00:26 -07:00
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ E N D ( _ s t a r t _ k e r n e l )
2017-07-10 18:00:26 -07:00
2019-10-28 13:10:40 +01:00
# ifdef C O N F I G _ R I S C V _ M _ M O D E
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ S T A R T _ L O C A L ( r e s e t _ r e g s )
2019-10-28 13:10:40 +01:00
li s p , 0
li g p , 0
li t p , 0
li t 0 , 0
li t 1 , 0
li t 2 , 0
li s0 , 0
li s1 , 0
li a2 , 0
li a3 , 0
li a4 , 0
li a5 , 0
li a6 , 0
li a7 , 0
li s2 , 0
li s3 , 0
li s4 , 0
li s5 , 0
li s6 , 0
li s7 , 0
li s8 , 0
li s9 , 0
li s10 , 0
li s11 , 0
li t 3 , 0
li t 4 , 0
li t 5 , 0
li t 6 , 0
2019-12-19 14:44:59 +08:00
csrw C S R _ S C R A T C H , 0
2019-10-28 13:10:40 +01:00
# ifdef C O N F I G _ F P U
csrr t 0 , C S R _ M I S A
andi t 0 , t 0 , ( C O M P A T _ H W C A P _ I S A _ F | C O M P A T _ H W C A P _ I S A _ D )
2023-06-05 11:07:02 +00:00
beqz t 0 , . L r e s e t _ r e g s _ d o n e _ f p u
2019-10-28 13:10:40 +01:00
li t 1 , S R _ F S
csrs C S R _ S T A T U S , t 1
fmv. s . x f0 , z e r o
fmv. s . x f1 , z e r o
fmv. s . x f2 , z e r o
fmv. s . x f3 , z e r o
fmv. s . x f4 , z e r o
fmv. s . x f5 , z e r o
fmv. s . x f6 , z e r o
fmv. s . x f7 , z e r o
fmv. s . x f8 , z e r o
fmv. s . x f9 , z e r o
fmv. s . x f10 , z e r o
fmv. s . x f11 , z e r o
fmv. s . x f12 , z e r o
fmv. s . x f13 , z e r o
fmv. s . x f14 , z e r o
fmv. s . x f15 , z e r o
fmv. s . x f16 , z e r o
fmv. s . x f17 , z e r o
fmv. s . x f18 , z e r o
fmv. s . x f19 , z e r o
fmv. s . x f20 , z e r o
fmv. s . x f21 , z e r o
fmv. s . x f22 , z e r o
fmv. s . x f23 , z e r o
fmv. s . x f24 , z e r o
fmv. s . x f25 , z e r o
fmv. s . x f26 , z e r o
fmv. s . x f27 , z e r o
fmv. s . x f28 , z e r o
fmv. s . x f29 , z e r o
fmv. s . x f30 , z e r o
fmv. s . x f31 , z e r o
csrw f c s r , 0
/* note that the caller must clear SR_FS */
2023-06-05 11:07:02 +00:00
.Lreset_regs_done_fpu :
2019-10-28 13:10:40 +01:00
# endif / * C O N F I G _ F P U * /
2023-06-05 11:07:02 +00:00
# ifdef C O N F I G _ R I S C V _ I S A _ V
csrr t 0 , C S R _ M I S A
li t 1 , C O M P A T _ H W C A P _ I S A _ V
and t 0 , t 0 , t 1
beqz t 0 , . L r e s e t _ r e g s _ d o n e _ v e c t o r
/ *
* Clear v e c t o r r e g i s t e r s a n d r e s e t v c s r
* VLMAX h a s a d e f i n e d v a l u e , V L E N i s a c o n s t a n t ,
* and t h i s f o r m o f v s e t v l i i s d e f i n e d t o s e t v l t o V L M A X .
* /
li t 1 , S R _ V S
csrs C S R _ S T A T U S , t 1
csrs C S R _ V C S R , x0
vsetvli t 1 , x0 , e 8 , m 8 , t a , m a
vmv. v . i v0 , 0
vmv. v . i v8 , 0
vmv. v . i v16 , 0
vmv. v . i v24 , 0
/* note that the caller must clear SR_VS */
.Lreset_regs_done_vector :
# endif / * C O N F I G _ R I S C V _ I S A _ V * /
2019-10-28 13:10:40 +01:00
ret
2023-10-24 15:26:52 +02:00
SYM_ C O D E _ E N D ( r e s e t _ r e g s )
2019-10-28 13:10:40 +01:00
# endif / * C O N F I G _ R I S C V _ M _ M O D E * /