diff --git a/kernel/src/kernel.c b/kernel/src/kernel.c index e62e392..4b91d98 100644 --- a/kernel/src/kernel.c +++ b/kernel/src/kernel.c @@ -16,7 +16,6 @@ void kmain(void* ptr, uint32_t magic) { if (serial_init(COM1) != 0) panic("Failed to initialize Serial driver."); debugf("\x1b[H\x1b[J\x1b[0mkern. \x1b[36m(serial console)\x1b[0m\n\n"); - // System init if (gdt_init() != 0) panic("Failed to initalize GDT."); if (isr_init() != 0) panic("Failed to initalize ISRs."); diff --git a/kernel/src/tty.c b/kernel/src/tty.c index 6932db7..d506f16 100644 --- a/kernel/src/tty.c +++ b/kernel/src/tty.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -11,10 +12,16 @@ struct { } ctx; int tty_init(void) { + // Map VGA Text memory to KERNEL_FRAMEBUF + size_t pagecount = dceil(VGA_WIDTH * VGA_HEIGHT * 2, PAGE_SIZE); + for (size_t i = 0; i < pagecount; i++) { + pag_mapPage(KERNEL_FRAMEBUF + i * PAGE_SIZE, VGA_MEMORY + i * PAGE_SIZE, 0); + } + ctx.row = 0; ctx.col = 0; ctx.attr = 0x07; - ctx.buf = (uint8_t*)VGA_MEMORY; + ctx.buf = (uint8_t*)KERNEL_FRAMEBUF; tty_clear(); return 0;