corn/src/kmain.c

42 lines
804 B
C
Raw Normal View History

2024-01-29 00:27:23 +00:00
#include <memory.h>
2024-01-27 08:37:48 +00:00
#include <lib.h>
#include <serial.h>
2024-01-27 10:16:57 +00:00
#include <fb.h>
2024-01-29 00:27:23 +00:00
#include <shim.h>
2024-01-30 15:19:33 +00:00
void print_memory() {
size_t WIDTH = 64;
for(size_t i = 0;; i += WIDTH) {
char buf[20];
ultoa(i, buf, 16);
serial_out_str("0x");
for(size_t k = 0; k < 6 - strlen(buf); k++) {
serial_out('0');
}
serial_out_str(buf);
serial_out_str(": ");
for(size_t j = 0; j < WIDTH; j++) {
char x = *(char *)(i + j);
if(x < 0x20 || x >= 0x7f) {
serial_out('.');
} else {
serial_out(x);
}
}
serial_out('\n');
}
}
2024-01-29 00:27:23 +00:00
void kmain(struct boot_info *info) {
memory_init(info->map);
2024-01-30 02:10:29 +00:00
serial_out_str("entered kmain\n");
*(char*)(0xB8000 + 0x144) = 'h';
*(char*)(0xB8000 + 0x146) = 'i';
//fb_init(1024, 768);
2024-01-30 00:19:29 +00:00
while (1) {
// loop so we dont halt
// this allows interrupts to fire
}
2024-01-27 03:29:49 +00:00
}