Files
KirkOS/src/arch/x86_64/gdt_asm.S
T
kaguya e6e8b1209b sys: Refactor GDT initialization, enhance syscall handling, and improve user mode entry
Finally we got usermode working again, It took awhile but we got it done. A few things we did in this commit:

- Simplified GDT entry initialization in gdt.c for kernel and user segments.
- Fixed TSS structure for task switching.
- Implemented cr2 handling in a page fault.
- Enhanced user stack setup in usermode.c to return the correct RSP.
- Improved syscall implementation in syscall.c, including new syscall numbers.
- Updated syscall entry to correctly handle context switching and argument passing.
- Refactored init.c to demonstrate file operations using syscalls.
- Added new syscalls for file operations in syscalls.h.
- Modified VFS to handle leading slashes in paths correctly.

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
2026-04-26 02:06:28 -04:00

27 lines
370 B
ArmAsm

.intel_syntax noprefix
.global x86_64_GDT_Load
.extern gdt_pointer
.global gdt_reload
gdt_reload:
lgdt [rip + gdt_pointer]
push 0x08
lea rax, [rip + .flush]
push rax
lretq
.flush:
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
ret
.global tss_reload
tss_reload:
mov ax, 0x2B
ltr ax
ret