From 4ef8e946f161ec5f7140699f6f97d9119a4ec7b2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 24 Feb 2021 10:34:15 +0100 Subject: [PATCH] winebuild: Set Thumb bit in CPSR register on syscall entry. Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/exception.c | 3 ++- tools/winebuild/import.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 06d8246a566..397de7dad98 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -4233,7 +4233,8 @@ static void test_thread_context(void) COMPARE( R9 ); COMPARE( R10 ); COMPARE( R11 ); - COMPARE( Cpsr ); + ok( (context.Cpsr & 0xff0f0000) == (expect.Cpsr & 0xff0f0000), + "wrong Cpsr %08x/%08x\n", context.Cpsr, expect.Cpsr ); ok( context.Sp == expect.Sp - 8, "wrong Sp %08x/%08x\n", context.Sp, expect.Sp - 8 ); /* Pc is somewhere close to the NtGetContextThread implementation */ diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 2fa9d3d430b..791ea6e400c 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1611,6 +1611,7 @@ static void output_syscall_dispatcher( int count, const char *variant ) output( "\tmrc p15, 0, r7, c13, c0, 2\n" ); /* NtCurrentTeb() */ output( "\tadd r7, #0x1d8\n" ); /* arm_thread_data()->syscall_frame */ output( "\tmrs ip, CPSR\n" ); + output( "\tbfi ip, lr, #5, #1\n" ); /* set thumb bit */ output( "\tstr ip, [sp, #4]\n" ); output( "\tstr sp, [r7]\n" ); /* syscall frame */ output( "\tldr r5, 6f+4\n");