Commit 7a25671c authored by Alexandre Julliard's avatar Alexandre Julliard

include: Define all the context structures on all platforms.

parent 0214c73d
...@@ -977,22 +977,13 @@ typedef enum _HEAP_INFORMATION_CLASS { ...@@ -977,22 +977,13 @@ typedef enum _HEAP_INFORMATION_CLASS {
#include <excpt.h> #include <excpt.h>
struct _CONTEXT;
struct _EXCEPTION_POINTERS;
struct _EXCEPTION_RECORD;
typedef EXCEPTION_DISPOSITION WINAPI EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD*,PVOID,
struct _CONTEXT*,PVOID);
typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
/* The Win32 register context */ /* The Win32 register context */
/* i386 context definitions */ /* i386 context definitions */
#ifdef __i386__
#define SIZE_OF_80387_REGISTERS 80 #define I386_SIZE_OF_80387_REGISTERS 80
typedef struct _FLOATING_SAVE_AREA typedef struct _I386_FLOATING_SAVE_AREA
{ {
DWORD ControlWord; DWORD ControlWord;
DWORD StatusWord; DWORD StatusWord;
...@@ -1001,13 +992,14 @@ typedef struct _FLOATING_SAVE_AREA ...@@ -1001,13 +992,14 @@ typedef struct _FLOATING_SAVE_AREA
DWORD ErrorSelector; DWORD ErrorSelector;
DWORD DataOffset; DWORD DataOffset;
DWORD DataSelector; DWORD DataSelector;
BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; BYTE RegisterArea[I386_SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState; DWORD Cr0NpxState;
} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA; } I386_FLOATING_SAVE_AREA, WOW64_FLOATING_SAVE_AREA, *PWOW64_FLOATING_SAVE_AREA;
#define MAXIMUM_SUPPORTED_EXTENSION 512 #define I386_MAXIMUM_SUPPORTED_EXTENSION 512
typedef struct _CONTEXT #include "pshpack4.h"
typedef struct _I386_CONTEXT
{ {
DWORD ContextFlags; /* 000 */ DWORD ContextFlags; /* 000 */
...@@ -1020,7 +1012,7 @@ typedef struct _CONTEXT ...@@ -1020,7 +1012,7 @@ typedef struct _CONTEXT
DWORD Dr7; /* 018 */ DWORD Dr7; /* 018 */
/* These are selected by CONTEXT_FLOATING_POINT */ /* These are selected by CONTEXT_FLOATING_POINT */
FLOATING_SAVE_AREA FloatSave; /* 01c */ I386_FLOATING_SAVE_AREA FloatSave; /* 01c */
/* These are selected by CONTEXT_SEGMENTS */ /* These are selected by CONTEXT_SEGMENTS */
DWORD SegGs; /* 08c */ DWORD SegGs; /* 08c */
...@@ -1044,26 +1036,39 @@ typedef struct _CONTEXT ...@@ -1044,26 +1036,39 @@ typedef struct _CONTEXT
DWORD Esp; /* 0c4 */ DWORD Esp; /* 0c4 */
DWORD SegSs; /* 0c8 */ DWORD SegSs; /* 0c8 */
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */ BYTE ExtendedRegisters[I386_MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */
} CONTEXT, *PCONTEXT; } I386_CONTEXT, WOW64_CONTEXT, *PWOW64_CONTEXT;
#include "poppack.h"
#define CONTEXT_i386 0x00010000 #define CONTEXT_i386 0x00010000
#define CONTEXT_i486 0x00010000 #define CONTEXT_i486 0x00010000
#define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */ #define CONTEXT_I386_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
#define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */ #define CONTEXT_I386_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */ #define CONTEXT_I386_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */ #define CONTEXT_I386_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */ #define CONTEXT_I386_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020) #define CONTEXT_I386_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
#define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040) #define CONTEXT_I386_XSTATE (CONTEXT_i386 | 0x0040)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) #define CONTEXT_I386_FULL (CONTEXT_I386_CONTROL | CONTEXT_I386_INTEGER | CONTEXT_I386_SEGMENTS)
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \ #define CONTEXT_I386_ALL (CONTEXT_I386_FULL | CONTEXT_I386_FLOATING_POINT | CONTEXT_I386_DEBUG_REGISTERS | CONTEXT_I386_EXTENDED_REGISTERS)
CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
#define EXCEPTION_READ_FAULT 0 #ifdef __i386__
#define EXCEPTION_WRITE_FAULT 1
#define EXCEPTION_EXECUTE_FAULT 8 #define CONTEXT_CONTROL CONTEXT_I386_CONTROL
#define CONTEXT_INTEGER CONTEXT_I386_INTEGER
#define CONTEXT_SEGMENTS CONTEXT_I386_SEGMENTS
#define CONTEXT_FLOATING_POINT CONTEXT_I386_FLOATING_POINT
#define CONTEXT_DEBUG_REGISTERS CONTEXT_I386_DEBUG_REGISTERS
#define CONTEXT_EXTENDED_REGISTERS CONTEXT_I386_EXTENDED_REGISTERS
#define CONTEXT_XSTATE CONTEXT_I386_XSTATE
#define CONTEXT_FULL CONTEXT_I386_FULL
#define CONTEXT_ALL CONTEXT_I386_ALL
#define SIZE_OF_80387_REGISTERS I386_SIZE_OF_80387_REGISTERS
#define MAXIMUM_SUPPORTED_EXTENSION I386_MAXIMUM_SUPPORTED_EXTENSION
typedef I386_FLOATING_SAVE_AREA FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
typedef I386_CONTEXT CONTEXT, *PCONTEXT;
#endif /* __i386__ */ #endif /* __i386__ */
...@@ -1117,26 +1122,28 @@ typedef struct _XSAVE_FORMAT { ...@@ -1117,26 +1122,28 @@ typedef struct _XSAVE_FORMAT {
} XSAVE_FORMAT, *PXSAVE_FORMAT; } XSAVE_FORMAT, *PXSAVE_FORMAT;
/* x86-64 context definitions */ /* x86-64 context definitions */
#if defined(__x86_64__)
#define CONTEXT_AMD64 0x00100000 typedef struct _AMD64_RUNTIME_FUNCTION
{
DWORD BeginAddress;
DWORD EndAddress;
DWORD UnwindData;
} AMD64_RUNTIME_FUNCTION;
#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001) #define CONTEXT_AMD64 0x00100000
#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
#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)
#define EXCEPTION_READ_FAULT 0 #define CONTEXT_AMD64_CONTROL (CONTEXT_AMD64 | 0x0001)
#define EXCEPTION_WRITE_FAULT 1 #define CONTEXT_AMD64_INTEGER (CONTEXT_AMD64 | 0x0002)
#define EXCEPTION_EXECUTE_FAULT 8 #define CONTEXT_AMD64_SEGMENTS (CONTEXT_AMD64 | 0x0004)
#define CONTEXT_AMD64_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
#define CONTEXT_AMD64_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
#define CONTEXT_AMD64_XSTATE (CONTEXT_AMD64 | 0x0040)
#define CONTEXT_AMD64_FULL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_FLOATING_POINT)
#define CONTEXT_AMD64_ALL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_SEGMENTS | CONTEXT_AMD64_FLOATING_POINT | CONTEXT_AMD64_DEBUG_REGISTERS)
typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
typedef struct DECLSPEC_ALIGN(16) _CONTEXT { typedef struct DECLSPEC_ALIGN(16) _AMD64_CONTEXT {
DWORD64 P1Home; /* 000 */ DWORD64 P1Home; /* 000 */
DWORD64 P2Home; /* 008 */ DWORD64 P2Home; /* 008 */
DWORD64 P3Home; /* 010 */ DWORD64 P3Home; /* 010 */
...@@ -1221,35 +1228,21 @@ typedef struct DECLSPEC_ALIGN(16) _CONTEXT { ...@@ -1221,35 +1228,21 @@ typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
DWORD64 LastBranchFromRip; /* 4b8 */ DWORD64 LastBranchFromRip; /* 4b8 */
DWORD64 LastExceptionToRip; /* 4c0 */ DWORD64 LastExceptionToRip; /* 4c0 */
DWORD64 LastExceptionFromRip; /* 4c8 */ DWORD64 LastExceptionFromRip; /* 4c8 */
} CONTEXT, *PCONTEXT; } AMD64_CONTEXT;
typedef struct _RUNTIME_FUNCTION #ifdef __x86_64__
{
DWORD BeginAddress;
DWORD EndAddress;
DWORD UnwindData;
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
#define UNWIND_HISTORY_TABLE_SIZE 12
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
#define UNWIND_HISTORY_TABLE_NONE 0 #define CONTEXT_CONTROL CONTEXT_AMD64_CONTROL
#define UNWIND_HISTORY_TABLE_GLOBAL 1 #define CONTEXT_INTEGER CONTEXT_AMD64_INTEGER
#define UNWIND_HISTORY_TABLE_LOCAL 2 #define CONTEXT_SEGMENTS CONTEXT_AMD64_SEGMENTS
#define CONTEXT_FLOATING_POINT CONTEXT_AMD64_FLOATING_POINT
#define CONTEXT_DEBUG_REGISTERS CONTEXT_AMD64_DEBUG_REGISTERS
#define CONTEXT_XSTATE CONTEXT_AMD64_XSTATE
#define CONTEXT_FULL CONTEXT_AMD64_FULL
#define CONTEXT_ALL CONTEXT_AMD64_ALL
typedef struct _UNWIND_HISTORY_TABLE typedef AMD64_CONTEXT CONTEXT, *PCONTEXT;
{ typedef AMD64_RUNTIME_FUNCTION RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
ULONG Count;
UCHAR Search;
ULONG64 LowAddress;
ULONG64 HighAddress;
UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS typedef struct _KNONVOLATILE_CONTEXT_POINTERS
{ {
...@@ -1302,31 +1295,6 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS ...@@ -1302,31 +1295,6 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS
} DUMMYUNIONNAME2; } DUMMYUNIONNAME2;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
DWORD Fill0;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,PVOID);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,PVOID);
NTSYSAPI PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#define UNW_FLAG_CHAININFO 4
#endif /* __x86_64__ */ #endif /* __x86_64__ */
#define XSTATE_LEGACY_FLOATING_POINT 0 #define XSTATE_LEGACY_FLOATING_POINT 0
...@@ -1415,27 +1383,18 @@ typedef struct _CONTEXT_EX ...@@ -1415,27 +1383,18 @@ typedef struct _CONTEXT_EX
#endif #endif
} CONTEXT_EX, *PCONTEXT_EX; } CONTEXT_EX, *PCONTEXT_EX;
#ifdef __arm__
/* The following flags control the contents of the CONTEXT structure. */
#define CONTEXT_ARM 0x0200000 #define CONTEXT_ARM 0x0200000
#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001) #define CONTEXT_ARM_CONTROL (CONTEXT_ARM | 0x00000001)
#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002) #define CONTEXT_ARM_INTEGER (CONTEXT_ARM | 0x00000002)
#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004) #define CONTEXT_ARM_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008) #define CONTEXT_ARM_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
#define CONTEXT_ARM_FULL (CONTEXT_ARM_CONTROL | CONTEXT_ARM_INTEGER)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER) #define CONTEXT_ARM_ALL (CONTEXT_ARM_FULL | CONTEXT_ARM_FLOATING_POINT | CONTEXT_ARM_DEBUG_REGISTERS)
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
#define EXCEPTION_READ_FAULT 0
#define EXCEPTION_WRITE_FAULT 1
#define EXCEPTION_EXECUTE_FAULT 8
#define ARM_MAX_BREAKPOINTS 8 #define ARM_MAX_BREAKPOINTS 8
#define ARM_MAX_WATCHPOINTS 1 #define ARM_MAX_WATCHPOINTS 1
typedef struct _RUNTIME_FUNCTION typedef struct _IMAGE_ARM_RUNTIME_FUNCTION
{ {
DWORD BeginAddress; DWORD BeginAddress;
union { union {
...@@ -1452,35 +1411,15 @@ typedef struct _RUNTIME_FUNCTION ...@@ -1452,35 +1411,15 @@ typedef struct _RUNTIME_FUNCTION
DWORD StackAdjust : 10; DWORD StackAdjust : 10;
} DUMMYSTRUCTNAME; } DUMMYSTRUCTNAME;
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; } IMAGE_ARM_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY;
#define UNWIND_HISTORY_TABLE_SIZE 12 typedef struct _ARM_NEON128
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
typedef struct _UNWIND_HISTORY_TABLE
{
DWORD Count;
BYTE LocalHint;
BYTE GlobalHint;
BYTE Search;
BYTE Once;
DWORD LowAddress;
DWORD HighAddress;
UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
typedef struct _NEON128
{ {
ULONGLONG Low; ULONGLONG Low;
LONGLONG High; LONGLONG High;
} NEON128, *PNEON128; } ARM_NEON128;
typedef struct _CONTEXT typedef struct _ARM_CONTEXT
{ {
ULONG ContextFlags; /* 000 */ ULONG ContextFlags; /* 000 */
/* CONTEXT_INTEGER */ /* CONTEXT_INTEGER */
...@@ -1507,7 +1446,7 @@ typedef struct _CONTEXT ...@@ -1507,7 +1446,7 @@ typedef struct _CONTEXT
ULONG Padding; /* 04c */ ULONG Padding; /* 04c */
union union
{ {
NEON128 Q[16]; ARM_NEON128 Q[16];
ULONGLONG D[32]; ULONGLONG D[32];
ULONG S[32]; ULONG S[32];
} DUMMYUNIONNAME; /* 050 */ } DUMMYUNIONNAME; /* 050 */
...@@ -1517,7 +1456,20 @@ typedef struct _CONTEXT ...@@ -1517,7 +1456,20 @@ typedef struct _CONTEXT
ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */ ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */
ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */ ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */
ULONG Padding2[2]; /* 198 */ ULONG Padding2[2]; /* 198 */
} CONTEXT, *PCONTEXT; } ARM_CONTEXT;
#ifdef __arm__
#define CONTEXT_CONTROL CONTEXT_ARM_CONTROL
#define CONTEXT_INTEGER CONTEXT_ARM_INTEGER
#define CONTEXT_FLOATING_POINT CONTEXT_ARM_FLOATING_POINT
#define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM_DEBUG_REGISTERS
#define CONTEXT_FULL CONTEXT_ARM_FULL
#define CONTEXT_ALL CONTEXT_ARM_ALL
typedef IMAGE_ARM_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
typedef ARM_NEON128 NEON128, *PNEON128;
typedef ARM_CONTEXT CONTEXT, *PCONTEXT;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS typedef struct _KNONVOLATILE_CONTEXT_POINTERS
{ {
...@@ -1540,56 +1492,23 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS ...@@ -1540,56 +1492,23 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS
PULONGLONG D15; PULONGLONG D15;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
DWORD ControlPc;
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
DWORD EstablisherFrame;
DWORD TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
DWORD Reserved;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD);
NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,DWORD,DWORD,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,DWORD*,KNONVOLATILE_CONTEXT_POINTERS*);
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#endif /* __arm__ */ #endif /* __arm__ */
#ifdef __aarch64__
#define CONTEXT_ARM64 0x400000 #define CONTEXT_ARM64 0x400000
#define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001) #define CONTEXT_ARM64_CONTROL (CONTEXT_ARM64 | 0x00000001)
#define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002) #define CONTEXT_ARM64_INTEGER (CONTEXT_ARM64 | 0x00000002)
#define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004) #define CONTEXT_ARM64_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008) #define CONTEXT_ARM64_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
#define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x00000010) #define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x00000010)
#define CONTEXT_ARM64_FULL (CONTEXT_ARM64_CONTROL | CONTEXT_ARM64_INTEGER | CONTEXT_ARM64_FLOATING_POINT)
#define CONTEXT_ARM64_ALL (CONTEXT_ARM64_FULL | CONTEXT_ARM64_DEBUG_REGISTERS | CONTEXT_ARM64_X18)
#define CONTEXT_UNWOUND_TO_CALL 0x20000000 #define CONTEXT_UNWOUND_TO_CALL 0x20000000
#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
#define EXCEPTION_EXECUTE_FAULT 8
#define ARM64_MAX_BREAKPOINTS 8 #define ARM64_MAX_BREAKPOINTS 8
#define ARM64_MAX_WATCHPOINTS 2 #define ARM64_MAX_WATCHPOINTS 2
typedef struct _RUNTIME_FUNCTION typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
{ {
DWORD BeginAddress; DWORD BeginAddress;
union union
...@@ -1606,29 +1525,11 @@ typedef struct _RUNTIME_FUNCTION ...@@ -1606,29 +1525,11 @@ typedef struct _RUNTIME_FUNCTION
DWORD FrameSize : 9; DWORD FrameSize : 9;
} DUMMYSTRUCTNAME; } DUMMYSTRUCTNAME;
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
#define UNWIND_HISTORY_TABLE_SIZE 12 typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY ARM64_RUNTIME_FUNCTION, *PARM64_RUNTIME_FUNCTION;
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
DWORD64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
typedef struct _UNWIND_HISTORY_TABLE
{
DWORD Count;
BYTE LocalHint;
BYTE GlobalHint;
BYTE Search;
BYTE Once;
DWORD64 LowAddress;
DWORD64 HighAddress;
UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
typedef union _NEON128 typedef union _ARM64_NT_NEON128
{ {
struct struct
{ {
...@@ -1639,9 +1540,9 @@ typedef union _NEON128 ...@@ -1639,9 +1540,9 @@ typedef union _NEON128
float S[4]; float S[4];
WORD H[8]; WORD H[8];
BYTE B[16]; BYTE B[16];
} NEON128, *PNEON128; } ARM64_NT_NEON128, *PARM64_NT_NEON128;
typedef struct _CONTEXT typedef struct DECLSPEC_ALIGN(16) _ARM64_NT_CONTEXT
{ {
ULONG ContextFlags; /* 000 */ ULONG ContextFlags; /* 000 */
/* CONTEXT_INTEGER */ /* CONTEXT_INTEGER */
...@@ -1688,7 +1589,7 @@ typedef struct _CONTEXT ...@@ -1688,7 +1589,7 @@ typedef struct _CONTEXT
DWORD64 Sp; /* 100 */ DWORD64 Sp; /* 100 */
DWORD64 Pc; /* 108 */ DWORD64 Pc; /* 108 */
/* CONTEXT_FLOATING_POINT */ /* CONTEXT_FLOATING_POINT */
NEON128 V[32]; /* 110 */ ARM64_NT_NEON128 V[32]; /* 110 */
DWORD Fpcr; /* 310 */ DWORD Fpcr; /* 310 */
DWORD Fpsr; /* 314 */ DWORD Fpsr; /* 314 */
/* CONTEXT_DEBUG_REGISTERS */ /* CONTEXT_DEBUG_REGISTERS */
...@@ -1696,7 +1597,20 @@ typedef struct _CONTEXT ...@@ -1696,7 +1597,20 @@ typedef struct _CONTEXT
DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */ DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */
DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */ DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */
DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */ DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */
} CONTEXT, *PCONTEXT; } ARM64_NT_CONTEXT, *PARM64_NT_CONTEXT;
#ifdef __aarch64__
#define CONTEXT_CONTROL CONTEXT_ARM64_CONTROL
#define CONTEXT_INTEGER CONTEXT_ARM64_INTEGER
#define CONTEXT_FLOATING_POINT CONTEXT_ARM64_FLOATING_POINT
#define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM64_DEBUG_REGISTERS
#define CONTEXT_FULL CONTEXT_ARM64_FULL
#define CONTEXT_ALL CONTEXT_ARM64_ALL
typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
typedef ARM64_NT_NEON128 NEON128, *PNEON128;
typedef ARM64_NT_CONTEXT CONTEXT, *PCONTEXT;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS typedef struct _KNONVOLATILE_CONTEXT_POINTERS
{ {
...@@ -1722,31 +1636,6 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS ...@@ -1722,31 +1636,6 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS
PDWORD64 D15; PDWORD64 D15;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
ULONG_PTR ControlPc;
ULONG_PTR ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG_PTR EstablisherFrame;
ULONG_PTR TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD64);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD64);
NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,ULONG_PTR,ULONG_PTR,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG_PTR*,KNONVOLATILE_CONTEXT_POINTERS*);
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#endif /* __aarch64__ */ #endif /* __aarch64__ */
#if !defined(CONTEXT_FULL) && !defined(RC_INVOKED) #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
...@@ -1769,8 +1658,6 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*); ...@@ -1769,8 +1658,6 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \ WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS) WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
#define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
#define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
#define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
#define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
...@@ -1779,49 +1666,156 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*); ...@@ -1779,49 +1666,156 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
#define WOW64_SIZE_OF_80387_REGISTERS 80 #define WOW64_SIZE_OF_80387_REGISTERS 80
#define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
typedef struct _WOW64_FLOATING_SAVE_AREA /* Exception definitions */
#define EXCEPTION_READ_FAULT 0
#define EXCEPTION_WRITE_FAULT 1
#define EXCEPTION_EXECUTE_FAULT 8
struct _EXCEPTION_POINTERS;
struct _EXCEPTION_RECORD;
typedef EXCEPTION_DISPOSITION WINAPI EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD*,PVOID,CONTEXT*,PVOID);
typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
#ifdef __x86_64__
#define UNWIND_HISTORY_TABLE_SIZE 12
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{ {
DWORD ControlWord; ULONG64 ImageBase;
DWORD StatusWord; PRUNTIME_FUNCTION FunctionEntry;
DWORD TagWord; } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[WOW64_SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState;
} WOW64_FLOATING_SAVE_AREA, *PWOW64_FLOATING_SAVE_AREA;
#include "pshpack4.h" #define UNWIND_HISTORY_TABLE_NONE 0
typedef struct _WOW64_CONTEXT #define UNWIND_HISTORY_TABLE_GLOBAL 1
#define UNWIND_HISTORY_TABLE_LOCAL 2
typedef struct _UNWIND_HISTORY_TABLE
{ {
DWORD ContextFlags; ULONG Count;
DWORD Dr0; UCHAR Search;
DWORD Dr1; ULONG64 LowAddress;
DWORD Dr2; ULONG64 HighAddress;
DWORD Dr3; UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
DWORD Dr6; } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
DWORD Dr7;
WOW64_FLOATING_SAVE_AREA FloatSave; typedef struct _DISPATCHER_CONTEXT
DWORD SegGs; {
DWORD SegFs; ULONG64 ControlPc;
DWORD SegEs; ULONG64 ImageBase;
DWORD SegDs; PRUNTIME_FUNCTION FunctionEntry;
DWORD Edi; ULONG64 EstablisherFrame;
DWORD Esi; ULONG64 TargetIp;
DWORD Ebx; PCONTEXT ContextRecord;
DWORD Edx; PEXCEPTION_ROUTINE LanguageHandler;
DWORD Ecx; PVOID HandlerData;
DWORD Eax; PUNWIND_HISTORY_TABLE HistoryTable;
DWORD Ebp; DWORD ScopeIndex;
DWORD Eip; DWORD Fill0;
DWORD SegCs; } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
DWORD EFlags;
DWORD Esp; typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,PVOID);
DWORD SegSs; typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,PVOID);
BYTE ExtendedRegisters[WOW64_MAXIMUM_SUPPORTED_EXTENSION];
} WOW64_CONTEXT, *PWOW64_CONTEXT; #define UNW_FLAG_NHANDLER 0
#include "poppack.h" #define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#define UNW_FLAG_CHAININFO 4
#elif defined(__arm__)
#define UNWIND_HISTORY_TABLE_SIZE 12
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
typedef struct _UNWIND_HISTORY_TABLE
{
DWORD Count;
BYTE LocalHint;
BYTE GlobalHint;
BYTE Search;
BYTE Once;
DWORD LowAddress;
DWORD HighAddress;
UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
typedef struct _DISPATCHER_CONTEXT
{
DWORD ControlPc;
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
DWORD EstablisherFrame;
DWORD TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
DWORD Reserved;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD);
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#elif defined(__aarch64__)
#define UNWIND_HISTORY_TABLE_SIZE 12
typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
DWORD64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
typedef struct _UNWIND_HISTORY_TABLE
{
DWORD Count;
BYTE LocalHint;
BYTE GlobalHint;
BYTE Search;
BYTE Once;
DWORD64 LowAddress;
DWORD64 HighAddress;
UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
typedef struct _DISPATCHER_CONTEXT
{
ULONG_PTR ControlPc;
ULONG_PTR ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG_PTR EstablisherFrame;
ULONG_PTR TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD64);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD64);
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
#endif /* __aarch64__ */
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
...@@ -1835,6 +1829,8 @@ NTSYSAPI void WINAPI RtlGrowFunctionTable(void*,DWORD); ...@@ -1835,6 +1829,8 @@ NTSYSAPI void WINAPI RtlGrowFunctionTable(void*,DWORD);
NTSYSAPI BOOLEAN CDECL RtlInstallFunctionTableCallback(DWORD_PTR,DWORD_PTR,DWORD,PGET_RUNTIME_FUNCTION_CALLBACK,PVOID,PCWSTR); NTSYSAPI BOOLEAN CDECL RtlInstallFunctionTableCallback(DWORD_PTR,DWORD_PTR,DWORD,PGET_RUNTIME_FUNCTION_CALLBACK,PVOID,PCWSTR);
NTSYSAPI PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD_PTR,DWORD_PTR*,UNWIND_HISTORY_TABLE*); NTSYSAPI PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD_PTR,DWORD_PTR*,UNWIND_HISTORY_TABLE*);
NTSYSAPI void WINAPI RtlUnwindEx(PVOID,PVOID,struct _EXCEPTION_RECORD*,PVOID,CONTEXT*,UNWIND_HISTORY_TABLE*); NTSYSAPI void WINAPI RtlUnwindEx(PVOID,PVOID,struct _EXCEPTION_RECORD*,PVOID,CONTEXT*,UNWIND_HISTORY_TABLE*);
NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,ULONG_PTR,ULONG_PTR,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG_PTR*,KNONVOLATILE_CONTEXT_POINTERS*);
#endif #endif
/* /*
......
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