Add support for some basic system calls and args handling correctly. #29

Merged
sb3923 merged 49 commits from system-calls into master 2024-11-07 19:36:30 +00:00
2 changed files with 91 additions and 19 deletions
Showing only changes of commit 79f6a8e808 - Show all commits

View File

@@ -57,10 +57,11 @@ syscall_handler (struct intr_frame *f)
syscall_arguments syscall = syscall_lookup[syscall_number]; syscall_arguments syscall = syscall_lookup[syscall_number];
/* Next, read and copy the arguments from the stack pointer. */ /* Next, read and copy the arguments from the stack pointer. */
validate_user_pointer (f->esp, syscall.arity); validate_user_pointer (f->esp + sizeof (uintptr_t),
uintptr_t args[3]; syscall.arity * sizeof (uintptr_t));
uintptr_t args[3] = {0};
for (int i=0; i < syscall.arity; i++) for (int i=0; i < syscall.arity; i++)
args[i] = *(uintptr_t *) (f->esp + 1 + i); args[i] = *(uintptr_t *) (f->esp + sizeof (uintptr_t) * (i + 1));
/* Call the function that handles this system call with the arguments. When /* Call the function that handles this system call with the arguments. When
there is a return value it is stored in f->eax. */ there is a return value it is stored in f->eax. */