https://git.reactos.org/?p=reactos.git;a=commitdiff;h=04fe6665906bf8e63a267…
commit 04fe6665906bf8e63a2677bc585ec564d50eb286
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Jul 19 08:05:31 2022 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Wed Jul 20 23:57:42 2022 +0200
[NDK] Add missing x64 unwind definitions
---
ntoskrnl/rtl/libsupp.c | 2 --
sdk/include/ndk/ketypes.h | 4 +--
sdk/include/ndk/rtlfuncs.h | 27 +++++++++++++++
sdk/include/ndk/rtltypes.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 112 insertions(+), 5 deletions(-)
diff --git a/ntoskrnl/rtl/libsupp.c b/ntoskrnl/rtl/libsupp.c
index 173944a0573..66ae4254a73 100644
--- a/ntoskrnl/rtl/libsupp.c
+++ b/ntoskrnl/rtl/libsupp.c
@@ -825,8 +825,6 @@ RtlCallVectoredContinueHandlers(_In_ PEXCEPTION_RECORD
ExceptionRecord,
#ifdef _M_AMD64
-typedef PVOID PRUNTIME_FUNCTION, PUNWIND_HISTORY_TABLE;
-
PRUNTIME_FUNCTION
NTAPI
RtlpLookupDynamicFunctionEntry(
diff --git a/sdk/include/ndk/ketypes.h b/sdk/include/ndk/ketypes.h
index 6556de0d737..d54b9ffa131 100644
--- a/sdk/include/ndk/ketypes.h
+++ b/sdk/include/ndk/ketypes.h
@@ -820,7 +820,6 @@ typedef struct _PP_LOOKASIDE_LIST
//
// Kernel Memory Node
//
-#include <pshpack1.h>
typedef struct _KNODE
{
SLIST_HEADER DeadStackList;
@@ -834,10 +833,9 @@ typedef struct _KNODE
UCHAR Fill : 7;
} Flags;
ULONG MmShiftedColor;
- ULONG FreeCount[2];
+ ULONG_PTR FreeCount[2];
struct _SINGLE_LIST_ENTRY *PfnDeferredList;
} KNODE, *PKNODE;
-#include <poppack.h>
//
// Structure for Get/SetContext APC
diff --git a/sdk/include/ndk/rtlfuncs.h b/sdk/include/ndk/rtlfuncs.h
index ffc3bb1bcae..c6bdcfcdd19 100644
--- a/sdk/include/ndk/rtlfuncs.h
+++ b/sdk/include/ndk/rtlfuncs.h
@@ -807,6 +807,33 @@ RtlUnwind(
#define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8
+#ifdef _M_AMD64
+
+NTSYSAPI
+PRUNTIME_FUNCTION
+NTAPI
+RtlLookupFunctionEntry(
+ _In_ DWORD64 ControlPc,
+ _Out_ PDWORD64 ImageBase,
+ _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable
+);
+
+NTSYSAPI
+PEXCEPTION_ROUTINE
+NTAPI
+RtlVirtualUnwind(
+ _In_ ULONG HandlerType,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ PRUNTIME_FUNCTION FunctionEntry,
+ _Inout_ PCONTEXT Context,
+ _Outptr_ PVOID* HandlerData,
+ _Out_ PULONG64 EstablisherFrame,
+ _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
+);
+
+#endif // _M_AMD64
+
//
// Tracing Functions
//
diff --git a/sdk/include/ndk/rtltypes.h b/sdk/include/ndk/rtltypes.h
index 03ac5156214..369d52cd297 100644
--- a/sdk/include/ndk/rtltypes.h
+++ b/sdk/include/ndk/rtltypes.h
@@ -1912,6 +1912,90 @@ typedef struct _MESSAGE_RESOURCE_DATA
MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY];
} MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA;
+#ifdef _M_AMD64
+
+typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
+ union {
+ PM128A FloatingContext[16];
+ struct {
+ PM128A Xmm0;
+ PM128A Xmm1;
+ PM128A Xmm2;
+ PM128A Xmm3;
+ PM128A Xmm4;
+ PM128A Xmm5;
+ PM128A Xmm6;
+ PM128A Xmm7;
+ PM128A Xmm8;
+ PM128A Xmm9;
+ PM128A Xmm10;
+ PM128A Xmm11;
+ PM128A Xmm12;
+ PM128A Xmm13;
+ PM128A Xmm14;
+ PM128A Xmm15;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+
+ union {
+ PULONG64 IntegerContext[16];
+ struct {
+ PULONG64 Rax;
+ PULONG64 Rcx;
+ PULONG64 Rdx;
+ PULONG64 Rbx;
+ PULONG64 Rsp;
+ PULONG64 Rbp;
+ PULONG64 Rsi;
+ PULONG64 Rdi;
+ PULONG64 R8;
+ PULONG64 R9;
+ PULONG64 R10;
+ PULONG64 R11;
+ PULONG64 R12;
+ PULONG64 R13;
+ PULONG64 R14;
+ PULONG64 R15;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME2;
+} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
+
+#define UNW_FLAG_NHANDLER 0x0
+#define UNW_FLAG_EHANDLER 0x1
+#define UNW_FLAG_UHANDLER 0x2
+#define UNW_FLAG_CHAININFO 0x4
+#define UNW_FLAG_NO_EPILOGUE 0x80000000UL
+
+#define RUNTIME_FUNCTION_INDIRECT 0x1
+
+typedef struct _RUNTIME_FUNCTION {
+ ULONG BeginAddress;
+ ULONG EndAddress;
+ ULONG 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;
+
+typedef struct _UNWIND_HISTORY_TABLE
+{
+ ULONG Count;
+ UCHAR LocalHint;
+ UCHAR GlobalHint;
+ UCHAR Search;
+ UCHAR Once;
+ ULONG64 LowAddress;
+ ULONG64 HighAddress;
+ UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
+} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
+
+#endif /* _M_AMD64 */
+
#endif /* !NTOS_MODE_USER */
#ifdef NTOS_MODE_USER