This repository has been archived on 2020-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
Legacy-Sync/main.c
Jenny Curle f6ba6aa117 Legacy OS files. Have an i686-elf-gcc & -ld in your PATH,
and the Makefile will take care of the rest.
2019-04-01 01:38:50 +01:00

72 lines
1.6 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(GREEN);
print("(c)");
set_current_color(WHITE);
print("Project");
set_current_color(RED);
print("RED");
set_current_color(WHITE);
print(", 2019\n");
//Hang.
for(;;) {}
return 0;
}