Big merge: thanks alex and greatlord. Not a complete merge but most
[reactos.git] / reactos / ntoskrnl / ke / bug.c
index 2bb504c..f6e837c 100644 (file)
@@ -254,7 +254,7 @@ NTAPI
 KiBugCheckDebugBreak(IN ULONG StatusCode)
 {
     /* If KDBG isn't connected, freeze the CPU, otherwise, break */
-    if (KdDebuggerNotPresent) for (;;) Ke386HaltProcessor();
+    if (KdDebuggerNotPresent) for (;;) KeHaltProcessor();
     DbgBreakPointWithStatus(StatusCode);
 }
 
@@ -265,6 +265,7 @@ KiPcToFileHeader(IN PVOID Eip,
                  IN BOOLEAN DriversOnly,
                  OUT PBOOLEAN InKernel)
 {
+#ifdef _M_IX86
     ULONG i = 0;
     PVOID ImageBase, EipBase = NULL;
     PLDR_DATA_TABLE_ENTRY Entry;
@@ -319,6 +320,9 @@ KiPcToFileHeader(IN PVOID Eip,
 
     /* Return the base address */
     return EipBase;
+#else
+    return 0;
+#endif
 }
 
 PCHAR
@@ -543,7 +547,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     InterlockedIncrement((PLONG)&KiHardwareTrigger);
 
     /* Capture the CPU Context */
-    RtlCaptureContext(&Prcb->ProcessorState.ContextFrame);
+    RtlCaptureContext((PVOID)&Prcb->ProcessorState.ContextFrame);
     Context = Prcb->ProcessorState.ContextFrame;
 
     /* FIXME: Call the Watchdog if it's regsitered */
@@ -624,8 +628,12 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
             if ((TrapFrame) &&
                 (BugCheckCode != KERNEL_MODE_EXCEPTION_NOT_HANDLED))
             {
+#ifdef _M_IX86
                 /* Get EIP */
                 Eip = (PVOID)TrapFrame->Eip;
+#elif defined(_M_PPC)
+               Eip = (PVOID)TrapFrame->Iar;
+#endif
             }
             break;
 
@@ -720,8 +728,12 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
             /* Check if we have a frame now */
             if (TrapFrame)
             {
+#ifdef _M_IX86
                 /* Get EIP */
                 Eip = (PVOID)TrapFrame->Eip;
+#elif defined(_M_PPC)
+               Eip = (PVOID)TrapFrame->Iar;
+#endif
 
                 /* Find out if was in the kernel or drivers */
                 DriverBase = KiPcToFileHeader(Eip, &LdrEntry, FALSE, &IsSystem);
@@ -845,7 +857,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     HalReleaseDisplayOwnership();
 
     /* Raise IRQL to HIGH_LEVEL */
-    Ke386DisableInterrupts();
+    KeDisableInterrupts();
     KeRaiseIrql(HIGH_LEVEL, &OldIrql);
 
     /* Unlock the Kernel Adress Space if we own it */
@@ -909,7 +921,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     else if (KeBugCheckOwnerRecursionCount > 2)
     {
         /* Halt the CPU */
-        for (;;) Ke386HaltProcessor();
+        for (;;) KeHaltProcessor();
     }
 
     /* Call the Callbacks */