[NDK] Add missing x64 unwind definitions

This commit is contained in:
Timo Kreuzer 2022-07-19 08:05:31 +02:00
parent 2881b77302
commit 04fe666590
4 changed files with 112 additions and 5 deletions

View file

@ -825,8 +825,6 @@ RtlCallVectoredContinueHandlers(_In_ PEXCEPTION_RECORD ExceptionRecord,
#ifdef _M_AMD64
typedef PVOID PRUNTIME_FUNCTION, PUNWIND_HISTORY_TABLE;
PRUNTIME_FUNCTION
NTAPI
RtlpLookupDynamicFunctionEntry(

View file

@ -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

View file

@ -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
//

View file

@ -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