46 lines
988 B
C
46 lines
988 B
C
#include <kernel/tty.h>
|
|
#include <kernel/idt.h>
|
|
#include <kernel/elf.h>
|
|
#include <kernel/pic.h>
|
|
#include <kernel/heap.h>
|
|
#include <kernel/task.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
|
|
0xcd, 0x20, // int 0x20
|
|
0xb9, 0x00, 0x00, 0x80, 0x00, // mov $start, %ecx
|
|
0xff, 0xe1, // jmp *%ecx
|
|
};
|
|
|
|
void kernel_main(void)
|
|
{
|
|
/* Initialize terminal interface */
|
|
terminal_initialize();
|
|
|
|
idt_init();
|
|
init_pic();
|
|
heap_init();
|
|
|
|
setup_tasks();
|
|
|
|
asm("sti");
|
|
|
|
run_program(program, sizeof(program));
|
|
|
|
while (true) {
|
|
asm("hlt");
|
|
}
|
|
|
|
}
|