Alexandre Julliard : ntdll: Store extended FPU state and debug registers in RtlRaiseException().
Alexandre Julliard
julliard at winehq.org
Thu Feb 14 16:19:12 CST 2019
Module: wine
Branch: master
Commit: 20a2cc9751d1f32e610704a9bd58d2b99eaf0534
URL: https://source.winehq.org/git/wine.git/?a=commit;h=20a2cc9751d1f32e610704a9bd58d2b99eaf0534
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Feb 14 19:51:35 2019 +0100
ntdll: Store extended FPU state and debug registers in RtlRaiseException().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/signal_i386.c | 11 ++++++++++-
dlls/ntdll/tests/exception.c | 3 +++
include/winnt.h | 3 +++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 3ce10d3..0274a7d 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2534,7 +2534,16 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
void raise_exception_full_context( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance )
{
save_fpu( context );
- /* FIXME: extended registers, debug registers */
+ save_fpux( context );
+ /* FIXME: xstate */
+ context->Dr0 = x86_thread_data()->dr0;
+ context->Dr1 = x86_thread_data()->dr1;
+ context->Dr2 = x86_thread_data()->dr2;
+ context->Dr3 = x86_thread_data()->dr3;
+ context->Dr6 = x86_thread_data()->dr6;
+ context->Dr7 = x86_thread_data()->dr7;
+ context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
+
RtlRaiseStatus( NtRaiseException( rec, context, first_chance ));
}
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index f7b8f21..b8bd186 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -400,6 +400,9 @@ static DWORD rtlraiseexception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR
ok(rec->ExceptionAddress == (char *)code_mem + 0xb, "ExceptionAddress at %p instead of %p\n",
rec->ExceptionAddress, (char *)code_mem + 0xb);
+ ok( context->ContextFlags == CONTEXT_ALL || context->ContextFlags == (CONTEXT_ALL | CONTEXT_XSTATE),
+ "wrong context flags %x\n", context->ContextFlags );
+
/* check that context.Eip is fixed up only for EXCEPTION_BREAKPOINT
* even if raised by RtlRaiseException
*/
diff --git a/include/winnt.h b/include/winnt.h
index 2b48938..5694ad7 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -969,6 +969,7 @@ typedef struct _CONTEXT
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
+#define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
@@ -1014,6 +1015,7 @@ typedef struct _LDT_ENTRY {
#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
+#define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x0040)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
@@ -2130,6 +2132,7 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
#define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
#define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
#define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
+#define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
#define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
#define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
More information about the wine-cvs
mailing list