Store the original stack pointer (on entry to the syscall dispatcher) in syscall_frame; the stack pointer itself is incremented by "pop {r0-r3}" right before calling the syscall itself.
This fixes unwinding from functions set up by syscalls, like KiUserExceptionDispatcher.
Signed-off-by: Martin Storsjö martin@martin.st --- dlls/ntdll/unix/signal_arm.c | 4 +++- tools/winebuild/import.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index 88718e938a8..1cc34a9218e 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -1041,7 +1041,8 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "ldr r1, [r1, #0x1d8]\n\t" /* arm_thread_data()->syscall_frame */ "add r0, r1, #0x10\n\t" "stm r0, {r4-r12,lr}\n\t" - "str sp, [r1, #0x38]\n\t" + "add r2, sp, #0x10\n\t" + "str r2, [r1, #0x38]\n\t" "str r3, [r1, #0x3c]\n\t" "mrs r0, CPSR\n\t" "bfi r0, lr, #5, #1\n\t" /* set thumb bit */ @@ -1099,6 +1100,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "ldm r8, {r4-r12,pc}\n" "5:\tmovw r0, #0x000d\n\t" /* STATUS_INVALID_PARAMETER */ "movt r0, #0xc000\n\t" + "add sp, sp, #0x10\n\t" "b 4b\n" __ASM_NAME("__wine_syscall_dispatcher_return") ":\n\t" "mov r8, r0\n\t" diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 104397716f1..7972fc7b1d9 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1492,7 +1492,6 @@ void output_syscalls( DLLSPEC *spec ) output( "\tmovw ip, #%u\n", id ); output( "\tmov r3, lr\n" ); output( "\tbl %s\n", asm_name("__wine_syscall") ); - output( "\tadd sp, #16\n" ); output( "\tbx lr\n" ); break; case CPU_ARM64: