Skip to content

Commit cd17f36

Browse files
committed
Fix REGS_SAVER_FUNC test util on ARM
REGS_SAVER_FUNC is meant to work even if the stack pointer is misaligned, but the multi-register PUSH instructions crash if the stack is misaligned, as per the ARM documentation. I guess the old(?) bundled QEMU used by upstream doesn't implement this faithfully. Fix it by using a series of single-register pushes instead. Fixes the run_register_set_test test target on ARM.
1 parent 78c721a commit cd17f36

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/common/register_set.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,23 @@ extern const uint8_t kX86FlagBits[5];
400400
"push {r14}\n" \
401401
/* Save r0-r12 and sp; adjust sp for the pushes above */ \
402402
"add r14, sp, #0xc\n" \
403-
"push {r10-r12, r14}\n" \
403+
"push {r14}\n" \
404+
"push {r12}\n" \
405+
"push {r11}\n" \
406+
"push {r10}\n" \
404407
/* Push a dummy value for r9, which the tests need not compare */ \
405408
"mov r10, #0\n" \
406409
"push {r10}\n" \
407410
/* Save the rest of struct NaClSignalContext */ \
408-
"push {r0-r8}\n" \
411+
"push {r8}\n" \
412+
"push {r7}\n" \
413+
"push {r6}\n" \
414+
"push {r5}\n" \
415+
"push {r4}\n" \
416+
"push {r3}\n" \
417+
"push {r2}\n" \
418+
"push {r1}\n" \
419+
"push {r0}\n" \
409420
/* Now save a correct prog_ctr value */ \
410421
"adr r0, " #def_func "\n" \
411422
"str r0, [sp, #0x3c]\n" \

0 commit comments

Comments
 (0)