Fixed TTY not working because of paging

This commit is contained in:
2025-04-10 11:50:32 +02:00
parent ba28eafb20
commit f1bdfc9c9f
2 changed files with 8 additions and 2 deletions
-1
View File
@@ -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.");
+8 -1
View File
@@ -1,4 +1,5 @@
#include <kernel.h>
#include <paging.h>
#include <system.h>
#include <tty.h>
@@ -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;