RTEMS | RISC-V SMP start reads 64bits from a 32bit symbol (#5251)

Lucian Silistru (@lsilistr) gitlab at rtems.org
Sat May 24 17:31:52 UTC 2025



Lucian Silistru created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5251



## Summary
`_SMP_Processor_configured_maximum` is defined as a uint32_t here:
https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/cpukit/include/rtems/confdefs/percpu.h#L71
In riscv start.S it is read by LREG macro that on rv64 is a ld. It will also read the next 32 bits over in the MS half of the doubleword:
https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/riscv/shared/start/start.S?ref_type=heads#L77

I think https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/aarch64/shared/start/start.S#L241 has the same issue, but it's been a while since I ran an aarch64, ldr X<N> should be 64 bit load.

## Steps to reproduce
Err, just happened to have != 0 in the 32 bits above _SMP_Processor_configured_maximum address, and the second core went crazy.

### Pre-set options

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5251
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250524/008edae3/attachment.htm>


More information about the bugs mailing list