37 lines
735 B
C
37 lines
735 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 < 8;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();
|
|
timer_wait(50); // in ms
|
|
}
|