os/kernel/kernel.c
2024-08-13 15:24:17 +02:00

35 lines
851 B
C

#include <kernel/tty.h>
#include <kernel/idt.h>
#include <kernel/elf.h>
#include <kernel/pic.h>
#include <kernel/heap.h>
#include <debugging.h>
/* Check if the compiler thinks you are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
uint8_t program[] = {
0xba, 0x01, 0x00, 0x00, 0x00, // mov 1, %edx
0xb8, 0xff, 0x00, 0x80, 0x00, // mov $buffer, %eax
0xcd, 0x80, // int 0x80
0xba, 0x00, 0x00, 0x00, 0x00, // mov 0, %edx
0xcd, 0x80, // int 0x80
0xb9, 0x00, 0x00, 0x80, 0x00, // mov $start, %ecx
0xff, 0xe1, // jmp *%ecx
};
void kernel_main(void)
{
/* Initialize terminal interface */
terminal_initialize();
init_pic();
idt_init();
heap_init();
run_program(program, sizeof(program));
}