From e834122e08f8f02588801b04b5e852aaae9fe638 Mon Sep 17 00:00:00 2001 From: Karina Date: Mon, 22 Dec 2025 02:47:27 +0400 Subject: [PATCH] some minor stuff; good night --- kernel/data/font8x16.c | 4 +++- kernel/include/idt.h | 6 +++++- kernel/src/modules/console.c | 2 +- kernel/src/modules/panic.c | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/kernel/data/font8x16.c b/kernel/data/font8x16.c index 0fce1ca..d005f58 100644 --- a/kernel/data/font8x16.c +++ b/kernel/data/font8x16.c @@ -1,4 +1,6 @@ -// borrowed from https://github.com/hubenchang0515/font8x16/blob/master/font8x16.h +// font8x16 bitmap font +// Source: https://github.com/hubenchang0515/font8x16 +// License: MIT unsigned char font8x16[][16] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, //0x00, diff --git a/kernel/include/idt.h b/kernel/include/idt.h index af3aeec..01172e2 100644 --- a/kernel/include/idt.h +++ b/kernel/include/idt.h @@ -1,3 +1,5 @@ +#ifndef IDT_H +#define IDT_H #pragma once #include "types.h" @@ -16,4 +18,6 @@ typedef struct { u64 base; } __attribute__((packed)) IDTPtr; -void idt_init(); \ No newline at end of file +void idt_init(); + +#endif \ No newline at end of file diff --git a/kernel/src/modules/console.c b/kernel/src/modules/console.c index 9e078ca..f435c65 100644 --- a/kernel/src/modules/console.c +++ b/kernel/src/modules/console.c @@ -115,7 +115,7 @@ static void print_hex(u64 u) { while (u > 0) { i32 digit = u % 16; if (digit < 10) { buffer[i] = digit + '0'; } - else { buffer[i] = digit - 10 + 'a'; } + else { buffer[i] = digit - 10 + 'A'; } u /= 16; i++; } diff --git a/kernel/src/modules/panic.c b/kernel/src/modules/panic.c index 365a1f7..a79bdb9 100644 --- a/kernel/src/modules/panic.c +++ b/kernel/src/modules/panic.c @@ -53,8 +53,8 @@ __attribute__((noreturn)) void panic(Registers *regs) { kprintf("\n\n"); kprintf("\t\t\tKERNEL PANIC :( \n"); kprintf("\t\t-------------------------\n"); - kprintf("\t\tCPU EXCEPTION: %d (%s)\n", regs->int_no, exception_messages[regs->int_no]); - kprintf("\t\tError Code: %x\n", regs->err_code); + kprintf("\t\tCPU EXCEPTION: %s (%d)\n", exception_messages[regs->int_no], regs->int_no); + if (regs->err_code) kprintf("\t\tError Code: %x\n", regs->err_code); kprintf("\t\tInstruction Pointer (RIP): %x\n", regs->rip); kprintf("\t\tCode Segment (CS): %x\n", regs->cs); kprintf("\t\tFlags (RFLAGS): %x\n", regs->rflags);