#include #include #include #include /* 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[] = { 0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0x0 (Just a simple NOP-like instruction) 0xF4 // hlt (halts the CPU, should trap to kernel if interrupts enabled) }; void kernel_main(void) { /* Initialize terminal interface */ // terminal_initialize(); idt_init(); // asm("int $13"); // asm("ljmp $0x18, $0x00c00100"); // Example: Far jump to user code segment with selector 0x18 print_hex_bytes(idt_init, 4); terminal_putchar('\n'); run_program(program, 15); /* char buf[100]; while (true) { asm("mov %0, %%edx" :: "r" (buf)); asm("int $0x81"); terminal_writestring("newline"); terminal_putchar('\n'); } */ }