Fix usermode->kernelmode transition

This commit is contained in:
Baptiste Wicht 2014-01-20 19:24:08 +01:00
parent e51a78eba1
commit b085050fa5
3 changed files with 5 additions and 3 deletions

View File

@ -90,7 +90,8 @@ static_assert(sizeof(tss_descriptor_t) == 16, "TSS descriptor in long mode is 16
struct task_state_segment_t {
uint32_t reserved_0;
uint64_t rsp0;
uint32_t rsp0_low;
uint32_t rsp0_high;
uint64_t rsp1;
uint64_t rsp2;
uint64_t reserved_1;

View File

@ -154,7 +154,7 @@ void install_irqs(){
}
void install_syscalls(){
idt_set_gate(interrupt::SYSCALL_FIRST, _syscall0, gdt::LONG_SELECTOR, 0xEE);
idt_set_gate(interrupt::SYSCALL_FIRST+0, _syscall0, gdt::LONG_SELECTOR, 0xEE);
idt_set_gate(interrupt::SYSCALL_FIRST+1, _syscall1, gdt::LONG_SELECTOR, 0xEE);
idt_set_gate(interrupt::SYSCALL_FIRST+2, _syscall2, gdt::LONG_SELECTOR, 0xEE);
idt_set_gate(interrupt::SYSCALL_FIRST+3, _syscall3, gdt::LONG_SELECTOR, 0xEE);

View File

@ -913,7 +913,8 @@ void exec_command(const std::vector<std::string>& params){
if(stack_physical){
uint64_t rsp;
asm volatile("mov %0, rsp;" : "=m" (rsp));
gdt::tss.rsp0 = rsp;
gdt::tss.rsp0_low = rsp;
gdt::tss.rsp0_high = rsp >> 32;
asm volatile("mov ax, %0; mov ds, ax; mov es, ax; mov fs, ax; mov gs, ax;"
: //No outputs