Merge basic system calls with stack set-up infrastructure #27

Merged
td1223 merged 31 commits from user-programs into user-programs-stdout 2024-11-06 22:21:28 +00:00
2 changed files with 85 additions and 125 deletions
Showing only changes of commit 5e2342fad7 - Show all commits

View File

@@ -50,10 +50,10 @@ syscall_handler (struct intr_frame *f)
{ {
/* First, read the system call number from the stack. */ /* First, read the system call number from the stack. */
validate_user_pointer (f->esp, 1); validate_user_pointer (f->esp, 1);
int syscall_number = *(int *) f->esp; unsigned syscall_number = *(int *) f->esp;
/* Ensures the number corresponds to a system call that can be handled. */ /* Ensures the number corresponds to a system call that can be handled. */
if (syscall_number < 0 || syscall_number >= LOOKUP_SIZE) if (syscall_number >= LOOKUP_SIZE)
thread_exit (); thread_exit ();
syscall_arguments syscall = syscall_lookup[syscall_number]; syscall_arguments syscall = syscall_lookup[syscall_number];