From 9a7992ae2e79ea7110469145677184c2dd54c0dd Mon Sep 17 00:00:00 2001 From: Robbe Van Herck Date: Fri, 10 Jan 2020 14:44:09 +0100 Subject: [PATCH] Made exception handler describe flags --- kernel/exception.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/kernel/exception.c b/kernel/exception.c index 09ad323..2e590ce 100644 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -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");