]> git.buserror.net Git - polintos/scott/priv.git/blobdiff - kernel/arch/x86/descriptors.cc
Change x86 syscalls to direct branches, and define abi for additional syscalls.
[polintos/scott/priv.git] / kernel / arch / x86 / descriptors.cc
index e281895386764fec8f8481a58c5d455bfca38421..35e11f974e14dc8e8f21fe3b9091e83b4764f78d 100644 (file)
@@ -29,7 +29,7 @@ using Arch::Priv::tss;
 
 Descriptor x86_gdt[1024] = {
        {}, // The first entry is reserved for the NULL selector.
-       {   // 0x08: data
+       {   // 0x08: kernel data
                limit_low: 0xffff,
                base_low: 0,
                base_mid: 0,
@@ -37,14 +37,14 @@ Descriptor x86_gdt[1024] = {
                user: 1,
                dpl: 0,
                present: 1,
-               limit_high: 0xff,
+               limit_high: 0xf,
                sw: 0,
                reserved: 0,
                opsize: 1,
                gran: 1,
                base_high: 0
        },
-       {   // 0x10: code
+       {   // 0x10: kernel code
                limit_low: 0xffff,
                base_low: 0,
                base_mid: 0,
@@ -52,7 +52,7 @@ Descriptor x86_gdt[1024] = {
                user: 1,
                dpl: 0,
                present: 1,
-               limit_high: 0xff,
+               limit_high: 0xf,
                sw: 0,
                reserved: 0,
                opsize: 1,
@@ -73,7 +73,37 @@ Descriptor x86_gdt[1024] = {
                opsize: 0,
                gran: 0,
                base_high: 0
-       }
+       },
+       {   // 0x23: user data
+               limit_low: 0xffff,
+               base_low: 0,
+               base_mid: 0,
+               type: 2, // data segment, writable
+               user: 1,
+               dpl: 3,
+               present: 1,
+               limit_high: 0x7,
+               sw: 0,
+               reserved: 0,
+               opsize: 1,
+               gran: 1,
+               base_high: 0
+       },
+       {   // 0x2b: code
+               limit_low: 0xffff,
+               base_low: 0,
+               base_mid: 0,
+               type: 10, // code segment, readable
+               user: 1,
+               dpl: 3,
+               present: 1,
+               limit_high: 0x7,
+               sw: 0,
+               reserved: 0,
+               opsize: 1,
+               gran: 1,
+               base_high: 0
+       },
 };
 
 struct X86DescriptorTablePointer {