Author: sginsberg
Date: Tue Nov 10 00:19:03 2009
New Revision: 44063
URL:
http://svn.reactos.org/svn/reactos?rev=44063&view=rev
Log:
- 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.
Modified:
trunk/reactos/include/ndk/amd64/asm.h
trunk/reactos/include/ndk/amd64/ketypes.h
trunk/reactos/include/ndk/arm/ketypes.h
trunk/reactos/include/ndk/i386/asm.h
trunk/reactos/include/ndk/i386/ketypes.h
trunk/reactos/ntoskrnl/kd64/kddata.c
trunk/reactos/ntoskrnl/ke/arm/stubs_asm.s
Modified: trunk/reactos/include/ndk/amd64/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/asm.h?re…
==============================================================================
--- trunk/reactos/include/ndk/amd64/asm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/asm.h [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -255,7 +255,6 @@
#define CBSTACK_RBP 0x18
#define CBSTACK_RESULT 0x20
#define CBSTACK_RESULT_LENGTH 0x28
-#define CBSTACK_FRAME_POINTER CBSTACK_RBP
/* Following ones are ASM only! ***********************************************/
Modified: trunk/reactos/include/ndk/amd64/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/ketypes.…
==============================================================================
--- trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -230,6 +230,23 @@
USHORT Fill3;
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
Modified: trunk/reactos/include/ndk/arm/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/arm/ketypes.h?…
==============================================================================
--- trunk/reactos/include/ndk/arm/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/arm/ketypes.h [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -83,6 +83,17 @@
ULONG PreviousMode;
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
Modified: trunk/reactos/include/ndk/i386/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/asm.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/i386/asm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/i386/asm.h [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -534,7 +534,6 @@
#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
Modified: trunk/reactos/include/ndk/i386/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h…
==============================================================================
--- trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -200,6 +200,23 @@
ULONG V86Fs;
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
Modified: trunk/reactos/ntoskrnl/kd64/kddata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kddata.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -30,6 +30,7 @@
#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 @@
#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 @@
#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 @@
{(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 @@
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 @@
KGDT_TSS,
0,
0,
-#elif defined(_M_AMD64)
+#elif defined(_AMD64_)
//
// AMD64 GDT/LDT/TSS constants
//
Modified: trunk/reactos/ntoskrnl/ke/arm/stubs_asm.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/stubs_asm.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/stubs_asm.s [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/stubs_asm.s [iso-8859-1] Tue Nov 10 00:19:03 2009
@@ -34,6 +34,7 @@
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