Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make the ELF entry point a physical address

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.
  • Loading branch information...
commit 2fc6c35b2fd64a15d7c4cc54c9e8733c3632039d 1 parent 68b5872
@aclements aclements authored
Showing with 8 additions and 7 deletions.
  1. +1 −1  bootmain.c
  2. +7 −6 entry.S
View
2  bootmain.c
@@ -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();
}
View
13 entry.S
@@ -25,15 +25,16 @@
.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
Please sign in to comment.
Something went wrong with that request. Please try again.