diff --git a/.gitignore b/.gitignore index b3ddb41aedfbab8bc3f8b59716dae0f5caa67134..fe0418548e417b12762d21108b1480b3e67fb620 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ examples/libc.a examples/my # Visual Studio folder /.vs +/CppProperties.json diff --git a/userprog/syscall_exit.c b/userprog/syscall_exit.c index 07d917f5c66b91671f7c834b42a4be96aec40bd2..4441a2715b4c4757fe6a9bb8ac41be89ca85c839 100644 --- a/userprog/syscall_exit.c +++ b/userprog/syscall_exit.c @@ -1,6 +1,11 @@ #include "system_calls.h" -#include "threads/interrupt.h" +#include "threads/thread.h" -void syscall_exit(struct intr_frame *f) { - (void*)0; +void syscall_exit(struct intr_frame *status) { + struct thread *current_thread; // creates thread struct from thread.h + current_thread = thread_current(); // Sets current thread + + current_thread->status = status; // Returning status to kernel + thread_exit(); // Exiting current thread + return -1; // Returning -1 for success } diff --git a/userprog/system_calls.h b/userprog/system_calls.h index 5d0727352769f8cdeec4775eef41c6d893f16045..7d31857b1f87c8bf0cdad8df434716acae9ec434 100644 --- a/userprog/system_calls.h +++ b/userprog/system_calls.h @@ -12,7 +12,7 @@ void syscall_halt(struct intr_frame *f); * returned. Conventionally, a status of 0 indicates success and nonzero * values indicate errors. */ -void syscall_exit(struct intr_frame *f); +void syscall_exit(struct intr_frame *status); /* * Runs the executable whose name is given in cmd_line, passing any given