X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fkpanic.c;h=9300c69ef20e36932526cadfb41a7957eba36a59;hb=a20cfd571f504f5c7f2d29516442a12c200441d5;hp=798c5139219fc29779746836cc65a4f9a75b0f6a;hpb=814b2d0009da73b56c6def5d70a9dd97c7b17e2e;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/kpanic.c b/Kernel/arch/x86/kpanic.c index 798c5139..9300c69e 100644 --- a/Kernel/arch/x86/kpanic.c +++ b/Kernel/arch/x86/kpanic.c @@ -1,18 +1,34 @@ /* * Acess 2 Kernel - * By John Hodge (thePowersGang) + * - By John Hodge (thePowersGang) + * + * kpanic.c * - x86 Kernel Panic Handler */ #include +#include +// === CONSTANTS === #define FB ((Uint16 *)(KERNEL_BASE|0xB8000)) #define BGC 0x4F00 // White on Red //#define BGC 0xC000 // Black on Bright Red //#define BGC 0x1F00 // White on Blue (BSOD!) - int giKP_Pos = 0; +// === IMPORTS === +extern Uint32 GetEIP(void); +extern void Error_Backtrace(Uint32 eip, Uint32 ebp); +#if USE_MP +extern void MP_SendIPIVector(int CPU, Uint8 Vector); +extern int giNumCPUs; +extern int GetCPUNum(void); +#endif + +// === PROTOTYPES === +void KernelPanic_SetMode(void); +void KernelPanic_PutChar(char Ch); +// === CONSTANTS === const struct { Uint16 IdxPort; Uint16 DatPort; @@ -52,10 +68,14 @@ const struct { }; #define NUM_REGVALUES (sizeof(caRegValues)/sizeof(caRegValues[0])) +// === GLOBALS === + int giKP_Pos = 0; + +// === CODE === /** * \brief Sets the screen mode for a kernel panic */ -void KernelPanic_SetMode() +void KernelPanic_SetMode(void) { int i; @@ -79,12 +99,29 @@ void KernelPanic_SetMode() inb(0x3DA); outb(0x3C0, 0x20); #endif + + #if USE_MP + // Send halt to all processors + for( i = 0; i < giNumCPUs; i ++ ) + { + if(i == GetCPUNum()) continue ; + FB[i] = BGC|('A'+i); + MP_SendIPIVector(i, 0xED); + } + #endif // Clear Screen for( i = 0; i < 80*25; i++ ) { FB[i] = BGC; } + + { + Uint32 eip = GetEIP(); + Uint32 ebp; + __asm__ __volatile__ ("mov %%ebp, %0" : "=r" (ebp)); + Error_Backtrace(eip, ebp); + } } void KernelPanic_PutChar(char Ch)