[PATCH] include: Update ARM64 context flag definitions to match current SDKs

Martin Storsjo martin at martin.st
Fri Aug 21 07:02:03 CDT 2020


CONTEXT_FLOATING_POINT should be included in CONTEXT_FULL, and
there's a new flag CONTEXT_ARM64_X18 (not available without
the arch specific prefix) that only is part of CONTEXT_ALL.

Update existing code that tries to set these flags accordingly.

Signed-off-by: Martin Storsjo <martin at martin.st>
---
 dlls/ntdll/signal_arm64.c      | 2 +-
 dlls/ntdll/unix/signal_arm64.c | 7 ++++---
 include/winnt.h                | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index c8f6014699..aef17dec32 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -97,7 +97,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 8,
                     "mov x1, sp\n\t"
                     "stp x1, x30, [x0, #0x100]\n\t"  /* context->Sp,Pc */
                     "mov w1, #0x400000\n\t"          /* CONTEXT_ARM64 */
-                    "add w1, w1, #0x3\n\t"           /* CONTEXT_FULL */
+                    "add w1, w1, #0x7\n\t"           /* CONTEXT_FULL */
                     "str w1, [x0]\n\t"               /* context->ContextFlags */
                     "mrs x1, NZCV\n\t"
                     "str w1, [x0, #0x4]\n\t"         /* context->Cpsr */
diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c
index 52f00323a0..a4454af71e 100644
--- a/dlls/ntdll/unix/signal_arm64.c
+++ b/dlls/ntdll/unix/signal_arm64.c
@@ -311,7 +311,8 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext )
 {
     DWORD i;
 
-    context->ContextFlags = CONTEXT_FULL;
+    context->ContextFlags = (CONTEXT_FULL & ~CONTEXT_FLOATING_POINT) |
+                             CONTEXT_ARM64;
     context->u.s.Fp = FP_sig(sigcontext);     /* Frame pointer */
     context->u.s.Lr = LR_sig(sigcontext);     /* Link register */
     context->Sp     = SP_sig(sigcontext);     /* Stack pointer */
@@ -664,7 +665,7 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
                    "csel x0, x19, x0, lo\n\t"
                    "mov sp, x0\n\t"
                    "mov w2, #0x400000\n\t"       /* context.ContextFlags = CONTEXT_FULL */
-                   "movk w2, #3\n\t"
+                   "movk w2, #7\n\t"
                    "mov x1, x19\n\t"
                    "str w2, [x19]\n\t"
                    "mov x0, #~1\n\t"
@@ -1039,7 +1040,7 @@ PCONTEXT DECLSPEC_HIDDEN get_initial_context( LPTHREAD_START_ROUTINE entry, void
         init_thread_context( ctx, entry, arg, relay );
     }
     pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL );
-    ctx->ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT;
+    ctx->ContextFlags = CONTEXT_FULL;
     return ctx;
 }
 
diff --git a/include/winnt.h b/include/winnt.h
index e22fd5da49..88b7454ba7 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -1928,11 +1928,12 @@ NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,DWORD,DWORD,RUNTIME_FUNCTION*,CONTE
 #define CONTEXT_INTEGER         (CONTEXT_ARM64 | 0x00000002)
 #define CONTEXT_FLOATING_POINT  (CONTEXT_ARM64 | 0x00000004)
 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
+#define CONTEXT_ARM64_X18       (CONTEXT_ARM64 | 0x00000010)
 
 #define CONTEXT_UNWOUND_TO_CALL 0x20000000
 
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
-#define CONTEXT_ALL  (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
+#define CONTEXT_ALL  (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_ARM64_X18)
 
 #define EXCEPTION_READ_FAULT    0
 #define EXCEPTION_WRITE_FAULT   1
-- 
2.17.1




More information about the wine-devel mailing list