70 lines
1.5 KiB
C
70 lines
1.5 KiB
C
// add something that instructs the compiler to ignore unused vars
|
|
// for ones that we aernt using yet
|
|
#include "headers/descriptor_tables.h"
|
|
#include "headers/screen.h"
|
|
#include "headers/serial.h"
|
|
#include "headers/timer.h"
|
|
#include "headers/keyboard.h"
|
|
#include "headers/paging.h"
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
|
|
void gpt(registers_t *regs)
|
|
{
|
|
regs->eax++;
|
|
PANIC("General protection fault");
|
|
}
|
|
|
|
extern uint8_t current_color;
|
|
int kernel_main(void)
|
|
{
|
|
register_interrupt_handler(13, &gpt);
|
|
|
|
//Prepare the screen, and make sure the colors are set proper.
|
|
clear();
|
|
set_current_color(WHITE);
|
|
|
|
print("Intializing kernel...\n");
|
|
|
|
//Initialize and test the serial port.
|
|
init_serial();
|
|
serial_print("Serial logging started!\n");
|
|
print("Serial Initialized.\n");
|
|
|
|
// Initialise all the ISRs and segmentation
|
|
init_descriptor_tables();
|
|
print("Descriptor tables Initialized.\n");
|
|
|
|
//Prepare paging. TODO: Finish Michael's implementation
|
|
//initialize_paging();
|
|
print("Paging ready.\n");
|
|
|
|
//Get the timer ready
|
|
//init_timer(0);
|
|
|
|
//Prepare the keyboard for taking input.#
|
|
asm("sti");
|
|
init_keyboard(); //<--- come back to after basic memory allocation
|
|
print("Keyboard ready.\n");
|
|
|
|
//This should cause a page fault and thus a panic.
|
|
|
|
volatile uint32_t *ptr = (uint32_t*)NULL;
|
|
kprintf("(0x%x)*ptr = %x\n",ptr,&ptr);
|
|
|
|
//Print our fancy colored message.
|
|
set_current_color(RED);
|
|
print("(c)");
|
|
set_current_color(GREEN);
|
|
print("Sync");
|
|
set_current_color(WHITE);
|
|
print(", 2019\n");
|
|
|
|
|
|
|
|
//Hang.
|
|
for(;;) {}
|
|
return 0;
|
|
}
|