2 * Acess2 x86_64 Project
9 void Error_Handler(tRegs *Regs);
12 const char * const csaERROR_NAMES[] = {
13 "Divide By Zero", "Debug", "NMI Exception", "INT3",
14 "INTO", "Out of Bounds", "Invalid Opcode", "Coprocessor not avaliable",
15 "Double Fault", "Coprocessor Segment Overrun", "Bad TSS", "Segment Not Present",
16 "Stack Fault Exception", "GPF", "#PF", "Reserved",
17 "Floating Point Exception", "Alignment Check Exception", "Machine Check Exception", "Reserved",
18 "Reserved", "Reserved", "Reserved", "Reserved",
19 "Reserved", "Reserved", "Reserved", "Reserved",
20 "Reserved", "Reserved", "Reserved", "Reserved"
24 void Error_Handler(tRegs *Regs)
30 Warning("CPU Error %i - %s, Code: 0x%x",
31 Regs->IntNum, csaERROR_NAMES[Regs->IntNum], Regs->ErrorCode);
32 Warning(" CS:RIP = 0x%04x:%016x", Regs->CS, Regs->RIP);
33 Warning(" SS:RSP = 0x%04x:%016x", Regs->SS, Regs->RIP);
34 Warning(" RFLAGS = 0x%016x", Regs->RFlags);
35 Warning(" EAX %016x ECX %016x EDX %016x EBX %016x",
36 Regs->RAX, Regs->RCX, Regs->RDX, Regs->RBX);
37 Warning(" ESP %016x EBP %016x ESI %016x EDI %016x",
38 Regs->RSP, Regs->RBP, Regs->RSP, Regs->RDI);
40 Warning(" FS %04x GS %04x", Regs->FS, Regs->GS);
44 __asm__ __volatile__ ("mov %%cr0, %0":"=r"(cr));
45 Warning(" CR0 0x%08x", cr);
46 __asm__ __volatile__ ("mov %%cr2, %0":"=r"(cr));
47 Warning(" CR2 0x%08x", cr);
48 __asm__ __volatile__ ("mov %%cr3, %0":"=r"(cr));
49 Warning(" CR3 0x%08x", cr);
50 __asm__ __volatile__ ("mov %%cr4, %0":"=r"(cr));
51 Warning(" CR4 0x%08x", cr);
53 switch( Regs->IntNum )
56 Warning(" Offending bytes: %02x %02x %02x %02x",
57 *(Uint8*)Regs->RIP+0, *(Uint8*)Regs->RIP+1,
58 *(Uint8*)Regs->RIP+2, *(Uint8*)Regs->RIP+3);
63 __asm__ __volatile__ ("hlt");