Use `z' modifier to printf size_t.
[pintos-anon] / src / threads / init.c
index d322764a17cfb79a220be612408f30c3926f8fdf..129d7971c4969c6743daf8d77a199ae776811856 100644 (file)
@@ -1,4 +1,5 @@
 #include "threads/init.h"
+#include <console.h>
 #include <debug.h>
 #include <limits.h>
 #include <random.h>
@@ -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. */