]> Devi Nivas Git - cs3210-lab0.git/commitdiff
Make the ELF entry point a physical address
authorAustin Clements <amdragon@mit.edu>
Sun, 4 Sep 2011 19:51:46 +0000 (15:51 -0400)
committerAustin Clements <amdragon@mit.edu>
Sun, 4 Sep 2011 19:51:46 +0000 (15:51 -0400)
This way, the bootloader doesn't have to translate the entry point.
This also makes xv6 multiboot-compliant and follows the convention
used by Linux.

bootmain.c
entry.S

index 72f39272d7d83af2700552a41ecbc97d8b1c6bd1..d24bf665e95eaad17b09a13b449e10b484aa35c8 100644 (file)
@@ -43,7 +43,7 @@ bootmain(void)
 
   // Call the entry point from the ELF header.
   // Does not return!
-  entry = (void(*)(void))(elf->entry - KERNBASE);
+  entry = (void(*)(void))(elf->entry);
   entry();
 }
 
diff --git a/entry.S b/entry.S
index 3fe4eb5db523d7eddfc07fb8c3eb526b20cf49c5..18947b01a62b090fdd00598ca50ad63929b56508 100644 (file)
--- a/entry.S
+++ b/entry.S
 .globl multiboot_header
 multiboot_header:
   #define magic 0x1badb002
-  #define flags (1<<16 | 1<<0)
+  #define flags 0
   .long magic
   .long flags
   .long (-magic-flags)
-  .long multiboot_header  # beginning of image
-  .long multiboot_header
-  .long edata
-  .long end
-  .long entry
+
+# By convention, the _start symbol specifies the ELF entry point.
+# Since we haven't set up virtual memory yet, our entry point is
+# the physical address of 'entry'.
+.globl _start
+_start = V2P_WO(entry)
 
 # Entering xv6 on boot processor.  Machine is mostly set up.
 .globl entry