mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-06 10:59:48 +08:00
cpukit/score/cpu/or1k: Fix the context validation
_CPU_Context_validate() ignored its pattern and filled the registers with a counter, so the three tasks of spcontext01 wrote the same values and a leak between them could not be seen. It kept the entry stack pointer in r31 and then filled r31 with that counter, so the comparison of the stack pointer could not hold and the routine returned on its first pass, which hung the test. _CPU_Context_volatile_clobber() covered eight of the volatile registers. The stack pointer is compared through the frame, since no register is left for it. Close #5686. Assisted-by: Claude:claude-opus-5 claude-code Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
committed by
Chris Johns
parent
4167862e70
commit
a36e3a39ab
File diff suppressed because it is too large
Load Diff
@@ -33,22 +33,36 @@
|
||||
|
||||
.section .text
|
||||
|
||||
/*
|
||||
* The volatile registers of the ABI are the arguments r3 to r8, the return
|
||||
* address r9, the return values r11 and r12, and the odd numbered registers
|
||||
* from r13 on. The thread pointer r10 is not one of them.
|
||||
*/
|
||||
|
||||
.macro clobber_register reg, inc
|
||||
l.addi r\reg, r3, \inc
|
||||
.endm
|
||||
|
||||
PUBLIC(_CPU_Context_volatile_clobber)
|
||||
SYM(_CPU_Context_volatile_clobber):
|
||||
|
||||
.macro clobber_register reg
|
||||
l.addi r0, r0, -1
|
||||
l.addi \reg, r0, 0
|
||||
.endm
|
||||
clobber_register 4, 1
|
||||
clobber_register 5, 2
|
||||
clobber_register 6, 3
|
||||
clobber_register 7, 4
|
||||
clobber_register 8, 5
|
||||
clobber_register 11, 6
|
||||
clobber_register 12, 7
|
||||
clobber_register 13, 8
|
||||
clobber_register 15, 9
|
||||
clobber_register 17, 10
|
||||
clobber_register 19, 11
|
||||
clobber_register 21, 12
|
||||
clobber_register 23, 13
|
||||
clobber_register 25, 14
|
||||
clobber_register 27, 15
|
||||
clobber_register 29, 16
|
||||
clobber_register 31, 17
|
||||
|
||||
clobber_register r3
|
||||
clobber_register r4
|
||||
clobber_register r5
|
||||
clobber_register r6
|
||||
clobber_register r7
|
||||
clobber_register r8
|
||||
clobber_register r13
|
||||
clobber_register r31
|
||||
|
||||
l.jr r9
|
||||
l.nop
|
||||
l.jr r9
|
||||
l.nop
|
||||
|
||||
Reference in New Issue
Block a user