]> code.bitgloo.com Git - clyne/osdev.git/commitdiff
user mode: fix segments
authorClyne Sullivan <clyne@bitgloo.com>
Sun, 29 Sep 2024 12:47:28 +0000 (08:47 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Sun, 29 Sep 2024 12:47:28 +0000 (08:47 -0400)
Makefile
idt.cpp
idt.hpp

index 284f931e0fc3b75a6a45c52845ca3fb800397ecb..cb089919eb0c7023fc8fce7d525f81b5cc1e5a87 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -39,5 +39,5 @@ clean:
 
 run: myos.iso
        @echo "  QEMU"
-       @qemu-system-i386 -drive file=$<,index=2,media=cdrom -monitor stdio -no-reboot -s -S #-d int
+       @qemu-system-i386 -drive file=$<,index=2,media=cdrom -monitor stdio -no-reboot #-s -S #-d int
 
diff --git a/idt.cpp b/idt.cpp
index c889c14667846fdf886340c76323d302551a4846..de15ec9ca840dea87b121bdd0250a413d878806b 100644 (file)
--- a/idt.cpp
+++ b/idt.cpp
@@ -62,10 +62,22 @@ struct StubEntry
 
         asm volatile(R"(
             pusha
+            mov %%ds, %%ax
+            push %%ax
+            mov $0x10, %%ax
+            mov %%ax, %%ds
+            mov %%ax, %%es
+            mov %%ax, %%fs
+            mov %%ax, %%gs
             push %0
             cld
             call interruptGeneralHandler
             pop %%eax
+            pop %%ax
+            mov %%ax, %%ds
+            mov %%ax, %%es
+            mov %%ax, %%fs
+            mov %%ax, %%gs
             popa
             add $0x4, %%esp
             iret
diff --git a/idt.hpp b/idt.hpp
index c9092dd8c2cb32f6c1a811f60f0b303e8032585b..c5e7e47d889586b0bd7a69e8cc89c5929236f872 100644 (file)
--- a/idt.hpp
+++ b/idt.hpp
@@ -7,6 +7,7 @@
 struct Registers
 {
     std::uint32_t inum;
+    std::uint32_t ds;
     std::uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
     std::uint32_t error;
     std::uint32_t eip, cs, eflags;