37 lines
687 B
C
37 lines
687 B
C
#include "kernel.h"
|
|
#include "types.h"
|
|
#include "tests.h"
|
|
#include "interrupts.h"
|
|
#include "stlio.h"
|
|
#include "gdt.h"
|
|
|
|
void kinit() {
|
|
//gdt_configure();
|
|
init_idt();
|
|
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);
|
|
}
|
|
|
|
void kmain() {
|
|
kinit();
|
|
__asm__("xchg bx, bx");
|
|
__asm__("xor eax, eax");
|
|
__asm__("div al");
|
|
for(;;); // the most amazing loop
|
|
}
|