From 03929b3cc9d91c497f96fd2b22ede86c2672b4cb Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Tue, 17 Feb 2015 11:14:29 +0100 Subject: [PATCH] hw_x86_64: Add 64-bit user code and data segments to GDT The new entries specify a 64-bit code segment with DPL 3 at index 3 and a 64-bit data segment with DPL 3 at index 4. These segments are needed for transitioning to user mode. --- repos/base-hw/src/core/spec/x86_64/kernel/crt0.s | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s index 265478c91..8c696697d 100644 --- a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s +++ b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s @@ -161,6 +161,14 @@ .long 0 /* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */ .long 0x209300 + /* 64-bit user code segment descriptor */ + .long 0 + /* GDTE_LONG | GDTE_PRESENT | GDTE_CODE | GDTE_NON_SYSTEM */ + .long 0x20f800 + /* 64-bit user data segment descriptor */ + .long 0 + /* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */ + .long 0x20f300 /* Task segment descriptor */ .long 0 /* GDTE_PRESENT | GDTE_SYS_TSS */