Get sycalls working in usermode (And all interrupts)

This commit is contained in:
pjht 2019-02-11 13:43:40 -06:00
parent b3e086e452
commit d54a55aad0
2 changed files with 21 additions and 21 deletions

View File

@ -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);
}

View File

@ -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');