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/).
99
1010### Changed
1111
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.
1414- By default, the stack is now split into equal parts based on the number of
1515 harts.
1616- 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.
1719
1820### Fixed
1921
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ _abs_start:
7272 "csrw stvec, t0" ,
7373 #[ cfg( not( feature = "s-mode" ) ) ]
7474 "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
7583) ;
7684
7785// ZERO OUT GENERAL-PURPOSE REGISTERS
@@ -91,9 +99,6 @@ cfg_global_asm!(
9199#[ cfg( not( feature = "single-hart" ) ) ]
92100cfg_global_asm ! (
93101 "mv t2, a0
94- lui t0, %hi(_max_hart_id)
95- add t0, t0, %lo(_max_hart_id)
96- bgtu t2, t0, abort
97102 lui t0, %hi(_hart_stack_size)
98103 add t0, t0, %lo(_hart_stack_size)" ,
99104 #[ cfg( riscvm) ]
You can’t perform that action at this time.
0 commit comments