arm: fix start_thread() on Cortex-M targets

The layout of 'struct regs' is a bit different on Cortex-M
and start_thread() wasn't updated to match; it was loading
'sp' from the wrong offset.

Change-Id: I57dbef26809821d411dc86e2066a2f53e78a3f2d
This commit is contained in:
Aidan MacDonald 2025-12-29 13:17:38 +00:00 committed by Solomon Peachy
parent 19a49220b1
commit cb9094dabb

View file

@ -29,7 +29,11 @@ static void __attribute__((naked)) USED_ATTR start_thread(void)
{
/* r0 = context */
asm volatile (
#if defined(CPU_ARM_MICRO) && ARCH_VERSION >= 7
"ldr sp, [r0, #36] \n" /* Load initial sp */
#else
"ldr sp, [r0, #32] \n" /* Load initial sp */
#endif
"ldr r4, [r0, #40] \n" /* start in r4 since it's non-volatile */
"mov r1, #0 \n" /* Mark thread as running */
"str r1, [r0, #40] \n"