From 793b5264e3bca0c9e2b5347df1024b1876a77116 Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Fri, 20 Feb 2015 16:48:31 +0100 Subject: [PATCH] hw_x86_64: Set dpl of syscall IDT entry to 3 Since this IDT entry is called from usermode the descriptor privilege level must be 3. --- repos/base-hw/src/core/include/spec/x86_64/idt.h | 3 ++- repos/base-hw/src/core/spec/x86_64/idt.cc | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/base-hw/src/core/include/spec/x86_64/idt.h b/repos/base-hw/src/core/include/spec/x86_64/idt.h index ac1353a41..f076e280b 100644 --- a/repos/base-hw/src/core/include/spec/x86_64/idt.h +++ b/repos/base-hw/src/core/include/spec/x86_64/idt.h @@ -17,7 +17,8 @@ class Genode::Idt private: enum { - SIZE_IDT = 256, + SIZE_IDT = 256, + SYSCALL_VEC = 0x80, }; /** diff --git a/repos/base-hw/src/core/spec/x86_64/idt.cc b/repos/base-hw/src/core/spec/x86_64/idt.cc index 18ab0f93f..9701305a2 100644 --- a/repos/base-hw/src/core/spec/x86_64/idt.cc +++ b/repos/base-hw/src/core/spec/x86_64/idt.cc @@ -28,6 +28,9 @@ void Idt::setup() _table[vec].offset_31_16 = (*isrs >> 16) & 0xffff; _table[vec].offset_63_32 = (*isrs >> 32) & 0xffff; } + + /* Set DPL of syscall entry to 3 */ + _table[SYSCALL_VEC].flags = _table[SYSCALL_VEC].flags | 0x6000; }