jankos/kernel.c
2019-11-09 19:02:47 -08:00

37 lines
746 B
C

#include "kernel.h"
#include "types.h"
#include "tests.h"
#include "interrupts.h"
#include "pit.h"
#include "stlio.h"
#include "gdt.h"
void kinit() {
//gdt_configure();
init_idt();
pit_install_timer();
test_dispatcher();
}
void kprintp(const u32 ptr) {
// Prints our hex version of whatever is given
const char _chars[] = "0123456789abcdef";
u32 idx = 0; // used as hash into the _chars mapping
// iterate over each nibble
for(u32 i = 0 ;i < 7;i++) {
idx = (ptr << (i * 4)) & 0xf0000000;
idx = idx >> 28;
putch(_chars[idx]);
}
}
void kprints(const char* s) {
printf(s);
}
// Should kmain return, we fall back to the loader which then just keeps in a hung state
void kmain() {
kinit();
kprints("i guess we're good now?");
}