When run.out is missing in &grade_test, just return an error that
[pintos-anon] / solutions / p2.patch
index 70e5dbe4fd2b2824f5063ea3f836c7e6b94028b0..1de7f57166997b328d144103fc38c95349532a8b 100644 (file)
@@ -1,16 +1,3 @@
-Index: src/constants.h
-===================================================================
-RCS file: /afs/ir.stanford.edu/users/b/l/blp/private/cvs/pintos/src/constants.h,v
-retrieving revision 1.4
-diff -u -p -r1.4 constants.h
---- src/constants.h    19 Oct 2004 17:37:30 -0000      1.4
-+++ src/constants.h    1 Jan 2005 02:13:41 -0000
-@@ -8,4 +8,4 @@
- /*#define MACRONAME 1 */
- /* Uncomment if if you've implemented thread_join(). */
--/*#define THREAD_JOIN_IMPLEMENTED 1*/
-+#define THREAD_JOIN_IMPLEMENTED 1
 Index: src/threads/synch.c
 ===================================================================
 RCS file: /afs/ir.stanford.edu/users/b/l/blp/private/cvs/pintos/src/threads/synch.c,v
@@ -157,12 +144,12 @@ diff -u -p -r1.48 thread.c
    schedule ();
    NOT_REACHED ();
  }
-@@ -300,6 +323,26 @@ kernel_thread (thread_func *function, vo
-   function (aux);       /* Execute the thread function. */
-   thread_exit ();       /* If function() returns, kill the thread. */
- }
-+
-+/* Waits for thread with tid CHILD_TID to die. */
+@@ -283,8 +290,22 @@ thread_block (void) 
+    This function will be implemented in problem 1-2.  For now, it
+    does nothing. */
+-void
+-thread_join (tid_t child_tid UNUSED) 
+-{
 +int
 +thread_join (tid_t child_tid) 
 +{
@@ -176,14 +163,13 @@ diff -u -p -r1.48 thread.c
 +      if (child->tid == child_tid) 
 +        {
 +          latch_acquire (&child->ready_to_die);
-+          return child->exit_code; 
++          return child->exit_code;
 +        }
 +    }
 +  return -1;
-+}
\f
- /* Returns the running thread. */
- struct thread *
+ }
+ /* Sets the current thread's priority to NEW_PRIORITY. */
 @@ -336,6 +379,12 @@ init_thread (struct thread *t, const cha
    strlcpy (t->name, name, sizeof t->name);
    t->stack = (uint8_t *) t + PGSIZE;
@@ -237,14 +223,14 @@ diff -u -p -r1.28 thread.h
  
      /* Owned by thread.c. */
 @@ -120,7 +132,7 @@ void thread_exit (void) NO_RETURN;
+ void thread_exit (void) NO_RETURN;
  void thread_yield (void);
  
- /* This function will be implemented in problem 1-2. */
 -void thread_join (tid_t);
 +int thread_join (tid_t);
  
- /* These functions will be implemented in problem 1-3. */
  void thread_set_priority (int);
+ int thread_get_priority (void);
 Index: src/userprog/exception.c
 ===================================================================
 RCS file: /afs/ir.stanford.edu/users/b/l/blp/private/cvs/pintos/src/userprog/exception.c,v
@@ -293,7 +279,7 @@ diff -u -p -r1.6 process.c
  
  /* Starts a new thread running a user program loaded from
     FILENAME.  The new thread may be scheduled before
-@@ -26,31 +36,31 @@ static bool load (const char *cmdline, v
+@@ -26,31 +36,32 @@ static bool load (const char *cmdline, v
  tid_t
  process_execute (const char *filename) 
  {
@@ -334,7 +320,7 @@ diff -u -p -r1.6 process.c
 -  char *filename = filename_;
 +  struct exec_info *exec = exec_;
    struct intr_frame if_;
--  bool success;
+   bool success;
  
    /* Initialize interrupt frame and load executable. */
    memset (&if_, 0, sizeof if_);
@@ -346,10 +332,9 @@ diff -u -p -r1.6 process.c
 -
 -  /* If load failed, quit. */
 -  palloc_free_page (filename);
--  if (!success) 
-+  exec->success = load (exec->filename, &if_.eip, &if_.esp);
++  success = exec->success = load (exec->filename, &if_.eip, &if_.esp);
 +  sema_up (&exec->load_done);
-+  if (!exec->success)
+   if (!success) 
      thread_exit ();
  
    /* Switch page tables. */