From e0ff07bb57167aaa67f6871b2a161324bdb325a1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 May 2019 18:23:08 +0200 Subject: [PATCH] Kernel: Make sure we load DS/ES/FS/GS/SS immediately after making the GDT. --- Kernel/i386.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index 7e55b085a2..172eccc79d 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -366,6 +366,16 @@ void gdt_init() write_raw_gdt_entry(0x0020, 0x0000ffff, 0x00cff200); flush_gdt(); + + asm volatile( + "mov %%ax, %%ds\n" + "mov %%ax, %%es\n" + "mov %%ax, %%fs\n" + "mov %%ax, %%gs\n" + "mov %%ax, %%ss\n" + :: "a"(0x10) + : "memory" + ); } static void unimp_trap()