os/kernel/kernel.c

35 lines
851 B
C
Raw Normal View History

2024-07-11 08:56:52 +02:00
#include <kernel/tty.h>
#include <kernel/idt.h>
#include <kernel/elf.h>
2024-08-09 23:16:20 +02:00
#include <kernel/pic.h>
2024-08-10 03:49:28 +02:00
#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
2024-07-11 08:56:52 +02:00
uint8_t program[] = {
2024-08-10 01:14:29 +02:00
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
2024-08-09 23:16:20 +02:00
0xcd, 0x80, // int 0x80
2024-08-10 18:08:34 +02:00
0xb9, 0x00, 0x00, 0x80, 0x00, // mov $start, %ecx
0xff, 0xe1, // jmp *%ecx
};
2024-07-11 08:56:52 +02:00
void kernel_main(void)
{
2024-08-13 15:24:17 +02:00
/* Initialize terminal interface */
terminal_initialize();
2024-08-09 23:16:20 +02:00
init_pic();
idt_init();
2024-08-10 03:49:28 +02:00
heap_init();
2024-08-10 01:14:29 +02:00
run_program(program, sizeof(program));
2024-07-11 08:56:52 +02:00
}