From 74b19460a4f2f26dcbea17477e56084b6867273d Mon Sep 17 00:00:00 2001 From: GlitchedCode922 <126592994+GlitchedCode922@users.noreply.github.com> Date: Sat, 14 Feb 2026 18:10:19 +0200 Subject: [PATCH] Correct GDT entries for user descriptors Shift user descriptors in GDT by 32 bits (like kernel descriptors). --- 02_Architecture/04_GDT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02_Architecture/04_GDT.md b/02_Architecture/04_GDT.md index 9f562884..398b9111 100644 --- a/02_Architecture/04_GDT.md +++ b/02_Architecture/04_GDT.md @@ -233,10 +233,10 @@ Most of this descriptor is unchanged, except for the type field. Bit 4 is cleare ```c uint64_t user_code = kernel_code | (3 << 13); -gdt_entries[3] = user_code; +gdt_entries[3] = user_code << 32; uint64_t user_data = kernel_data | (3 << 13); -gdt_entries[4] = user_data; +gdt_entries[4] = user_data << 32; ``` A more complex example of a GDT is the one used by the stivale2 boot protocol: