instead of stuffing all of the i/o stuff into the "kio" library, i've decided to rework i/o to be a generic handler that takes in a function pointer for putc, and does the rest of the logic onto that pointer. That way, you can pass any function that can take in characters and move them to buffers. I'll do a writeup on this at some point to document it.
33 lines
974 B
C
33 lines
974 B
C
//Our own code, at this point...
|
|
//#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "vga.h"
|
|
#include "io.h"
|
|
#include "kttools.h"
|
|
#include "kmultiboot.h"
|
|
#include "idt.h"
|
|
//finally, main.
|
|
void kern_main(uint32_t multiboot_magic, mb_info_t* multiboot_info)
|
|
{
|
|
//Hello C! Let's get to work in cleaning up our environment a bit and creating some safety.
|
|
//First interrupts.
|
|
setup_idt();
|
|
|
|
//wipe the screen
|
|
vga_clear();
|
|
//We're going to use this buffer as our 8char hex representation for reading mem
|
|
|
|
printf(vga_out, "Entry eax:%X\n", multiboot_magic);
|
|
|
|
if(multiboot_magic != 0x2BADB002) {
|
|
println(vga_out, "Bootloader not multiboot1 compliant! Needed for mmap, etc. Can't work without it, kthxbye!");
|
|
return;
|
|
} else {
|
|
println(vga_out, "Multiboot detected! Continuing...");
|
|
}
|
|
|
|
printf(vga_out, "MEM_LOWER:%X\n", multiboot_info->mem_lower);
|
|
printf(vga_out, "MEM_UPPER:%X\n", multiboot_info->mem_upper);
|
|
|
|
}
|
|
|