Author: sginsberg
Date: Sun Oct 4 18:53:15 2009
New Revision: 43283
URL:
http://svn.reactos.org/svn/reactos?rev=43283&view=rev
Log:
Mega KD64 revival patch:
KD64
- Fix some 64-bit issues and some x86 specificness.
- Sub out some KdpTrap cases more properly.
- Implement support for .crash and .reboot. Does not seem to work currently because of
weird issues.
- Implement KdpDprintf to send strings directly to the debugger from inside of KD64. Use
it in KdEnterDebugger instead of DbgPrint so we won't try to enter the debugger
recursively.
- Implement KdUpdateDataBlock to set the KeUserCallbackDispatcher pointer in the debugger
block after its address is retrieved from ntdll.
- Don't assume breakpoints are 1 byte long in portable code -- use KD_BREAKPOINT_SIZE
and define it per architecture.
- KdpStub: KdEnableDebugger returns NTSTATUS, not TRUE/FALSE.
Other
- wdbgexts.h: Properly define CURRENT_KD_SECONDARY_VERSION for AMD64.
- Make PsNtosImageBase pointer-sized as it should be.
- Change the definition of KDSTATUS so it is guaranteed to be 32-bit.
- Fix a critical bug in KiRestoreProcessorControlState: it didn't clear the busy flag
in the TSS before reloading the task register, resulting in a GPF if we tried to reload
the same register.
- Add macros for getting and setting special purpose registers (the Program Counter and
the "return register") in portable code instead of using #ifdef every time. Do
likewise for setting IMAGE_FILE_MACHINE_XXX, using a new IMAGE_FILE_MACHINE_ARCHITECTURE
macro.
- Don't refer to the Program Counter as "Eip" in portable code.
- Define DBG_STATUS_CONTROL_C for assembly code and use it in KeUpdateSystemTime.
Modified:
trunk/reactos/include/ndk/asm.h
trunk/reactos/include/psdk/wdbgexts.h
trunk/reactos/include/reactos/kddll.h
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/include/internal/kd64.h
trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h
trunk/reactos/ntoskrnl/include/internal/ps.h
trunk/reactos/ntoskrnl/kd/kdmain.c
trunk/reactos/ntoskrnl/kd64/kdapi.c
trunk/reactos/ntoskrnl/kd64/kddata.c
trunk/reactos/ntoskrnl/kd64/kdinit.c
trunk/reactos/ntoskrnl/kd64/kdprint.c
trunk/reactos/ntoskrnl/kd64/kdtrap.c
trunk/reactos/ntoskrnl/ke/bug.c
trunk/reactos/ntoskrnl/ke/i386/cpu.c
trunk/reactos/ntoskrnl/ke/i386/systimer.S
trunk/reactos/ntoskrnl/ke/profobj.c
trunk/reactos/ntoskrnl/mm/sysldr.c
trunk/reactos/ntoskrnl/ps/psmgr.c
trunk/reactos/ntoskrnl/ps/thread.c
trunk/reactos/ntoskrnl/rtl/libsupp.c
Modified: trunk/reactos/include/ndk/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=4328…
==============================================================================
--- trunk/reactos/include/ndk/asm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/asm.h [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -523,7 +523,7 @@
#define CBSTACK_RESULT_LENGTH 0x24
//
-// NTSTATUS and Bugcheck Codes
+// NTSTATUS, Bugcheck Codes and Debug Codes
//
#ifdef __ASM__
#define STATUS_ACCESS_VIOLATION 0xC0000005
@@ -560,6 +560,7 @@
#define UNEXPECTED_KERNEL_MODE_TRAP 0x7F
#define ATTEMPTED_SWITCH_FROM_DPC 0xB8
#define HARDWARE_INTERRUPT_STORM 0xF2
+#define DBG_STATUS_CONTROL_C 0x01
//
// IRQL Levels
Modified: trunk/reactos/include/psdk/wdbgexts.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wdbgexts.h?re…
==============================================================================
--- trunk/reactos/include/psdk/wdbgexts.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/wdbgexts.h [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -11,7 +11,12 @@
#define KD_SECONDARY_VERSION_AMD64_OBSOLETE_CONTEXT_1 0
#define KD_SECONDARY_VERSION_AMD64_OBSOLETE_CONTEXT_2 1
#define KD_SECONDARY_VERSION_AMD64_CONTEXT 2
+
+#if defined(_AMD64_)
+#define CURRENT_KD_SECONDARY_VERSION
KD_SECONDARY_VERSION_AMD64_CONTEXT
+#else
#define CURRENT_KD_SECONDARY_VERSION KD_SECONDARY_VERSION_DEFAULT
+#endif
#define DBGKD_VERS_FLAG_MP 0x0001
#define DBGKD_VERS_FLAG_DATA 0x0002
@@ -159,7 +164,7 @@
USHORT FramePointer;
USHORT PaeEnabled:1;
GCC_ULONG64 KiCallUserMode;
- GCC_ULONG64 KeUserCallbackDispatcher;
+ ULONG64 KeUserCallbackDispatcher;
GCC_ULONG64 PsLoadedModuleList;
GCC_ULONG64 PsActiveProcessHead;
GCC_ULONG64 PspCidTable;
Modified: trunk/reactos/include/reactos/kddll.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/kddll.h?re…
==============================================================================
--- trunk/reactos/include/reactos/kddll.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/kddll.h [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -1,12 +1,10 @@
#ifndef _KDDLL_
#define _KDDLL_
-typedef enum _KDSTATUS
-{
- KdPacketReceived = 0,
- KdPacketTimedOut,
- KdPacketNeedsResend
-} KDSTATUS;
+typedef ULONG KDSTATUS;
+#define KdPacketReceived 0
+#define KdPacketTimedOut 1
+#define KdPacketNeedsResend 2
NTSTATUS
NTAPI
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=432…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -1226,21 +1226,8 @@
SharedUserData->NtMinorVersion = NtMinorVersion;
/* Set the machine type */
-#if defined(_X86_)
- SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_I386;
- SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_I386;
-#elif defined(_PPC_) // <3 Arty
- SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_POWERPC;
- SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_POWERPC;
-#elif defined(_MIPS_)
- SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_R4000;
- SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_R4000;
-#elif defined(_ARM_)
- SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_ARM;
- SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_ARM;
-#else
-#error "Unsupported ReactOS Target"
-#endif
+ SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_ARCHITECTURE;
+ SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_ARCHITECTURE;
}
VOID
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] Sun Oct 4 18:53:15
2009
@@ -6,6 +6,31 @@
//
#define PCR_ENTRY 0
#define PDR_ENTRY 2
+
+#define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_ARM
+
+//
+// BKPT is 4 bytes long
+//
+#define KD_BREAKPOINT_SIZE 4
+
+//
+// Macros for getting and setting special purpose registers in portable code
+//
+#define KeGetContextPc(Context) \
+ ((Context)->Pc)
+
+#define KeSetContextPc(Context, ProgramCounter) \
+ ((Context)->Pc = (ProgramCounter))
+
+#define KeGetTrapFramePc(TrapFrame) \
+ ((TrapFrame)->Pc)
+
+#define KeGetContextReturnRegister(Context) \
+ ((Context)->R0)
+
+#define KeSetContextReturnRegister(Context, ReturnValue) \
+ ((Context)->R0 = (ReturnValue))
VOID
KiPassiveRelease(
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Sun Oct 4 18:53:15
2009
@@ -7,6 +7,31 @@
#include "v86m.h"
extern ULONG Ke386CacheAlignment;
+
+#define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_I386
+
+//
+// INT3 is 1 byte long
+//
+#define KD_BREAKPOINT_SIZE 1
+
+//
+// Macros for getting and setting special purpose registers in portable code
+//
+#define KeGetContextPc(Context) \
+ ((Context)->Eip)
+
+#define KeSetContextPc(Context, ProgramCounter) \
+ ((Context)->Eip = (ProgramCounter))
+
+#define KeGetTrapFramePc(TrapFrame) \
+ ((TrapFrame)->Eip)
+
+#define KeGetContextReturnRegister(Context) \
+ ((Context)->Eax)
+
+#define KeSetContextReturnRegister(Context, ReturnValue) \
+ ((Context)->Eax = (ReturnValue))
VOID
FASTCALL
Modified: trunk/reactos/ntoskrnl/include/internal/kd64.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -60,20 +60,15 @@
PLOADER_PARAMETER_BLOCK LoaderBlock
);
-//
-// Debug and Multi-Processor Switch Routines
-//
-BOOLEAN
-NTAPI
-KdpEnterDebuggerException(
- IN PKTRAP_FRAME TrapFrame,
- IN PKEXCEPTION_FRAME ExceptionFrame,
- IN PEXCEPTION_RECORD ExceptionRecord,
- IN PCONTEXT Context,
- IN KPROCESSOR_MODE PreviousMode,
- IN BOOLEAN SecondChance
-);
-
+VOID
+NTAPI
+KdUpdateDataBlock(
+ VOID
+);
+
+//
+// Multi-Processor Switch Support
+//
BOOLEAN
NTAPI
KdpSwitchProcessor(
@@ -171,25 +166,48 @@
//
// Debug Event Handlers
//
-ULONG
+NTSTATUS
NTAPI
KdpPrint(
IN ULONG ComponentId,
IN ULONG ComponentMask,
IN LPSTR String,
- IN ULONG Length,
+ IN USHORT Length,
IN KPROCESSOR_MODE PreviousMode,
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame,
OUT PBOOLEAN Status
);
-ULONG
+BOOLEAN
+NTAPI
+KdpPrompt(
+ IN LPSTR InString,
+ IN USHORT InStringLength,
+ OUT LPSTR OutString,
+ IN USHORT OutStringLength,
+ IN KPROCESSOR_MODE PreviousMode,
+ IN PKTRAP_FRAME TrapFrame,
+ IN PKEXCEPTION_FRAME ExceptionFrame
+);
+
+VOID
NTAPI
KdpSymbol(
IN PSTRING DllPath,
IN PKD_SYMBOLS_INFO DllBase,
IN BOOLEAN Unload,
+ IN KPROCESSOR_MODE PreviousMode,
+ IN PCONTEXT ContextRecord,
+ IN PKTRAP_FRAME TrapFrame,
+ IN PKEXCEPTION_FRAME ExceptionFrame
+);
+
+VOID
+NTAPI
+KdpCommandString(
+ IN ULONG Length,
+ IN LPSTR String,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
IN PKTRAP_FRAME TrapFrame,
@@ -242,6 +260,16 @@
NTAPI
KdpAddBreakpoint(
IN PVOID Address
+);
+
+//
+// Internal routine for sending strings directly to the debugger
+//
+VOID
+__cdecl
+KdpDprintf(
+ IN PCHAR Format,
+ ...
);
//
Modified: trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h [iso-8859-1] Sun Oct 4 18:53:15
2009
@@ -35,6 +35,26 @@
extern ULONG KePPCCacheAlignment;
+#define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_POWERPC
+
+//
+// Macros for getting and setting special purpose registers in portable code
+//
+#define KeGetContextPc(Context) \
+ ((Context)->Dr0)
+
+#define KeSetContextPc(Context, ProgramCounter) \
+ ((Context)->Dr0 = (ProgramCounter))
+
+#define KeGetTrapFramePc(TrapFrame) \
+ ((TrapFrame)->Dr0)
+
+#define KeGetContextReturnRegister(Context) \
+ ((Context)->Gpr3)
+
+#define KeSetContextReturnRegister(Context, ReturnValue) \
+ ((Context)->Gpr3 = (ReturnValue))
+
#define KePPCRdmsr(msr,val1,val2) __asm__ __volatile__("mfmsr 3")
#define KePPCWrmsr(msr,val1,val2) __asm__ __volatile__("mtmsr 3")
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ps.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -423,7 +423,7 @@
extern LARGE_INTEGER ShortPsLockDelay;
extern UNICODE_STRING PsNtDllPathName;
extern LIST_ENTRY PsLoadedModuleList;
-extern ULONG PsNtosImageBase;
+extern ULONG_PTR PsNtosImageBase;
//
// Inlined Functions
Modified: trunk/reactos/ntoskrnl/kd/kdmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdmain.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -106,9 +106,6 @@
{
KD_CONTINUE_TYPE Return = kdHandleException;
ULONG ExceptionCommand = ExceptionRecord->ExceptionInformation[0];
-#ifdef _M_IX86
- ULONG EipOld;
-#endif
/* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
@@ -125,13 +122,9 @@
KdpServiceDispatcher(BREAKPOINT_PRINT,
(PVOID)ExceptionRecord->ExceptionInformation[1],
ExceptionRecord->ExceptionInformation[2]);
-#ifdef _M_IX86
- Context->Eax = STATUS_SUCCESS;
-#elif _M_ARM
- Context->R0 = STATUS_SUCCESS;
-#else
-#error Please be portable when modifying code
-#endif
+
+ /* Return success */
+ KeSetContextReturnRegister(Context, STATUS_SUCCESS);
}
else if (ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS)
{
@@ -144,22 +137,13 @@
#endif
}
- /* This we can handle: simply bump EIP */
-#ifdef _M_IX86
- Context->Eip++;
-#elif _M_ARM
- Context->Pc += sizeof(ULONG);
-#endif
+ /* This we can handle: simply bump the Program Counter */
+ KeSetContextPc(Context, KeGetContextPc(Context) + KD_BREAKPOINT_SIZE);
return TRUE;
}
/* Get out of here if the Debugger isn't connected */
if (KdDebuggerNotPresent) return FALSE;
-
- /* Save old EIP value */
-#ifdef _M_IX86
- EipOld = Context->Eip;
-#endif
#ifdef KDBG
/* Call KDBG if available */
@@ -177,12 +161,6 @@
TrapFrame);
}
#endif /* not KDBG */
-
- /* Bump EIP over int 3 if debugger did not already change it */
- if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT)
- {
- //DPRINT1("Address: %p. Return: %d\n", EipOld, Return);
- }
/* Debugger didn't handle it, please handle! */
if (Return == kdHandleException) return FALSE;
Modified: trunk/reactos/ntoskrnl/kd64/kdapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdapi.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -172,8 +172,8 @@
WaitStateChange->ProcessorLevel = KeProcessorLevel;
WaitStateChange->Processor = (USHORT)KeGetCurrentPrcb()->Number;
WaitStateChange->NumberProcessors = (ULONG)KeNumberProcessors;
- WaitStateChange->Thread = (ULONG)(LONG_PTR)KeGetCurrentThread();
- WaitStateChange->ProgramCounter = (ULONG)(LONG_PTR)Context->Eip;
+ WaitStateChange->Thread = (ULONG64)(LONG_PTR)KeGetCurrentThread();
+ WaitStateChange->ProgramCounter = (ULONG64)(LONG_PTR)KeGetContextPc(Context);
/* Zero out the Control Report */
RtlZeroMemory(&WaitStateChange->ControlReport,
@@ -189,7 +189,7 @@
/* Clear all the breakpoints in this region */
HadBreakpoints =
KdpDeleteBreakpointRange((PVOID)(LONG_PTR)WaitStateChange->ProgramCounter,
- (PVOID)((ULONG)WaitStateChange->ProgramCounter +
+ (PVOID)((ULONG_PTR)WaitStateChange->ProgramCounter +
WaitStateChange->ControlReport.InstructionCount - 1));
if (HadBreakpoints)
{
@@ -555,6 +555,14 @@
&Header,
Data,
&KdpContext);
+}
+
+VOID
+NTAPI
+KdpCauseBugCheck(IN PDBGKD_MANIPULATE_STATE64 State)
+{
+ /* Crash with the special code */
+ KeBugCheck(MANUALLY_INITIATED_CRASH);
}
KCONTINUE_STATUS
@@ -636,7 +644,7 @@
case DbgKdRestoreBreakPointApi:
- /* FIXME: TODO */
+ /* Restore the breakpoint */
KdpRestoreBreakpoint(&ManipulateState, &Data, Context);
break;
@@ -653,7 +661,7 @@
case DbgKdWriteControlSpaceApi:
- /* FIXME: TODO */
+ /* Write control space */
KdpWriteControlSpace(&ManipulateState, &Data, Context);
break;
@@ -673,9 +681,8 @@
case DbgKdRebootApi:
- /* FIXME: TODO */
- Ke386SetCr2(DbgKdRebootApi);
- while (TRUE);
+ /* Reboot the system */
+ HalReturnToFirmware(HalRebootRoutine);
break;
case DbgKdContinueApi2:
@@ -780,9 +787,8 @@
case DbgKdCauseBugCheckApi:
- /* FIXME: TODO */
- Ke386SetCr2(DbgKdCauseBugCheckApi);
- while (TRUE);
+ /* Crash the system */
+ KdpCauseBugCheck(&ManipulateState);
break;
case DbgKdSwitchProcessor:
@@ -956,7 +962,7 @@
&Header,
ExtraData,
Context);
- } while(Status == ContinueProcessorReselected);
+ } while (Status == ContinueProcessorReselected);
/* Return status */
return Status;
@@ -998,7 +1004,7 @@
&Header,
&Data,
Context);
- } while (Status == KdPacketNeedsResend);
+ } while (Status == ContinueProcessorReselected);
/* Return */
return Status;
@@ -1126,18 +1132,18 @@
if (KiFreezeFlag & 1)
{
/* Print out errror */
- DbgPrint("FreezeLock was jammed! Backup SpinLock was used!\n");
+ KdpDprintf("FreezeLock was jammed! Backup SpinLock was used!\n");
}
/* Check processor state */
if (KiFreezeFlag & 2)
{
/* Print out errror */
- DbgPrint("Some processors not frozen in debugger!\n");
+ KdpDprintf("Some processors not frozen in debugger!\n");
}
/* Make sure we acquired the port */
- if (!KdpPortLocked) DbgPrint("Port lock was not acquired!\n");
+ if (!KdpPortLocked) KdpDprintf("Port lock was not acquired!\n");
/* Return enter state */
return Entered;
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] Sun Oct 4 18:53:15 2009
@@ -48,7 +48,11 @@
// Breakpoint Data
//
BREAKPOINT_ENTRY KdpBreakpointTable[20];
-ULONG KdpBreakpointInstruction = 0xCC;
+#if defined(_M_IX86) || defined(_M_AMD64)
+ULONG KdpBreakpointInstruction = 0xCC; // INT3
+#else
+#error TODO
+#endif
BOOLEAN KdpOweBreakpoint;
BOOLEAN BreakpointsSuspended;
ULONG KdpNumInternalBreakpoints;
@@ -326,15 +330,7 @@
DBGKD_64BIT_PROTOCOL_VERSION2,
KD_SECONDARY_VERSION_DEFAULT,
DBGKD_VERS_FLAG_DATA,
-#if defined(_M_IX86)
- IMAGE_FILE_MACHINE_I386,
-#elif defined(_M_PPC)
- IMAGE_FILE_MACHINE_POWERPC,
-#elif defined(_M_MIPS)
- IMAGE_FILE_MACHINE_R4000,
-#else
-#error Unknown platform
-#endif
+ IMAGE_FILE_MACHINE_ARCHITECTURE,
PACKET_TYPE_MAX,
0,
0,
@@ -353,9 +349,9 @@
FIELD_OFFSET(KTHREAD, CallbackStack),
CBSTACK_CALLBACK_STACK,
CBSTACK_EBP,
- 0,
+ FALSE,
{PtrToUlong(KiCallUserMode)},
- {0},
+ 0,
{PtrToUlong(&PsLoadedModuleList)},
{PtrToUlong(&PsActiveProcessHead)},
{PtrToUlong(&PspCidTable)},
Modified: trunk/reactos/ntoskrnl/kd64/kdinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdinit.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -13,6 +13,15 @@
#include <debug.h>
/* FUNCTIONS *****************************************************************/
+
+VOID
+NTAPI
+KdUpdateDataBlock(VOID)
+{
+ /* Update the KeUserCallbackDispatcher pointer */
+ KdDebuggerDataBlock.KeUserCallbackDispatcher =
+ (ULONG64)(LONG_PTR)KeUserCallbackDispatcher;
+}
BOOLEAN
NTAPI
@@ -133,7 +142,7 @@
InLoadOrderLinks);
/* Save the Kernel Base */
- PsNtosImageBase = (ULONG)LdrEntry->DllBase;
+ PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase;
KdVersionBlock.KernBase = (ULONGLONG)(LONG_PTR)LdrEntry->DllBase;
/* Check if we have a command line */
Modified: trunk/reactos/ntoskrnl/kd64/kdprint.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdprint.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdprint.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdprint.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -20,7 +20,7 @@
{
STRING Data, Header;
DBGKD_DEBUG_IO DebugIo;
- ULONG Length = Output->Length;
+ USHORT Length = Output->Length;
/* Copy the string */
RtlMoveMemory(KdpMessageBuffer, Output->Buffer, Length);
@@ -51,7 +51,7 @@
return KdpPollBreakInWithPortLock();
}
-ULONG
+VOID
NTAPI
KdpCommandString(IN ULONG Length,
IN LPSTR String,
@@ -61,10 +61,10 @@
IN PKEXCEPTION_FRAME ExceptionFrame)
{
/* FIXME */
- return FALSE;
-}
-
-ULONG
+ while (TRUE);
+}
+
+VOID
NTAPI
KdpSymbol(IN PSTRING DllPath,
IN PKD_SYMBOLS_INFO DllBase,
@@ -79,7 +79,7 @@
ULONG Status;
/* Check if we need to do anything */
- if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return 0;
+ if ((PreviousMode != KernelMode) || (KdDebuggerNotPresent)) return;
/* Enter the debugger */
Entered = KdEnterDebugger(TrapFrame, ExceptionFrame);
@@ -101,39 +101,39 @@
RtlCopyMemory(ContextRecord,
&Prcb->ProcessorState.ContextFrame,
sizeof(CONTEXT));
- //KiRestoreProcessorControlState(&Prcb->ProcessorState);
+ KiRestoreProcessorControlState(&Prcb->ProcessorState);
/* Exit the debugger and clear the CTRL-C state */
KdExitDebugger(Entered);
- return 0;
-}
-
-ULONG
+}
+
+BOOLEAN
NTAPI
KdpPrompt(IN LPSTR InString,
- IN ULONG InStringLength,
+ IN USHORT InStringLength,
OUT LPSTR OutString,
- IN ULONG OutStringLength,
+ IN USHORT OutStringLength,
IN KPROCESSOR_MODE PreviousMode,
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame)
{
/* FIXME */
+ while (TRUE);
return FALSE;
}
-ULONG
+NTSTATUS
NTAPI
KdpPrint(IN ULONG ComponentId,
IN ULONG ComponentMask,
IN LPSTR String,
- IN ULONG Length,
+ IN USHORT Length,
IN KPROCESSOR_MODE PreviousMode,
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame,
OUT PBOOLEAN Status)
{
- NTSTATUS ReturnValue;
+ NTSTATUS ReturnStatus;
BOOLEAN Entered;
ANSI_STRING AnsiString;
@@ -141,7 +141,7 @@
*Status = FALSE;
/* Validate the mask */
- if (ComponentMask <= 0x1F) ComponentMask = 1 << ComponentMask;
+ if (ComponentMask < 0x20) ComponentMask = 1 << ComponentMask;
if (!(Kd_WIN2000_Mask & ComponentMask) ||
((ComponentId < KdComponentTableSize) &&
!(*KdComponentTable[ComponentId] & ComponentMask)))
@@ -162,7 +162,7 @@
/* Setup the ANSI string */
AnsiString.Buffer = String;
- AnsiString.Length = (USHORT)Length;
+ AnsiString.Length = Length;
/* Log the print */
//KdLogDbgPrint(&AnsiString);
@@ -172,7 +172,7 @@
{
/* Fail */
*Status = TRUE;
- return (ULONG)STATUS_DEVICE_NOT_CONNECTED;
+ return STATUS_DEVICE_NOT_CONNECTED;
}
/* Enter the debugger */
@@ -182,17 +182,42 @@
if (KdpPrintString(&AnsiString))
{
/* User pressed CTRL-C, breakpoint on return */
- ReturnValue = STATUS_BREAKPOINT;
+ ReturnStatus = STATUS_BREAKPOINT;
}
else
{
/* String was printed */
- ReturnValue = STATUS_SUCCESS;
+ ReturnStatus = STATUS_SUCCESS;
}
/* Exit the debugger and return */
KdExitDebugger(Entered);
*Status = TRUE;
- return ReturnValue;
-}
-
+ return ReturnStatus;
+}
+
+VOID
+__cdecl
+KdpDprintf(IN PCHAR Format,
+ ...)
+{
+ STRING String;
+ CHAR Buffer[100];
+ USHORT Length;
+ va_list ap;
+
+ /* Format the string */
+ va_start(ap, Format);
+ Length = (USHORT)_vsnprintf(Buffer,
+ sizeof(Buffer),
+ Format,
+ ap);
+
+ /* Set it up */
+ String.Buffer = Buffer;
+ String.Length = Length + 1;
+
+ /* Send it to the debugger directly */
+ KdpPrintString(&String);
+ va_end(ap);
+}
Modified: trunk/reactos/ntoskrnl/kd64/kdtrap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdtrap.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -44,7 +44,7 @@
}
else if (SecondChanceException)
{
- /* We won't bother unless this is second chance */
+ /* We won't bother unless this is first chance */
return FALSE;
}
@@ -71,7 +71,7 @@
RtlCopyMemory(ContextRecord,
&Prcb->ProcessorState.ContextFrame,
sizeof(CONTEXT));
- //KiRestoreProcessorControlState(&Prcb->ProcessorState);
+ KiRestoreProcessorControlState(&Prcb->ProcessorState);
/* Exit the debugger and clear the CTRL-C state */
KdExitDebugger(Entered);
@@ -89,7 +89,7 @@
IN BOOLEAN SecondChanceException)
{
BOOLEAN Unload = FALSE;
- ULONG Eip, Eax;
+ ULONG_PTR ProgramCounter, ReturnValue;
BOOLEAN Status = FALSE;
/*
@@ -99,8 +99,8 @@
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
(ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))
{
- /* Save EIP */
- Eip = ContextRecord->Eip;
+ /* Save Program Counter */
+ ProgramCounter = KeGetContextPc(ContextRecord);
/* Check what kind of operation was requested from us */
switch (ExceptionRecord->ExceptionInformation[0])
@@ -109,43 +109,54 @@
case BREAKPOINT_PRINT:
/* Call the worker routine */
- Eax = KdpPrint(ContextRecord->Ebx,
- ContextRecord->Edi,
- (LPSTR)ExceptionRecord->ExceptionInformation[1],
- (ULONG)ExceptionRecord->ExceptionInformation[2],
- PreviousMode,
- TrapFrame,
- ExceptionFrame,
- &Status);
+ ReturnValue = KdpPrint((ULONG)ContextRecord->Ebx,
+ (ULONG)ContextRecord->Edi,
+ (LPSTR)ExceptionRecord->
+ ExceptionInformation[1],
+ (USHORT)ExceptionRecord->
+ ExceptionInformation[2],
+ PreviousMode,
+ TrapFrame,
+ ExceptionFrame,
+ &Status);
/* Update the return value for the caller */
- ContextRecord->Eax = Eax;
+ KeSetContextReturnRegister(ContextRecord, ReturnValue);
break;
/* DbgPrompt */
case BREAKPOINT_PROMPT:
/* Call the worker routine */
- while (TRUE);
- Eax = 0;
+ ReturnValue = KdpPrompt((LPSTR)ExceptionRecord->
+ ExceptionInformation[1],
+ (USHORT)ExceptionRecord->
+ ExceptionInformation[2],
+ (LPSTR)ContextRecord->Ebx,
+ (USHORT)ContextRecord->Edi,
+ PreviousMode,
+ TrapFrame,
+ ExceptionFrame);
Status = TRUE;
/* Update the return value for the caller */
- ContextRecord->Eax = Eax;
- break;
-
- /* DbgUnloadSymbols */
+ KeSetContextReturnRegister(ContextRecord, ReturnValue);
+ break;
+
+ /* DbgUnloadImageSymbols */
case BREAKPOINT_UNLOAD_SYMBOLS:
/* Drop into the load case below, with the unload parameter */
Unload = TRUE;
- /* DbgLoadSymbols */
+ /* DbgLoadImageSymbols */
case BREAKPOINT_LOAD_SYMBOLS:
/* Call the worker routine */
- KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1],
- (PVOID)ExceptionRecord->ExceptionInformation[2],
+ KdpSymbol((PSTRING)ExceptionRecord->
+ ExceptionInformation[1],
+ (PKD_SYMBOLS_INFO)ExceptionRecord->
+ ExceptionInformation[2],
Unload,
PreviousMode,
ContextRecord,
@@ -154,11 +165,18 @@
Status = TRUE;
break;
- /* DbgCommandString*/
+ /* DbgCommandString */
case BREAKPOINT_COMMAND_STRING:
/* Call the worker routine */
- while (TRUE);
+ KdpCommandString((ULONG)ExceptionRecord->
+ ExceptionInformation[1],
+ (LPSTR)ExceptionRecord->
+ ExceptionInformation[2],
+ PreviousMode,
+ ContextRecord,
+ TrapFrame,
+ ExceptionFrame);
Status = TRUE;
/* Anything else, do nothing */
@@ -169,10 +187,15 @@
}
/*
- * If EIP was not updated, we'll increment it ourselves so execution
+ * If the PC was not updated, we'll increment it ourselves so execution
* continues past the breakpoint.
*/
- if (ContextRecord->Eip == Eip) ContextRecord->Eip++;
+ if (ProgramCounter == KeGetContextPc(ContextRecord))
+ {
+ /* Update it */
+ KeSetContextPc(ContextRecord,
+ ProgramCounter + KD_BREAKPOINT_SIZE);
+ }
}
else
{
@@ -208,8 +231,9 @@
(ExceptionCommand == BREAKPOINT_COMMAND_STRING) ||
(ExceptionCommand == BREAKPOINT_PRINT)))
{
- /* This we can handle: simply bump EIP */
- ContextRecord->Eip++;
+ /* This we can handle: simply bump the Program Counter */
+ KeSetContextPc(ContextRecord,
+ KeGetContextPc(ContextRecord) + KD_BREAKPOINT_SIZE);
return TRUE;
}
else if (KdPitchDebugger)
@@ -220,7 +244,7 @@
else if ((KdAutoEnableOnEvent) &&
(KdPreviouslyEnabled) &&
!(KdDebuggerEnabled) &&
- (KdEnableDebugger()) &&
+ (NT_SUCCESS(KdEnableDebugger())) &&
(KdDebuggerEnabled))
{
/* Debugging was Auto-Enabled. We can now send this to KD. */
Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=4328…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -37,13 +37,13 @@
PVOID
NTAPI
-KiPcToFileHeader(IN PVOID Eip,
+KiPcToFileHeader(IN PVOID Pc,
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry,
IN BOOLEAN DriversOnly,
OUT PBOOLEAN InKernel)
{
ULONG i = 0;
- PVOID ImageBase, EipBase = NULL;
+ PVOID ImageBase, PcBase = NULL;
PLDR_DATA_TABLE_ENTRY Entry;
PLIST_ENTRY ListHead, NextEntry;
@@ -82,12 +82,12 @@
ImageBase = Entry->DllBase;
/* Check if this is the right one */
- if (((ULONG_PTR)Eip >= (ULONG_PTR)Entry->DllBase) &&
- ((ULONG_PTR)Eip < ((ULONG_PTR)Entry->DllBase +
Entry->SizeOfImage)))
+ if (((ULONG_PTR)Pc >= (ULONG_PTR)Entry->DllBase) &&
+ ((ULONG_PTR)Pc < ((ULONG_PTR)Entry->DllBase +
Entry->SizeOfImage)))
{
/* Return this entry */
*LdrEntry = Entry;
- EipBase = ImageBase;
+ PcBase = ImageBase;
/* Check if this was a kernel or HAL entry */
if (i <= 2) *InKernel = TRUE;
@@ -97,7 +97,7 @@
}
/* Return the base address */
- return EipBase;
+ return PcBase;
}
BOOLEAN
@@ -138,10 +138,10 @@
PVOID
NTAPI
-KiRosPcToUserFileHeader(IN PVOID Eip,
+KiRosPcToUserFileHeader(IN PVOID Pc,
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
{
- PVOID ImageBase, EipBase = NULL;
+ PVOID ImageBase, PcBase = NULL;
PLDR_DATA_TABLE_ENTRY Entry;
PLIST_ENTRY ListHead, NextEntry;
@@ -170,19 +170,19 @@
ImageBase = Entry->DllBase;
/* Check if this is the right one */
- if (((ULONG_PTR)Eip >= (ULONG_PTR)Entry->DllBase) &&
- ((ULONG_PTR)Eip < ((ULONG_PTR)Entry->DllBase +
Entry->SizeOfImage)))
+ if (((ULONG_PTR)Pc >= (ULONG_PTR)Entry->DllBase) &&
+ ((ULONG_PTR)Pc < ((ULONG_PTR)Entry->DllBase +
Entry->SizeOfImage)))
{
/* Return this entry */
*LdrEntry = Entry;
- EipBase = ImageBase;
+ PcBase = ImageBase;
break;
}
}
}
/* Return the base address */
- return EipBase;
+ return PcBase;
}
USHORT
@@ -770,7 +770,7 @@
CHAR AnsiName[128];
BOOLEAN IsSystem, IsHardError = FALSE, Reboot = FALSE;
PCHAR HardErrCaption = NULL, HardErrMessage = NULL;
- PVOID Eip = NULL, Memory;
+ PVOID Pc = NULL, Memory;
PVOID DriverBase;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PULONG_PTR HardErrorParameters;
@@ -880,16 +880,12 @@
if (BugCheckParameter3) TrapFrame = (PVOID)BugCheckParameter3;
}
- /* Check if we got one now and if we need to get EIP */
+ /* Check if we got one now and if we need to get the Program Counter */
if ((TrapFrame) &&
(BugCheckCode != KERNEL_MODE_EXCEPTION_NOT_HANDLED))
{
-#ifdef _M_IX86
- /* Get EIP */
- Eip = (PVOID)TrapFrame->Eip;
-#elif defined(_M_PPC)
- Eip = (PVOID)TrapFrame->Dr0; /* srr0 */
-#endif
+ /* Get the Program Counter */
+ Pc = (PVOID)KeGetTrapFramePc(TrapFrame);
}
break;
@@ -903,11 +899,14 @@
* and provide a more detailed analysis. For now, we don't.
*/
- /* Eip is in parameter 4 */
- Eip = (PVOID)BugCheckParameter4;
+ /* Program Counter is in parameter 4 */
+ Pc = (PVOID)BugCheckParameter4;
/* Get the driver base */
- DriverBase = KiPcToFileHeader(Eip, &LdrEntry, FALSE, &IsSystem);
+ DriverBase = KiPcToFileHeader(Pc,
+ &LdrEntry,
+ FALSE,
+ &IsSystem);
if (IsSystem)
{
/*
@@ -947,8 +946,8 @@
KiBugCheckData[0] = DRIVER_IRQL_NOT_LESS_OR_EQUAL;
}
- /* Clear EIP so we don't look it up later */
- Eip = NULL;
+ /* Clear Pc so we don't look it up later */
+ Pc = NULL;
break;
/* Hard error */
@@ -984,17 +983,12 @@
/* Check if we have a frame now */
if (TrapFrame)
{
-#ifdef _M_IX86
- /* Get EIP */
- Eip = (PVOID)TrapFrame->Eip;
- KiBugCheckData[3] = (ULONG)Eip;
-#elif defined(_M_PPC)
- Eip = (PVOID)TrapFrame->Dr0; /* srr0 */
- KiBugCheckData[3] = (ULONG)Eip;
-#endif
+ /* Get the Program Counter */
+ Pc = (PVOID)KeGetTrapFramePc(TrapFrame);
+ KiBugCheckData[3] = (ULONG_PTR)Pc;
/* Find out if was in the kernel or drivers */
- DriverBase = KiPcToFileHeader(Eip,
+ DriverBase = KiPcToFileHeader(Pc,
&LdrEntry,
FALSE,
&IsSystem);
@@ -1024,8 +1018,8 @@
/* Check if the driver forgot to unlock pages */
case DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS:
- /* EIP is in parameter 1 */
- Eip = (PVOID)BugCheckParameter1;
+ /* Program Counter is in parameter 1 */
+ Pc = (PVOID)BugCheckParameter1;
break;
/* Check if the driver consumed too many PTEs */
@@ -1056,12 +1050,12 @@
}
else
{
- /* Do we have an EIP? */
- if (Eip)
+ /* Do we have a Program Counter? */
+ if (Pc)
{
/* Dump image name */
KiDumpParameterImages(AnsiName,
- (PULONG_PTR)&Eip,
+ (PULONG_PTR)&Pc,
1,
KeBugCheckUnicodeToAnsi);
}
Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -279,7 +279,7 @@
/* Intel CPUs */
case CPU_INTEL:
- /* Check if it's a P6 or higher */
+ /* Check if it's a P6 */
if (Prcb->CpuType == 6)
{
/* Perform the special sequence to get the MicroCode Signature */
@@ -737,7 +737,11 @@
NTAPI
KiRestoreProcessorControlState(PKPROCESSOR_STATE ProcessorState)
{
- /* Restore the CR registers */
+ PKGDTENTRY TssEntry;
+
+ //
+ // Restore the CR registers
+ //
__writecr0(ProcessorState->SpecialRegisters.Cr0);
Ke386SetCr2(ProcessorState->SpecialRegisters.Cr2);
__writecr3(ProcessorState->SpecialRegisters.Cr3);
@@ -754,10 +758,21 @@
__writedr(7, ProcessorState->SpecialRegisters.KernelDr7);
//
- // Restore GDT, IDT, LDT and TSS
+ // Restore GDT and IDT
//
Ke386SetGlobalDescriptorTable(&ProcessorState->SpecialRegisters.Gdtr.Limit);
__lidt(&ProcessorState->SpecialRegisters.Idtr.Limit);
+
+ //
+ // Clear the busy flag so we don't crash if we reload the same selector
+ //
+ TssEntry = (PKGDTENTRY)(ProcessorState->SpecialRegisters.Gdtr.Base +
+ ProcessorState->SpecialRegisters.Tr);
+ TssEntry->HighWord.Bytes.Flags1 &= ~0x2;
+
+ //
+ // Restore TSS and LDT
+ //
Ke386SetTr(ProcessorState->SpecialRegisters.Tr);
Ke386SetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
}
Modified: trunk/reactos/ntoskrnl/ke/i386/systimer.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/systimer.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/systimer.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/systimer.S [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -276,7 +276,7 @@
/* Put tick count back in EBX */
mov ebx, eax
- /* Copyit in ECX and get hich count */
+ /* Copy it in ECX and get high count */
mov ecx, eax
mov edx, _KeTickCount + 4
@@ -372,7 +372,7 @@
jz NoDebug
/* Break-in requested! */
- push 1
+ push DBG_STATUS_CONTROL_C
call _DbgBreakPointWithStatus@4
jmp NoDebug
Modified: trunk/reactos/ntoskrnl/ke/profobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/profobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/profobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/profobj.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -256,6 +256,10 @@
PULONG BucketValue;
PKPROFILE Profile;
PLIST_ENTRY NextEntry;
+ ULONG_PTR ProgramCounter;
+
+ /* Get the Program Counter */
+ ProgramCounter = KeGetTrapFramePc(TrapFrame);
/* Loop the List */
for (NextEntry = ListHead->Flink;
@@ -266,21 +270,17 @@
Profile = CONTAINING_RECORD(NextEntry, KPROFILE, ProfileListEntry);
/* Check if the source is good, and if it's within the range */
-#ifdef _M_IX86
if ((Profile->Source != Source) ||
- (TrapFrame->Eip < (ULONG_PTR)Profile->RangeBase) ||
- (TrapFrame->Eip > (ULONG_PTR)Profile->RangeLimit))
+ (ProgramCounter < (ULONG_PTR)Profile->RangeBase) ||
+ (ProgramCounter > (ULONG_PTR)Profile->RangeLimit))
{
continue;
}
- /* Get the Pointer to the Bucket Value representing this EIP */
+ /* Get the Pointer to the Bucket Value representing this Program Counter */
BucketValue = (PULONG)((((ULONG_PTR)Profile->Buffer +
- (TrapFrame->Eip - (ULONG_PTR)Profile->RangeBase))
+ (ProgramCounter - (ULONG_PTR)Profile->RangeBase))
> Profile->BucketShift) &~ 0x3);
-#elif
defined(_M_PPC)
- // XXX arty
-#endif
/* Increment the value */
++BucketValue;
Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -29,7 +29,7 @@
LIST_ENTRY PsLoadedModuleList;
KSPIN_LOCK PsLoadedModuleSpinLock;
-ULONG PsNtosImageBase;
+ULONG_PTR PsNtosImageBase;
KMUTANT MmSystemLoadLock;
extern ULONG NtGlobalFlag;
@@ -1334,7 +1334,7 @@
LdrEntry = CONTAINING_RECORD(NextEntry,
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
- PsNtosImageBase = (ULONG)LdrEntry->DllBase;
+ PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase;
/* Loop the loader block */
while (NextEntry != ListHead)
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=43…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -357,6 +357,11 @@
KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 8, 0, 0);
}
+#ifdef _WINKD_
+ /* Let KD know we are done */
+ KdUpdateDataBlock();
+#endif
+
/* Return status */
return Status;
}
Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -320,24 +320,8 @@
}
/* Set the Start Addresses */
-#if defined(_M_IX86)
- Thread->StartAddress = (PVOID)ThreadContext->Eip;
- Thread->Win32StartAddress = (PVOID)ThreadContext->Eax;
-#elif defined(_M_PPC)
- Thread->StartAddress = (PVOID)ThreadContext->Dr0;
- Thread->Win32StartAddress = (PVOID)ThreadContext->Gpr3;
-#elif defined(_M_MIPS)
- Thread->StartAddress = (PVOID)ThreadContext->Psr;
- Thread->Win32StartAddress = (PVOID)ThreadContext->IntA0;
-#elif defined(_M_ARM)
- Thread->StartAddress = (PVOID)ThreadContext->Pc;
- Thread->Win32StartAddress = (PVOID)ThreadContext->R0;
-#elif defined(_M_AMD64)
- Thread->StartAddress = (PVOID)ThreadContext->Rip;
- Thread->Win32StartAddress = (PVOID)ThreadContext->Rax;
-#else
-#error Unknown architecture
-#endif
+ Thread->StartAddress = (PVOID)KeGetContextPc(ThreadContext);
+ Thread->Win32StartAddress = (PVOID)KeGetContextReturnRegister(ThreadContext);
/* Let the kernel intialize the Thread */
Status = KeInitThread(&Thread->Tcb,
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Sun Oct 4 18:53:15 2009
@@ -341,6 +341,8 @@
Stack = TrapFrame->Ebp;
#elif defined(_M_PPC)
Stack = TrapFrame->Gpr1;
+#else
+#error Unknown architecture
#endif
/* Validate them */