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>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#define SYS_READ 0
|
||||
#define SYS_WRITE 1
|
||||
#define SYS_OPEN 2
|
||||
#define SYS_CLOSE 3
|
||||
|
||||
static inline long syscall(long num, long a1, long a2, long a3)
|
||||
{
|
||||
long ret;
|
||||
@@ -8,7 +13,6 @@ static inline long syscall(long num, long a1, long a2, long a3)
|
||||
"syscall"
|
||||
: "=a"(ret)
|
||||
: "a"(num), "D"(a1), "S"(a2), "d"(a3)
|
||||
:
|
||||
);
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user