Commit 77e90954 authored by Martin Storsjö's avatar Martin Storsjö Committed by Alexandre Julliard

ntdll: Remove stack gap in syscalls on arm.

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: 's avatarMartin Storsjö <martin@martin.st> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b2934dd9
...@@ -1041,7 +1041,8 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, ...@@ -1041,7 +1041,8 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
"ldr r1, [r1, #0x1d8]\n\t" /* arm_thread_data()->syscall_frame */ "ldr r1, [r1, #0x1d8]\n\t" /* arm_thread_data()->syscall_frame */
"add r0, r1, #0x10\n\t" "add r0, r1, #0x10\n\t"
"stm r0, {r4-r12,lr}\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" "str r3, [r1, #0x3c]\n\t"
"mrs r0, CPSR\n\t" "mrs r0, CPSR\n\t"
"bfi r0, lr, #5, #1\n\t" /* set thumb bit */ "bfi r0, lr, #5, #1\n\t" /* set thumb bit */
...@@ -1099,6 +1100,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, ...@@ -1099,6 +1100,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
"ldm r8, {r4-r12,pc}\n" "ldm r8, {r4-r12,pc}\n"
"5:\tmovw r0, #0x000d\n\t" /* STATUS_INVALID_PARAMETER */ "5:\tmovw r0, #0x000d\n\t" /* STATUS_INVALID_PARAMETER */
"movt r0, #0xc000\n\t" "movt r0, #0xc000\n\t"
"add sp, sp, #0x10\n\t"
"b 4b\n" "b 4b\n"
__ASM_NAME("__wine_syscall_dispatcher_return") ":\n\t" __ASM_NAME("__wine_syscall_dispatcher_return") ":\n\t"
"mov r8, r0\n\t" "mov r8, r0\n\t"
......
...@@ -1492,7 +1492,6 @@ void output_syscalls( DLLSPEC *spec ) ...@@ -1492,7 +1492,6 @@ void output_syscalls( DLLSPEC *spec )
output( "\tmovw ip, #%u\n", id ); output( "\tmovw ip, #%u\n", id );
output( "\tmov r3, lr\n" ); output( "\tmov r3, lr\n" );
output( "\tbl %s\n", asm_name("__wine_syscall") ); output( "\tbl %s\n", asm_name("__wine_syscall") );
output( "\tadd sp, #16\n" );
output( "\tbx lr\n" ); output( "\tbx lr\n" );
break; break;
case CPU_ARM64: case CPU_ARM64:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment