From 8fc07451352c571d93373c4db8657fdcb86057aa Mon Sep 17 00:00:00 2001 From: John Ousterhout Date: Thu, 26 Mar 2020 11:35:53 -0700 Subject: [PATCH] Adjust p2.patch and p3.patch so that threads kernel still builds Signed-off-by: W. Michael Petullo --- solutions/p2.patch | 12 +++++------- solutions/p3.patch | 18 ++---------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/solutions/p2.patch b/solutions/p2.patch index 5b36467..42296f4 100644 --- a/solutions/p2.patch +++ b/solutions/p2.patch @@ -1,5 +1,5 @@ diff --git a/src/threads/thread.c b/src/threads/thread.c -index 86614f5..9fa7f1c 100644 +index 86614f5..7c19894 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -15,6 +15,7 @@ @@ -10,16 +10,14 @@ index 86614f5..9fa7f1c 100644 #endif /* Random value for struct thread's `magic' member. -@@ -351,7 +352,8 @@ thread_exit (void) +@@ -350,6 +351,7 @@ thread_exit (void) + #ifdef USERPROG process_exit (); - #endif -- + syscall_exit (); -+ + #endif + /* Remove thread from all threads list, set our status to dying, - and schedule another process. That process will destroy us - when it calls thread_schedule_tail(). */ @@ -608,6 +610,10 @@ init_thread (struct thread *t, const char *name, int priority) strlcpy (t->name, name, sizeof t->name); t->stack = (uint8_t *) t + PGSIZE; diff --git a/solutions/p3.patch b/solutions/p3.patch index 9554a85..a5b10b1 100644 --- a/solutions/p3.patch +++ b/solutions/p3.patch @@ -14,7 +14,7 @@ index e997d27..1057023 100644 # Filesystem code. filesys_SRC = filesys/filesys.c # Filesystem core. diff --git a/src/devices/timer.c b/src/devices/timer.c -index 1aebae7..4b920e9 100644 +index 3ed10ad..1b14cdc 100644 --- a/src/devices/timer.c +++ b/src/devices/timer.c @@ -206,7 +206,6 @@ timer_interrupt (struct intr_frame *args UNUSED) @@ -348,7 +348,7 @@ index 53197bb..317c68a 100644 /* Wakes up all threads, if any, waiting on COND (protected by diff --git a/src/threads/thread.c b/src/threads/thread.c -index 9fa7f1c..f9f2310 100644 +index 7c19894..31e2ba6 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -5,13 +5,11 @@ @@ -512,20 +512,6 @@ index 9fa7f1c..f9f2310 100644 /* Transitions a blocked thread T to the ready-to-run state. This is an error if T is not blocked. (Use thread_yield() to make the running thread ready.) -@@ -349,11 +283,11 @@ thread_exit (void) - { - ASSERT (!intr_context ()); - -+ syscall_exit (); - #ifdef USERPROG - process_exit (); - #endif -- syscall_exit (); -- -+ - /* Remove thread from all threads list, set our status to dying, - and schedule another process. That process will destroy us - when it calls thread_schedule_tail(). */ @@ -399,26 +333,11 @@ thread_foreach (thread_action_func *func, void *aux) } } -- 2.30.2