X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Finit.c;h=129d7971c4969c6743daf8d77a199ae776811856;hb=62cc6ff58f8b07dea772f8acfdfd9600f9c71ff4;hp=d322764a17cfb79a220be612408f30c3926f8fdf;hpb=f2f8875638593bd5365cfd6a5ba7c9578e52322f;p=pintos-anon diff --git a/src/threads/init.c b/src/threads/init.c index d322764..129d797 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -1,4 +1,5 @@ #include "threads/init.h" +#include #include #include #include @@ -18,6 +19,7 @@ #include "threads/mmu.h" #include "threads/paging.h" #include "threads/palloc.h" +#include "threads/test.h" #include "threads/thread.h" #ifdef USERPROG #include "userprog/exception.h" @@ -52,19 +54,20 @@ int main (void) NO_RETURN; int main (void) { - /* Needed by printf(), so initialize them very early. */ + /* Initialize everything needed for printf() first. */ ram_init (); + thread_init (); vga_init (); - serial_init (); + serial_init_poll (); + console_init (); /* Greet user. */ - printf ("Booting cnachos86 with %'d kB RAM...\n", ram_pages * 4); + printf ("Pintos booting with %'zd kB RAM...\n", ram_pages * (PGSIZE / 1024)); /* Parse command line. */ argv_init (); /* Initialize memory system, segments, paging. */ - thread_init (); palloc_init (); paging_init (); #ifdef USERPROG @@ -73,7 +76,7 @@ main (void) #endif malloc_init (); - /* Set random seed if not already done. */ + /* Set random seed if argv_init() didn't. */ random_init (0); /* Initialize interrupt handlers. */ @@ -87,6 +90,7 @@ main (void) /* Start thread scheduler and enable interrupts. */ thread_start (); + serial_init_queue (); #ifdef FILESYS /* Initialize filesystem. */ @@ -96,7 +100,7 @@ main (void) #endif printf ("Boot complete.\n"); - + #ifdef USERPROG /* Run a user program. */ if (initial_program != NULL) @@ -104,6 +108,8 @@ main (void) printf ("\nExecuting '%s':\n", initial_program); thread_execute (initial_program); } +#else + test (); #endif /* Terminate this thread. */