提交 2fc6c35b 创建 作者: Austin Clements's avatar Austin Clements

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.
上级 68b58727
...@@ -43,7 +43,7 @@ bootmain(void) ...@@ -43,7 +43,7 @@ bootmain(void)
// Call the entry point from the ELF header. // Call the entry point from the ELF header.
// Does not return! // Does not return!
entry = (void(*)(void))(elf->entry - KERNBASE); entry = (void(*)(void))(elf->entry);
entry(); entry();
} }
......
...@@ -25,15 +25,16 @@ ...@@ -25,15 +25,16 @@
.globl multiboot_header .globl multiboot_header
multiboot_header: multiboot_header:
#define magic 0x1badb002 #define magic 0x1badb002
#define flags (1<<16 | 1<<0) #define flags 0
.long magic .long magic
.long flags .long flags
.long (-magic-flags) .long (-magic-flags)
.long multiboot_header # beginning of image
.long multiboot_header # By convention, the _start symbol specifies the ELF entry point.
.long edata # Since we haven't set up virtual memory yet, our entry point is
.long end # the physical address of 'entry'.
.long entry .globl _start
_start = V2P_WO(entry)
# Entering xv6 on boot processor. Machine is mostly set up. # Entering xv6 on boot processor. Machine is mostly set up.
.globl entry .globl entry
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论