]> Devi Nivas Git - cs3210-lab1.git/commitdiff
my comment is wrong, exec handles BSS fine
authorRobert Morris <rtm@csail.mit.edu>
Sun, 19 Sep 2010 17:47:52 +0000 (13:47 -0400)
committerRobert Morris <rtm@csail.mit.edu>
Sun, 19 Sep 2010 17:47:52 +0000 (13:47 -0400)
exec.c
usertests.c

diff --git a/exec.c b/exec.c
index a6de18fe20225cb7166a618e42c9f66d6dc2f0b8..0a9ca59ee10c1b3ae522017f5cd5f57eefb42245 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -48,9 +48,6 @@ exec(char *path, char **argv)
   }
   iunlockput(ip);
 
-  // XXX rtm: what about the BSS? shouldn't there be some
-  // bzero()ing here?
-
   // Allocate and initialize stack at sz
   sz = spbottom = PGROUNDUP(sz);
   if(!(sz = allocuvm(pgdir, sz, sz + PGSIZE)))
index 77495bfb4cd5f7e9570616b63ff6f1044dc63171..e62703d52309e81db5dc8e44e0125595e665cab5 100644 (file)
@@ -1419,6 +1419,21 @@ validatetest(void)
   printf(stdout, "validate ok\n");
 }
 
+char uninit[10000];
+void
+bsstest(void)
+{
+  int i;
+  printf(stdout, "bss test\n");
+  for(i = 0; i < sizeof(uninit); i++){
+    if(uninit[i] != '\0'){
+      printf(stdout, "bss test failed\n");
+      exit();
+    }
+  }
+  printf(stdout, "bss test ok\n");
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -1430,6 +1445,7 @@ main(int argc, char *argv[])
   }
   close(open("usertests.ran", O_CREATE));
 
+  bsstest();
   sbrktest();
   validatetest();