]> Devi Nivas Git - cs3210-lab0.git/commitdiff
fix comments
authorrtm <rtm>
Sat, 15 Sep 2007 20:05:47 +0000 (20:05 +0000)
committerrtm <rtm>
Sat, 15 Sep 2007 20:05:47 +0000 (20:05 +0000)
bootasm.S
bootmain.c
mkfs.c

index 1b718b70e272f3f3fb6a02b577250c36ac921a8b..fc3ebf677b90366076e2d1e8c2dee78c50005bce 100644 (file)
--- a/bootasm.S
+++ b/bootasm.S
@@ -44,7 +44,7 @@ seta20.2:
 //PAGEBREAK!
   # Switch from real to protected mode, using a bootstrap GDT
   # and segment translation that makes virtual addresses 
-  # identical to their physical addresses, so that the 
+  # identical to physical addresses, so that the 
   # effective memory map does not change during the switch.
   lgdt    gdtdesc
   movl    %cr0, %eax
index 5f9e51b3ec60cee589ab292a7cd8f34d4b23564e..8ba4bd4c2c89ea44e3a124e2e7fea27f89b9558a 100644 (file)
@@ -1,10 +1,9 @@
 // Boot loader.
 // 
-// The BIOS loads boot sector (bootasm.S) from sector 0 of the disk
-// into memory and executes it.  The boot sector puts the processor
-// in 32-bit mode and calls bootmain below, which loads an ELF kernel
-// image from the disk starting at sector 1 and then jumps to the
-// kernel entry routine.
+// Part of the boot sector, along with bootasm.S, which calls bootmain().
+// bootasm.S has put the processor into protected 32-bit mode.
+// bootmain() loads an ELF kernel image from the disk starting at
+// sector 1 and then jumps to the kernel entry routine.
 
 #include "types.h"
 #include "elf.h"
@@ -34,7 +33,7 @@ bootmain(void)
   ph = (struct proghdr*)((uchar*)elf + elf->phoff);
   eph = ph + elf->phnum;
   for(; ph < eph; ph++)
-    readseg(ph->va, ph->memsz, ph->offset);
+    readseg(ph->va & 0xFFFFFF, ph->memsz, ph->offset);
 
   // Call the entry point from the ELF header.
   // Does not return!
@@ -81,7 +80,6 @@ readseg(uint va, uint count, uint offset)
 {
   uint eva;
 
-  va &= 0xFFFFFF;
   eva = va + count;
 
   // Round down to sector boundary.
diff --git a/mkfs.c b/mkfs.c
index 32bf4e77ff72047e4a095eb98d2baf91d238e296..4614f992915bb084ce95851ec79073399aee0900 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
   usedblocks = ninodes / IPB + 3 + bitblocks;
   freeblock = usedblocks;
 
-  printf("used %d (bit %d ninode %d) free %d total %d\n", usedblocks,
+  printf("used %d (bit %d ninode %lu) free %u total %d\n", usedblocks,
          bitblocks, ninodes/IPB + 1, freeblock, nblocks+usedblocks);
 
   assert(nblocks + usedblocks == size);
@@ -229,7 +229,7 @@ balloc(int used)
   for(i = 0; i < used; i++) {
     buf[i/8] = buf[i/8] | (0x1 << (i%8));
   }
-  printf("balloc: write bitmap block at sector %d\n", ninodes/IPB + 3);
+  printf("balloc: write bitmap block at sector %lu\n", ninodes/IPB + 3);
   wsect(ninodes / IPB + 3, buf);
 }