hippOS/kernel.c
2022-02-22 21:20:57 +02:00

44 lines
863 B
C

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "vga.h"
#include "cpu/pic.h"
#include "cpu/idt.h"
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
#if !defined(__i386__)
#error "This OS needs to be compiled with a ix86-elf compiler"
#endif
struct interrupt_frame
{
size_t ip;
size_t cs;
size_t flags;
size_t sp;
size_t ss;
} __attribute__((packed));
__attribute__((interrupt))
static void isr0(struct interrupt_frame *frame) {
terminal_writestring("division by zero");
pic_send_eoi(0);
}
void kmain(void) {
terminal_initialize();
terminal_writestring("start");
pic_remap(0x20, 0x28);
idt_register_handler(0, (size_t)isr0);
idt_init();
volatile int a = 0/0;
terminal_writestring("Hello, kernel World!\n");
}