@@ -64,7 +64,8 @@ _abs_start:
64
64
csrw sip, 0" ,
65
65
#[ cfg( not( feature = "s-mode" ) ) ]
66
66
"csrw mie, 0
67
- csrw mip, 0" ,
67
+ csrw mip, 0
68
+ csrr a0, mhartid" , // Make sure that the hart ID is in a0 in M-mode
68
69
// Set pre-init trap vector
69
70
"la t0, _pre_init_trap" ,
70
71
#[ cfg( feature = "s-mode" ) ]
@@ -89,11 +90,8 @@ cfg_global_asm!(
89
90
) ;
90
91
#[ cfg( not( feature = "single-hart" ) ) ]
91
92
cfg_global_asm ! (
92
- #[ cfg( feature = "s-mode" ) ]
93
- "mv t2, a0 // the hartid is passed as parameter by SMODE" ,
94
- #[ cfg( not( feature = "s-mode" ) ) ]
95
- "csrr t2, mhartid" ,
96
- "lui t0, %hi(_max_hart_id)
93
+ "mv t2, a0
94
+ lui t0, %hi(_max_hart_id)
97
95
add t0, t0, %lo(_max_hart_id)
98
96
bgtu t2, t0, abort
99
97
lui t0, %hi(_hart_stack_size)
@@ -131,18 +129,12 @@ cfg_global_asm!(
131
129
sd a2, 8 * 2(sp)" ,
132
130
) ;
133
131
134
- // SKIP RAM INITIALIZATION IF CURRENT HART IS NOT THE BOOT HART
135
- #[ cfg( not( feature = "single-hart" ) ) ]
132
+ // CALL __pre_init (IF ENABLED) AND INITIALIZE RAM
136
133
cfg_global_asm ! (
137
- #[ cfg( not( feature = "s-mode " ) ) ]
138
- "csrr a0, mhartid" ,
134
+ #[ cfg( not( feature = "single-hart " ) ) ]
135
+ // Skip RAM initialization if current hart is not the boot hart
139
136
"call _mp_hook
140
- mv t0, a0
141
-
142
137
beqz a0, 4f" ,
143
- ) ;
144
- // IF CURRENT HART IS THE BOOT HART CALL __pre_init (IF ENABLED) AND INITIALIZE RAM
145
- cfg_global_asm ! (
146
138
#[ cfg( feature = "pre-init" ) ]
147
139
"call __pre_init" ,
148
140
"// Copy .data from flash to RAM
0 commit comments