Integrate struct addrspace into struct thread.
[pintos-anon] / src / threads / thread.c
index 36f33daa3fc69cddb16be2341414bf9f2cdc8137..540041d4d0c57eb476ff0d9eecd3c950913866a3 100644 (file)
@@ -126,7 +126,7 @@ thread_execute (const char *filename)
   if (t == NULL)
     return false;
   
-  if (!addrspace_load (&t->addrspace, filename, &start)) 
+  if (!addrspace_load (t, filename, &start)) 
     PANIC ("%s: program load failed", filename);
 
   /* Interrupt frame. */
@@ -336,6 +336,7 @@ destroy_thread (struct thread *t)
   ASSERT (t->status == THREAD_DYING);
   ASSERT (t != thread_current ());
 
+  addrspace_destroy (t);
   palloc_free (t);
 }
 
@@ -363,7 +364,7 @@ schedule_tail (struct thread *prev)
     destroy_thread (prev);
 
 #ifdef USERPROG
-  addrspace_activate (&cur->addrspace);
+  addrspace_activate (cur);
 #endif
 }