mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Fixed TTY not working because of paging
This commit is contained in:
@@ -16,7 +16,6 @@ void kmain(void* ptr, uint32_t magic) {
|
|||||||
if (serial_init(COM1) != 0) panic("Failed to initialize Serial driver.");
|
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");
|
debugf("\x1b[H\x1b[J\x1b[0mkern. \x1b[36m(serial console)\x1b[0m\n\n");
|
||||||
|
|
||||||
|
|
||||||
// System init
|
// System init
|
||||||
if (gdt_init() != 0) panic("Failed to initalize GDT.");
|
if (gdt_init() != 0) panic("Failed to initalize GDT.");
|
||||||
if (isr_init() != 0) panic("Failed to initalize ISRs.");
|
if (isr_init() != 0) panic("Failed to initalize ISRs.");
|
||||||
|
|||||||
+8
-1
@@ -1,4 +1,5 @@
|
|||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
#include <paging.h>
|
||||||
#include <system.h>
|
#include <system.h>
|
||||||
#include <tty.h>
|
#include <tty.h>
|
||||||
|
|
||||||
@@ -11,10 +12,16 @@ struct {
|
|||||||
} ctx;
|
} ctx;
|
||||||
|
|
||||||
int tty_init(void) {
|
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.row = 0;
|
||||||
ctx.col = 0;
|
ctx.col = 0;
|
||||||
ctx.attr = 0x07;
|
ctx.attr = 0x07;
|
||||||
ctx.buf = (uint8_t*)VGA_MEMORY;
|
ctx.buf = (uint8_t*)KERNEL_FRAMEBUF;
|
||||||
tty_clear();
|
tty_clear();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user