X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Finit.c;h=855afa0340fcb66788aa03a00cc70666b17bbbae;hb=24445a35e861ddb50df05731ca4635fbd36e04a4;hp=155ccae6adf1f2b50d2450bb6739a6b183c28498;hpb=4286b9989837b940cf9d0a6800a8e69505d1a437;p=pintos-anon diff --git a/src/threads/init.c b/src/threads/init.c index 155ccae..855afa0 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -21,6 +21,7 @@ #include "threads/test.h" #include "threads/thread.h" #ifdef USERPROG +#include "userprog/process.h" #include "userprog/exception.h" #include "userprog/gdt.h" #include "userprog/syscall.h" @@ -111,8 +112,13 @@ main (void) /* Run a user program. */ if (initial_program != NULL) { + tid_t tid; printf ("\nExecuting '%s':\n", initial_program); - thread_execute (initial_program); + tid = process_execute (initial_program); +#ifdef THREAD_JOIN_IMPLEMENTED + if (tid != TID_ERROR) + thread_join (tid); +#endif } #else test (); @@ -277,6 +283,8 @@ power_off (void) #endif printf ("Powering off...\n"); + serial_flush (); + for (p = s; *p != '\0'; p++) outb (0x8900, *p); for (;;);