File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9
9
10
10
### Changed
11
11
12
- - Main function no longer needs to be close to _ start. A linker script may copy
13
- all code to RAM and keep .init in flash/ROM.
12
+ - ` main ` function no longer needs to be close to ` _start ` . A linker script may copy
13
+ all code to RAM and keep ` .init ` in flash/ROM.
14
14
- By default, the stack is now split into equal parts based on the number of
15
15
harts.
16
16
- In M-mode, the hart ID is moved to ` a0 ` at the beginning of the runtime.
17
+ - ` abort ` function no longer needs to be close to ` _start ` .
18
+ - In multi-hart targets, the hart ID is now validated earlier in the boot process.
17
19
18
20
### Fixed
19
21
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ _abs_start:
72
72
"csrw stvec, t0" ,
73
73
#[ cfg( not( feature = "s-mode" ) ) ]
74
74
"csrw mtvec, t0" ,
75
+ // If multi-hart, assert that hart ID is valid
76
+ #[ cfg( not( feature = "single-hart" ) ) ]
77
+ "lui t0, %hi(_max_hart_id)
78
+ add t0, t0, %lo(_max_hart_id)
79
+ bgeu t0, a0, 1f
80
+ la t0, abort // If hart_id > _max_hart_id, jump to abort
81
+ jr t0
82
+ 1:" , // only valid harts reach this point
75
83
) ;
76
84
77
85
// ZERO OUT GENERAL-PURPOSE REGISTERS
@@ -91,9 +99,6 @@ cfg_global_asm!(
91
99
#[ cfg( not( feature = "single-hart" ) ) ]
92
100
cfg_global_asm ! (
93
101
"mv t2, a0
94
- lui t0, %hi(_max_hart_id)
95
- add t0, t0, %lo(_max_hart_id)
96
- bgtu t2, t0, abort
97
102
lui t0, %hi(_hart_stack_size)
98
103
add t0, t0, %lo(_hart_stack_size)" ,
99
104
#[ cfg( riscvm) ]
You can’t perform that action at this time.
0 commit comments