2013-12-06 14:20:46 -05:00
|
|
|
#include <stddef.h>
|
2014-01-31 16:12:04 -05:00
|
|
|
#include <stdint.h>
|
2013-12-06 14:20:46 -05:00
|
|
|
|
2014-01-31 16:12:04 -05:00
|
|
|
#include <brados/printk.h>
|
2013-12-06 14:20:46 -05:00
|
|
|
#include <brados/string.h>
|
|
|
|
#include <video/vga.h>
|
2014-01-31 16:12:04 -05:00
|
|
|
#include <multiboot.h>
|
2013-12-06 14:20:46 -05:00
|
|
|
|
|
|
|
// Make sure we are using the right compiler
|
|
|
|
#if defined(__linux__)
|
|
|
|
#error "You are using the wrong compiler."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Main kernel function
|
2014-01-31 16:12:04 -05:00
|
|
|
void brados_main(uint32_t multiMagic, uint32_t multiAddr)
|
2013-12-06 14:20:46 -05:00
|
|
|
{
|
2014-01-31 16:12:04 -05:00
|
|
|
// Initialize VGA terminal
|
2013-12-06 14:20:46 -05:00
|
|
|
struct vgastate term;
|
|
|
|
term_init(&term);
|
|
|
|
|
|
|
|
// Welcome message
|
|
|
|
term_writeStr(&term, "Welcome to BRaDOS!\n");
|
|
|
|
term_writeStr(&term, "written by L. Bradley LaBoon\n\n");
|
|
|
|
|
2014-01-31 16:12:04 -05:00
|
|
|
// VGA tests
|
|
|
|
//term_test(&term);
|
|
|
|
|
|
|
|
// Get multiboot info
|
|
|
|
printk(&term, "Multiboot value: %x\n", multiMagic);
|
|
|
|
if (multiMagic != 0x2BADB002) {
|
|
|
|
term_writeStr(&term, "Error! Multiboot header not present. Quitting.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
printk(&term, "Multiboot address: %x\n", multiAddr);
|
|
|
|
struct multiboot_header *multiHead = (struct multiboot_header *) multiAddr;
|
|
|
|
printk(&term, "Flags: %x\nMem Lower: %x\nMem Upper: %x\n", multiHead->flags, multiHead->mem_lower, multiHead->mem_upper);
|
|
|
|
char *bootName = (char *) multiHead->boot_loader_name;
|
|
|
|
printk(&term, "Boot loader: %s\n\n", bootName);
|
2013-12-06 14:20:46 -05:00
|
|
|
|
2014-01-31 16:12:04 -05:00
|
|
|
// Done
|
2013-12-06 14:20:46 -05:00
|
|
|
term_writeStr(&term, "Done.");
|
|
|
|
}
|