summaryrefslogtreecommitdiff
path: root/bootmain.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-07-29 07:31:27 -0400
committerFrans Kaashoek <[email protected]>2011-07-29 07:31:27 -0400
commit9aa0337dc1452a911ac52698c833246a618fc9f3 (patch)
tree28e25817d4f7c9f7f1e6988949012f46d6c28fb7 /bootmain.c
parentdccb915282854476ce47752df6631dcce3b8f661 (diff)
downloadxv6-labs-9aa0337dc1452a911ac52698c833246a618fc9f3.tar.gz
xv6-labs-9aa0337dc1452a911ac52698c833246a618fc9f3.tar.bz2
xv6-labs-9aa0337dc1452a911ac52698c833246a618fc9f3.zip
Map kernel high
Very important to give qemu memory through PHYSTOP :(
Diffstat (limited to 'bootmain.c')
-rw-r--r--bootmain.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bootmain.c b/bootmain.c
index 7cd469f..fa2725d 100644
--- a/bootmain.c
+++ b/bootmain.c
@@ -8,6 +8,7 @@
#include "types.h"
#include "elf.h"
#include "x86.h"
+#include "memlayout.h"
#define SECTSIZE 512
@@ -19,7 +20,7 @@ bootmain(void)
struct elfhdr *elf;
struct proghdr *ph, *eph;
void (*entry)(void);
- uchar* va;
+ uchar* pa;
elf = (struct elfhdr*)0x10000; // scratch space
@@ -34,15 +35,15 @@ bootmain(void)
ph = (struct proghdr*)((uchar*)elf + elf->phoff);
eph = ph + elf->phnum;
for(; ph < eph; ph++){
- va = (uchar*)ph->va;
- readseg(va, ph->filesz, ph->offset);
+ pa = (uchar*)ph->pa;
+ readseg(pa, ph->filesz, ph->offset);
if(ph->memsz > ph->filesz)
- stosb(va + ph->filesz, 0, ph->memsz - ph->filesz);
+ stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz);
}
// Call the entry point from the ELF header.
// Does not return!
- entry = (void(*)(void))(elf->entry);
+ entry = (void(*)(void))(elf->entry & 0xFFFFFF);
entry();
}