diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-03-16 08:31:08 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-03-17 07:25:23 +0100 |
commit | e5233057be3396e9cd75ffd3a92d2048df316a4b (patch) | |
tree | 550b78e2e5b834a57b89ff79e49a8a74c7398aca /bsps/riscv/shared/start/start.S | |
parent | rtems/test.h: Use __attribute__ (diff) | |
download | rtems-e5233057be3396e9cd75ffd3a92d2048df316a4b.tar.bz2 |
bsps/riscv: Make SMP start more robust
In SMP configurations, check that we run on a configured processor. If not,
then there is not much that can be done since we do not have a stack available
for this processor. Just loop forever in this case. Do this in assemlby to
ensure that no stack memory is used.
Diffstat (limited to '')
-rw-r--r-- | bsps/riscv/shared/start/start.S | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S index 34e1839ca1..242bd4fcc4 100644 --- a/bsps/riscv/shared/start/start.S +++ b/bsps/riscv/shared/start/start.S @@ -66,8 +66,17 @@ SYM(_start): LADDR sp, _ISR_Stack_area_begin LADDR t2, _ISR_Stack_size csrr s0, mhartid - li t3, RISCV_BOOT_HARTID - sub s0, s0, t3 + li t3, RISCV_BOOT_HARTID + sub s0, s0, t3 + + /* + * Check that this is a configured processor. If not, then there is + * not much that can be done since we do not have a stack available for + * this processor. Just loop forever in this case. + */ + LREG t3, _SMP_Processor_configured_maximum + bgeu s0, t3, .Lwfi + LADDR t0, _Per_CPU_Information slli t1, s0, PER_CPU_CONTROL_SIZE_LOG2 add s1, t0, t1 @@ -100,6 +109,9 @@ SYM(_start): tail boot_card #ifdef RTEMS_SMP +.Lwfi: + wfi + j .Lwfi .Lstart_on_secondary_processor: |