pmm
This commit is contained in:
35
src/kernel.c
35
src/kernel.c
@@ -1,34 +1,21 @@
|
||||
#include "kernel.h"
|
||||
#include "interrupts.h"
|
||||
#include "keyboard.h"
|
||||
#include "multiboot.h"
|
||||
#include "pmm.h"
|
||||
#include "string.h"
|
||||
#include "vga.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
void handle_keypress(const keyboard_event_t* event)
|
||||
{
|
||||
if (event->pressed && event->ascii)
|
||||
{
|
||||
kprintf("%c", event->ascii);
|
||||
}
|
||||
}
|
||||
|
||||
void kmain(multiboot_info_t* multiboot_info)
|
||||
void kmain(multiboot_info_t* mbd)
|
||||
{
|
||||
vga_clear();
|
||||
|
||||
init_pmm(mbd);
|
||||
|
||||
remap_pic();
|
||||
|
||||
if (cpu_has_apic())
|
||||
{
|
||||
disable_pic();
|
||||
enable_apic();
|
||||
}
|
||||
|
||||
enable_interrupts();
|
||||
register_keypress_handler(handle_keypress);
|
||||
|
||||
kprintf("Welcome to nub OS\n");
|
||||
kprintf("Welcome to nub OS :)\n");
|
||||
khalt();
|
||||
}
|
||||
|
||||
@@ -89,6 +76,16 @@ void kprintf(const char* fmt, ...)
|
||||
vga_put_char(buf[j], VGA_DEFAULT_COLOR);
|
||||
}
|
||||
}
|
||||
else if (fmt[i] == 'x')
|
||||
{
|
||||
uint64_t val = va_arg(args, uint64_t);
|
||||
char buf[17];
|
||||
uitoa64_hex(val, buf);
|
||||
for (size_t j = 0; buf[j] != '\0'; j++)
|
||||
{
|
||||
vga_put_char(buf[j], VGA_DEFAULT_COLOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vga_put_char(fmt[i], VGA_DEFAULT_COLOR);
|
||||
|
||||
Reference in New Issue
Block a user