2024-07-11 08:56:52 +02:00
|
|
|
#include <kernel/tty.h>
|
2024-08-05 00:59:07 +02:00
|
|
|
#include <kernel/idt.h>
|
2024-07-16 22:51:41 +02:00
|
|
|
#include <debugging.h>
|
2024-08-05 00:59:07 +02:00
|
|
|
#include <kernel/elf.h>
|
2024-07-16 22:51:41 +02:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
2024-08-05 00:59:07 +02:00
|
|
|
uint8_t program[] = {
|
|
|
|
/* 0xcd,
|
|
|
|
0x80,
|
|
|
|
0xc6,
|
|
|
|
0x05,
|
|
|
|
0x00,
|
|
|
|
0x80,
|
|
|
|
0x0b,
|
|
|
|
0x00,
|
|
|
|
0x62,
|
|
|
|
0xeb,
|
|
|
|
0xfe, */
|
|
|
|
/* 0x90,
|
|
|
|
0xe9,
|
|
|
|
0xfa,
|
|
|
|
0x7f,
|
|
|
|
0x7b,
|
|
|
|
0xf8, */
|
|
|
|
/* 0x90,
|
|
|
|
0xeb,
|
|
|
|
0xfd, */
|
|
|
|
0x6a,
|
|
|
|
0x69,
|
|
|
|
0xeb,
|
|
|
|
0xfc,
|
|
|
|
};
|
|
|
|
|
2024-07-11 08:56:52 +02:00
|
|
|
void kernel_main(void)
|
|
|
|
{
|
|
|
|
/* Initialize terminal interface */
|
2024-08-05 00:59:07 +02:00
|
|
|
// terminal_initialize();
|
|
|
|
|
|
|
|
idt_init();
|
2024-07-11 08:56:52 +02:00
|
|
|
|
2024-08-05 00:59:07 +02:00
|
|
|
run_program(program, 15);
|
2024-07-16 22:51:41 +02:00
|
|
|
|
2024-08-05 00:59:07 +02:00
|
|
|
/*
|
|
|
|
char buf[100];
|
2024-07-11 08:56:52 +02:00
|
|
|
|
2024-08-05 00:59:07 +02:00
|
|
|
while (true) {
|
|
|
|
asm("mov %0, %%edx" :: "r" (buf));
|
|
|
|
asm("int $0x81");
|
|
|
|
terminal_writestring("newline");
|
|
|
|
terminal_putchar('\n');
|
2024-07-11 08:56:52 +02:00
|
|
|
}
|
2024-08-05 00:59:07 +02:00
|
|
|
|
|
|
|
*/
|
2024-07-11 08:56:52 +02:00
|
|
|
}
|