// Page Fault
if(Regs->int_num == 14)
{
+ __asm__ __volatile__ ("sti"); // Should be OK, TODO: Test
__asm__ __volatile__ ("mov %%cr2, %0":"=r"(cr));
MM_PageFault( cr, Regs->err_code, Regs );
return ;
/**
* \brief Halt the CPU (shorter version of yield)
*/
+#if 1
+#define HALT() do { \
+ Uint32 flags; \
+ __asm__ __volatile__ ("pushf;pop %0" : "=a"(flags)); \
+ if( !(flags & 0x200) ) Panic("HALT called with interrupts disabled"); \
+ __asm__ __volatile__ ("hlt"); \
+} while(0)
+#else
#define HALT() __asm__ __volatile__ ("hlt")
+#endif
/**
* \brief Fire a magic breakpoint (bochs)
*/
#include <acess.h>
+
+
#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!)
+extern Uint32 GetEIP(void);
+extern void Error_Backtrace(Uint32 eip, Uint32 ebp);
+
int giKP_Pos = 0;
const struct {
if( giKP_Pos ) return ;
// Restore VGA 0xB8000 text mode
- #if 0
+ #if 1
for( i = 0; i < NUM_REGVALUES; i++ )
{
// Reset Flip-Flop
{
FB[i] = BGC;
}
+
+ {
+ Uint32 eip = GetEIP();
+ Uint32 ebp;
+ __asm__ __volatile__ ("mov %%ebp, %0" : "=r" (ebp));
+ Error_Backtrace(eip, ebp);
+ }
}
void KernelPanic_PutChar(char Ch)
outb(GDB_SERIAL_PORT + 3, 0x03); // 8 bits, no parity, one stop bit (8N1)
outb(GDB_SERIAL_PORT + 2, 0xC7); // Enable FIFO with 14-byte threshold and clear it
outb(GDB_SERIAL_PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
- gbDebug_SerialSetup = 1;
+ gbGDB_SerialSetup = 1;
}
while( (inb(GDB_SERIAL_PORT + 5) & 0x20) == 0 );
outb(GDB_SERIAL_PORT, ch);
outb(GDB_SERIAL_PORT + 3, 0x03); // 8 bits, no parity, one stop bit
outb(GDB_SERIAL_PORT + 2, 0xC7); // Enable FIFO with 14-byte threshold and clear it
outb(GDB_SERIAL_PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
- gbDebug_SerialSetup = 1;
+ gbGDB_SerialSetup = 1;
}
while( (inb(GDB_SERIAL_PORT + 5) & 1) == 0) ;
return inb(GDB_SERIAL_PORT);
-/*
+"/*
* Acess2
* - Physical memory manager
*/
Panic("The fuck? Too many pages! (indx = 0x%x)", indx);
}
+ if( indx >= giPageCount ) {
+ Mutex_Release( &glPhysAlloc );
+ Log_Error("PMem", "MM_AllocPhys - indx(%i) > giPageCount(%i)", indx, giPageCount);
+ LEAVE('i', 0);
+ return 0;
+ }
+
// Mark page used
if(gaPageReferences)
gaPageReferences[ indx ] = 1;