From 34fb50067b95266e577239eaaebfdbdcc8052516 Mon Sep 17 00:00:00 2001 From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk> Date: Tue, 3 Dec 2019 18:15:46 +0000 Subject: [PATCH] Removing code Removed exit.c Removed exit from makefile Removed syscall_exit.c Removed syscall_exit from syscall.c Removed syscall_exit from system_calls.h --- examples/Makefile | 3 +-- examples/exit.c | 14 -------------- userprog/syscall.c | 3 --- userprog/syscall_exit.c | 15 --------------- userprog/system_calls.h | 8 -------- 5 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 examples/exit.c delete mode 100644 userprog/syscall_exit.c diff --git a/examples/Makefile b/examples/Makefile index 5978c51..41a663d 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -3,7 +3,7 @@ SRCDIR = .. # Test programs to compile, and a list of sources for each. # To add a new test, put its name on the PROGS list # and then add a name_SRC line that lists its source files. -PROGS = cat cmp cp echo exit halt hex-dump ls mcat mcp mkdir pwd rm shell \ +PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \ bubsort insult lineup matmult recursor my # Should work from project 2 onward. @@ -11,7 +11,6 @@ cat_SRC = cat.c cmp_SRC = cmp.c cp_SRC = cp.c echo_SRC = echo.c -exit_SRC = exit.c halt_SRC = halt.c hex-dump_SRC = hex-dump.c insult_SRC = insult.c diff --git a/examples/exit.c b/examples/exit.c deleted file mode 100644 index 2a45b77..0000000 --- a/examples/exit.c +++ /dev/null @@ -1,14 +0,0 @@ -/* halt.c - - Simple program to test whether running a user program works. - - Just invokes a system call that shuts down the OS. */ - -#include <syscall.h> - -int -main (void) -{ - exit (5); - /* not reached */ -} diff --git a/userprog/syscall.c b/userprog/syscall.c index cd6f391..6df0208 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -58,9 +58,6 @@ syscall_handler (struct intr_frame *f UNUSED) case SYSCALL_HALT: syscall_halt(f); break; - case SYSCALL_EXIT: - syscall_exit(f); - break; case SYSCALL_EXEC: syscall_exec(f); break; diff --git a/userprog/syscall_exit.c b/userprog/syscall_exit.c deleted file mode 100644 index 51b2208..0000000 --- a/userprog/syscall_exit.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "system_calls.h" -#include "threads/interrupt.h" // Dependency for intr_frame struct -#include "threads/thread.h" // Dependency for thread struct - -void syscall_exit(struct intr_frame *f) { - struct thread *current_thread; // creates thread struct from thread.h - current_thread = thread_current(); // Sets current thread - - // pop off first int argument from interrupt frame - int exit_code = *((int*)f->esp + 1); - current_thread->exit_code = exit_code; // Returns exit code to kernel - - thread_exit(); // Exiting current thread - f->eax = -1; // Returning -1 for success -} \ No newline at end of file diff --git a/userprog/system_calls.h b/userprog/system_calls.h index 8afd9b2..750ace2 100644 --- a/userprog/system_calls.h +++ b/userprog/system_calls.h @@ -17,14 +17,6 @@ struct file_map */ void syscall_halt(struct intr_frame *f); -/* - * Terminates the current user program, returning status to the kernel. If the - * process's parent waits for it (see below), this is the status that will be - * returned. Conventionally, a status of 0 indicates success and nonzero - * values indicate errors. - */ -void syscall_exit(struct intr_frame *f); - /* * Runs the executable whose name is given in cmd_line, passing any given * arguments, and returns the new process's program id (pid). Must return pid -- GitLab