summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-28 11:56:18 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-28 11:56:18 -0400
commit3dfffb0b8d89d22bd914daa97339d6a8161c4fdb (patch)
treecd3b79adf009f5d1f4e7642e0425c21d0bd270f2
parentanti aliasing :3 (diff)
downloadcomus-3dfffb0b8d89d22bd914daa97339d6a8161c4fdb.tar.gz
comus-3dfffb0b8d89d22bd914daa97339d6a8161c4fdb.tar.bz2
comus-3dfffb0b8d89d22bd914daa97339d6a8161c4fdb.zip
fix segments
Diffstat (limited to '')
-rw-r--r--kernel/cpu/idt.S3
-rw-r--r--kernel/user.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/kernel/cpu/idt.S b/kernel/cpu/idt.S
index 05f80c7..b3a8454 100644
--- a/kernel/cpu/idt.S
+++ b/kernel/cpu/idt.S
@@ -51,12 +51,12 @@
# segments
popw %ax
movw %ax, %gs
+ popw %ax
movw %ax, %fs
popw %ax
movw %ax, %es
popw %ax
movw %ax, %ds
- popw %ax
# regs
popq %r15
@@ -79,6 +79,7 @@
.macro ISRSave
PUSHALL
cld
+
movq %rsp, %rdi
callq isr_save
.endm
diff --git a/kernel/user.c b/kernel/user.c
index ce24b3e..8f626a7 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -175,13 +175,13 @@ static int user_setup_stack(struct pcb *pcb)
// intruction pointer
pcb->regs.rip = pcb->elf_header.e_entry;
// code segment
- pcb->regs.cs = 0x18 | 3;
+ pcb->regs.cs = USER_CODE | RING3;
// rflags
pcb->regs.rflags = (1 << 9);
// stack pointer
pcb->regs.rsp = USER_STACK_TOP;
// stack segment
- pcb->regs.ss = 0x20 | 3;
+ pcb->regs.ss = USER_DATA | RING3;
return 0;
}