Made exception handler describe flags

This commit is contained in:
Robbe Van Herck 2020-01-10 14:44:09 +01:00
parent 9536ddd3d3
commit 9a7992ae2e
No known key found for this signature in database
GPG key ID: A66F76F7B81BD784

View file

@ -38,7 +38,43 @@ void bsod(interrupt_frame* frame, char* err_msg, int32_t err_code) {
terminal_writeint(frame->cs, 16);
terminal_writestring("\neflags = 0b");
terminal_writeint(frame->eflags, 2);
terminal_writestring("\n(");
terminal_writestring((0x0001 & frame->eflags) != 0 ? "NC,": "CY,");
terminal_writestring((0x0004 & frame->eflags) != 0 ? "PE,": "PO,");
terminal_writestring((0x0010 & frame->eflags) != 0 ? "AC,": "NA,");
terminal_writestring((0x0040 & frame->eflags) != 0 ? "ZR,": "NZ,");
terminal_writestring((0x0080 & frame->eflags) != 0 ? "NG,": "PL,");
terminal_writestring("TF:");
terminal_writeint((0x0100 & frame->eflags) >> 8, 2);
terminal_putchar(',');
terminal_writestring((0x0200 & frame->eflags) != 0 ? "EI,": "DI,");
terminal_writestring((0x0400 & frame->eflags) != 0 ? "DN,": "UP,");
terminal_writestring((0x0800 & frame->eflags) != 0 ? "OV,": "NV,");
terminal_writestring("IOPL:");
terminal_writeint((0x3000 & frame->eflags) >> 12, 10);
terminal_putchar(',');
terminal_writestring("NT:");
terminal_writeint((0x4000 & frame->eflags) >> 14, 2);
terminal_putchar(',');
terminal_writestring("RF:");
terminal_writeint((0x0001000 & frame->eflags) >> 16, 2);
terminal_putchar(',');
terminal_writestring("VM:");
terminal_writeint((0x0002000 & frame->eflags) >> 17, 2);
terminal_putchar(',');
terminal_writestring("AC:");
terminal_writeint((0x0004000 & frame->eflags) >> 18, 2);
terminal_putchar(',');
terminal_writestring("VIF:");
terminal_writeint((0x0008000 & frame->eflags) >> 19, 2);
terminal_putchar(',');
terminal_writestring("VIP:");
terminal_writeint((0x0010000 & frame->eflags) >> 20, 2);
terminal_putchar(',');
terminal_writestring("ID:");
terminal_writeint((0x0020000 & frame->eflags) >> 21, 2);
terminal_putchar(')');
for(;;) {
asm("hlt");