From d54a55aad0fdc7c005f955df0bfaebb813c648bd Mon Sep 17 00:00:00 2001 From: pjht Date: Mon, 11 Feb 2019 13:43:40 -0600 Subject: [PATCH] Get sycalls working in usermode (And all interrupts) --- cpu/i386/idt.c | 2 +- kernel/kernel.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cpu/i386/idt.c b/cpu/i386/idt.c index fc1551e..11fb823 100644 --- a/cpu/i386/idt.c +++ b/cpu/i386/idt.c @@ -8,7 +8,7 @@ void set_idt_gate(int n,uint32_t handler) { idt[n].low_offset=low_16(handler); idt[n].sel=KERNEL_CS; idt[n].always0=0; - idt[n].flags=0x8E; + idt[n].flags=0xEE; idt[n].high_offset=high_16(handler); } diff --git a/kernel/kernel.c b/kernel/kernel.c index 07fb1e1..0da7263 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -27,26 +27,26 @@ void kmain(multiboot_info_t* header) { } vga_init(info); vga_write_string("Hello\n"); - // asm volatile(" \ - // cli; \ - // mov $0x23, %ax; \ - // mov %ax, %ds; \ - // mov %ax, %es; \ - // mov %ax, %fs; \ - // mov %ax, %gs; \ - // \ - // mov %esp, %eax; \ - // pushl $0x23; \ - // pushl %eax; \ - // pushf; \ - // pop %eax; \ - // or $0x200,%eax; \ - // push %eax; \ - // pushl $0x1B; \ - // push $1f; \ - // iret; \ - // 1: \ - // "); + asm volatile(" \ + cli; \ + mov $0x23, %ax; \ + mov %ax, %ds; \ + mov %ax, %es; \ + mov %ax, %fs; \ + mov %ax, %gs; \ + \ + mov %esp, %eax; \ + pushl $0x23; \ + pushl %eax; \ + pushf; \ + pop %eax; \ + or $0x200,%eax; \ + push %eax; \ + pushl $0x1B; \ + push $1f; \ + iret; \ + 1: \ + "); vga_write_string("UMODE!\n"); port_byte_out(0xe9,'U'); port_byte_out(0xe9,'M');