ntdll: Fix stack layout for ARM syscalls.

This commit is contained in:
Alexandre Julliard 2024-02-07 11:52:30 +01:00
parent 6b853a9354
commit b41566fb31
2 changed files with 9 additions and 23 deletions

View file

@ -1052,7 +1052,10 @@ NTSTATUS call_user_apc_dispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR a
*/
void call_raise_user_exception_dispatcher(void)
{
arm_thread_data()->syscall_frame->pc = (DWORD)pKiRaiseUserExceptionDispatcher;
struct syscall_frame *frame = arm_thread_data()->syscall_frame;
frame->sp += 16;
frame->pc = (DWORD)pKiRaiseUserExceptionDispatcher;
}
@ -1608,8 +1611,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
"ldr r1, [r2, #0x1d8]\n\t" /* arm_thread_data()->syscall_frame */
"add r0, r1, #0x10\n\t"
"stm r0, {r4-r12,lr}\n\t"
"add r0, sp, #0x10\n\t"
"str r0, [r1, #0x38]\n\t"
"str sp, [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 */
@ -1682,7 +1684,6 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
"5:\tmovw r0, #0x000d\n\t" /* STATUS_INVALID_PARAMETER */
"movt r0, #0xc000\n\t"
"add sp, sp, #0x10\n\t"
"b " __ASM_LOCAL_LABEL("__wine_syscall_dispatcher_return") "\n\t"
".globl " __ASM_NAME("__wine_syscall_dispatcher_return") "\n"
__ASM_NAME("__wine_syscall_dispatcher_return") ":\n\t"

View file

@ -268,34 +268,19 @@
# define __ASM_SYSCALL_FUNC(id,name,args) \
__ASM_GLOBAL_FUNC( name, \
"push {r0-r3}\n\t" \
".seh_save_regs {r0-r3}\n\t" \
".seh_endprologue\n\t" \
"movw ip, #(" #id ")\n\t" \
"mov r3, lr\n\t" \
"bl " __ASM_NAME("__wine_syscall") "\n\t" \
"add sp, #16\n\t" \
"bx lr" )
# ifndef __PIC__
# define DEFINE_SYSCALL_HELPER32() \
# define DEFINE_SYSCALL_HELPER32() \
__ASM_GLOBAL_FUNC( __wine_syscall, \
"movw r0, :lower16:" __ASM_NAME("__wine_syscall_dispatcher") "\n\t" \
"movt r0, :upper16:" __ASM_NAME("__wine_syscall_dispatcher") "\n\t" \
"ldr r0, [r0]\n\t" \
"bx r0" )
# elif defined __thumb__
# define DEFINE_SYSCALL_HELPER32() \
__ASM_GLOBAL_FUNC( __wine_syscall, \
"ldr r0, 2f\n" \
"1:\tadd r0, pc\n\t" \
"ldr r0, [r0]\n\t" \
"bx r0\n" \
"2:\t.long " __ASM_NAME("__wine_syscall_dispatcher") "-1b-4" )
# else
# define DEFINE_SYSCALL_HELPER32() \
__ASM_GLOBAL_FUNC( __wine_syscall, \
"ldr r0, 2f\n" \
"1:\tadd r0, pc\n\t" \
"ldr r0, [r0]\n\t" \
"bx r0\n" \
"2:\t.long " __ASM_NAME("__wine_syscall_dispatcher") "-1b-8" )
# endif
#endif
#endif /* __WINE_WINE_ASM_H */