Syscalls working as expected

This commit is contained in:
Alex
2022-11-15 15:09:52 +02:00
parent 5dd496a73f
commit c2628019b7
10 changed files with 61 additions and 53 deletions

View File

@ -44,20 +44,6 @@ namespace GlobalDescriptorTable
.Flags = {.Raw = 0x0},
.BaseHigh = 0x0},
// user code
{.Length = 0x0,
.BaseLow = 0x0,
.BaseMiddle = 0x0,
.Access = {.A = 0,
.RW = 1,
.DC = 0,
.E = 1,
.S = 1,
.DPL = 3,
.P = 1},
.Flags = {.Unknown = 0x0, .L = 1},
.BaseHigh = 0x0},
// user data
{.Length = 0x0,
.BaseLow = 0x0,
@ -72,6 +58,20 @@ namespace GlobalDescriptorTable
.Flags = {.Raw = 0x0},
.BaseHigh = 0x0},
// user code
{.Length = 0x0,
.BaseLow = 0x0,
.BaseMiddle = 0x0,
.Access = {.A = 0,
.RW = 1,
.DC = 0,
.E = 1,
.S = 1,
.DPL = 3,
.P = 1},
.Flags = {.Unknown = 0x0, .L = 1},
.BaseHigh = 0x0},
// tss
{}};

View File

@ -55,16 +55,10 @@ namespace InterruptDescriptorTable
"pushq %r13\n"
"pushq %r14\n"
"pushq %r15\n"
// push ds segment
"movq %ds, %rax\n"
"pushq %rax\n"
"movq %rsp, %rdi\n"
"call ExceptionHandler\n"
// pop ds segment
"popq %rax\n"
// pop all registers
"popq %r15\n"
"popq %r14\n"
@ -104,16 +98,10 @@ namespace InterruptDescriptorTable
"pushq %r13\n"
"pushq %r14\n"
"pushq %r15\n"
// push ds segment
"movq %ds, %rax\n"
"pushq %rax\n"
"movq %rsp, %rdi\n"
"call MainInterruptHandler\n"
// pop ds segment
"popq %rax\n"
"popq %r15\n"
"popq %r14\n"
"popq %r13\n"

View File

@ -117,8 +117,8 @@ namespace GlobalDescriptorTable
GlobalDescriptorTableEntry Null;
GlobalDescriptorTableEntry Code;
GlobalDescriptorTableEntry Data;
GlobalDescriptorTableEntry UserCode;
GlobalDescriptorTableEntry UserData;
GlobalDescriptorTableEntry UserCode;
TaskStateSegmentEntry TaskStateSegment;
} __attribute__((packed)) GlobalDescriptorTableEntries;