From 9aa0337dc1452a911ac52698c833246a618fc9f3 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Fri, 29 Jul 2011 07:31:27 -0400 Subject: Map kernel high Very important to give qemu memory through PHYSTOP :( --- bootmain.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bootmain.c') 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(); } -- cgit v1.2.3