mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 07:36:21 +00:00
- Add KCALLOUT_FRAME to define the kernel callback stack layout during user mode callbacks. Define the NextCallback and FramePointer members of the debugger data block more portably with this.
- AMD64's is a copy of x86's to match asm.h's the assembly offsets. ARM's is a stub containing two necessary members to have some offsets for the debugger data block. - Add ARM stub for KiCallUserMode as this is referenced from the debugger data block. svn path=/trunk/; revision=44063
This commit is contained in:
parent
ccd3b00fd2
commit
b4835e6bad
7 changed files with 54 additions and 7 deletions
|
@ -255,7 +255,6 @@ Author:
|
|||
#define CBSTACK_RBP 0x18
|
||||
#define CBSTACK_RESULT 0x20
|
||||
#define CBSTACK_RESULT_LENGTH 0x28
|
||||
#define CBSTACK_FRAME_POINTER CBSTACK_RBP
|
||||
|
||||
|
||||
/* Following ones are ASM only! ***********************************************/
|
||||
|
|
|
@ -231,6 +231,23 @@ typedef struct _KTRAP_FRAME
|
|||
LONG CodePatchCycle;
|
||||
} KTRAP_FRAME, *PKTRAP_FRAME;
|
||||
|
||||
//
|
||||
// Defines the Callback Stack Layout for User Mode Callbacks
|
||||
//
|
||||
typedef struct _KCALLOUT_FRAME
|
||||
{
|
||||
ULONG64 InitialStack;
|
||||
ULONG64 TrapFrame;
|
||||
ULONG64 CallbackStack;
|
||||
ULONG64 Rdi;
|
||||
ULONG64 Rsi;
|
||||
ULONG64 Rbx;
|
||||
ULONG64 Rbp;
|
||||
ULONG64 ReturnAddress;
|
||||
ULONG64 Result;
|
||||
ULONG64 ResultLength;
|
||||
} KCALLOUT_FRAME, *PKCALLOUT_FRAME;
|
||||
|
||||
//
|
||||
// Dummy LDT_ENTRY
|
||||
//
|
||||
|
|
|
@ -84,6 +84,17 @@ typedef struct _KTRAP_FRAME
|
|||
ULONG PreviousTrapFrame;
|
||||
} KTRAP_FRAME, *PKTRAP_FRAME;
|
||||
|
||||
//
|
||||
// Defines the Callback Stack Layout for User Mode Callbacks
|
||||
//
|
||||
// Just a stub with some required members for now
|
||||
//
|
||||
typedef struct _KCALLOUT_FRAME
|
||||
{
|
||||
ULONG CallbackStack;
|
||||
ULONG DummyFramePointer;
|
||||
} KCALLOUT_FRAME, *PKCALLOUT_FRAME;
|
||||
|
||||
#ifndef NTOS_MODE_USER
|
||||
|
||||
//
|
||||
|
|
|
@ -534,7 +534,6 @@ Author:
|
|||
#define CBSTACK_EBP 0x18
|
||||
#define CBSTACK_RESULT 0x20
|
||||
#define CBSTACK_RESULT_LENGTH 0x24
|
||||
#define CBSTACK_FRAME_POINTER CBSTACK_EBP
|
||||
|
||||
//
|
||||
// NTSTATUS, Bugcheck Codes and Debug Codes
|
||||
|
|
|
@ -201,6 +201,23 @@ typedef struct _KTRAP_FRAME
|
|||
ULONG V86Gs;
|
||||
} KTRAP_FRAME, *PKTRAP_FRAME;
|
||||
|
||||
//
|
||||
// Defines the Callback Stack Layout for User Mode Callbacks
|
||||
//
|
||||
typedef struct _KCALLOUT_FRAME
|
||||
{
|
||||
ULONG InitialStack;
|
||||
ULONG TrapFrame;
|
||||
ULONG CallbackStack;
|
||||
ULONG Edi;
|
||||
ULONG Esi;
|
||||
ULONG Ebx;
|
||||
ULONG Ebp;
|
||||
ULONG ReturnAddress;
|
||||
ULONG Result;
|
||||
ULONG ResultLength;
|
||||
} KCALLOUT_FRAME, *PKCALLOUT_FRAME;
|
||||
|
||||
//
|
||||
// LDT Entry Definition
|
||||
//
|
||||
|
|
|
@ -30,6 +30,7 @@ VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
|
|||
#define KPCR_INITIAL_STACK_OFFSET 0
|
||||
#define KPCR_STACK_LIMIT_OFFSET 0
|
||||
#define KPRCB_PCR_PAGE_OFFSET 0
|
||||
#define CBSTACK_FRAME_POINTER Ebp
|
||||
|
||||
#elif defined(_AMD64_)
|
||||
|
||||
|
@ -39,6 +40,7 @@ VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
|
|||
#define KPCR_INITIAL_STACK_OFFSET 0
|
||||
#define KPCR_STACK_LIMIT_OFFSET 0
|
||||
#define KPRCB_PCR_PAGE_OFFSET 0
|
||||
#define CBSTACK_FRAME_POINTER Rbp
|
||||
|
||||
#elif defined(_ARM_)
|
||||
|
||||
|
@ -48,6 +50,7 @@ VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
|
|||
#define KPCR_INITIAL_STACK_OFFSET FIELD_OFFSET(KPCR, InitialStack)
|
||||
#define KPCR_STACK_LIMIT_OFFSET FIELD_OFFSET(KPCR, StackLimit)
|
||||
#define KPRCB_PCR_PAGE_OFFSET FIELD_OFFSET(KPRCB, PcrPage)
|
||||
#define CBSTACK_FRAME_POINTER DummyFramePointer
|
||||
|
||||
#else
|
||||
#error Unsupported Architecture
|
||||
|
@ -392,8 +395,8 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock =
|
|||
{(ULONG_PTR)RtlpBreakWithStatusInstruction},
|
||||
0,
|
||||
FIELD_OFFSET(KTHREAD, CallbackStack),
|
||||
CBSTACK_CALLBACK_STACK,
|
||||
CBSTACK_FRAME_POINTER,
|
||||
FIELD_OFFSET(KCALLOUT_FRAME, CallbackStack),
|
||||
FIELD_OFFSET(KCALLOUT_FRAME, CBSTACK_FRAME_POINTER),
|
||||
FALSE,
|
||||
{(ULONG_PTR)KiCallUserMode},
|
||||
0,
|
||||
|
@ -505,7 +508,7 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock =
|
|||
KPCR_STACK_LIMIT_OFFSET,
|
||||
KPRCB_PCR_PAGE_OFFSET,
|
||||
FIELD_OFFSET(KPRCB, ProcessorState.SpecialRegisters),
|
||||
#if defined(_M_IX86)
|
||||
#if defined(_X86_)
|
||||
//
|
||||
// x86 GDT/LDT/TSS constants
|
||||
//
|
||||
|
@ -519,7 +522,7 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock =
|
|||
KGDT_TSS,
|
||||
0,
|
||||
0,
|
||||
#elif defined(_M_AMD64)
|
||||
#elif defined(_AMD64_)
|
||||
//
|
||||
// AMD64 GDT/LDT/TSS constants
|
||||
//
|
||||
|
|
|
@ -34,6 +34,7 @@ GENERATE_ARM_STUB KeSynchronizeExecution
|
|||
GENERATE_ARM_STUB KeSwitchKernelStack
|
||||
GENERATE_ARM_STUB RtlCreateUserThread
|
||||
GENERATE_ARM_STUB RtlInitializeContext
|
||||
GENERATE_ARM_STUB KeUserModeCallback
|
||||
GENERATE_ARM_STUB KeUserModeCallback
|
||||
GENERATE_ARM_STUB KiCallUserMode
|
||||
GENERATE_ARM_STUB NtCallbackReturn
|
||||
GENERATE_ARM_STUB NtContinue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue