From 6f5301afb3a021118c54265766fd1ed0d1e52e48 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 6 Mar 2007 21:44:40 +0000 Subject: [PATCH] When zero'ing memory, zero the section MEMORY size, not the FILE size. trivial fix. Linux now boots on BOTH bochs and qemu. Signed-off-by: Ronald G. Minnich Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@206 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- lib/elfboot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/elfboot.c b/lib/elfboot.c index b14ebf6c43..4ab65a3619 100644 --- a/lib/elfboot.c +++ b/lib/elfboot.c @@ -87,6 +87,7 @@ static int load_elf_segments(struct lb_memory *mem,unsigned char *header, int he ehdr = (Elf_ehdr *)header; phdr = (Elf_phdr *)(&header[ehdr->e_phoff]); + printk(BIOS_DEBUG, "%s: header %p #headers %d\n", header, headers); int i; int size; for(i = 0; i < headers; i++) { @@ -116,8 +117,8 @@ static int load_elf_segments(struct lb_memory *mem,unsigned char *header, int he * then copy out the data, which may be a subset of the total area. * the cache, after all, is your friend. */ - printk(BIOS_INFO, "set %p to 0 for %d bytes\n", (unsigned char *)phdr[i].p_paddr, 0, size); - memset((unsigned char *)phdr[i].p_paddr, 0, size); + printk(BIOS_INFO, "set %p to 0 for %d bytes\n", (unsigned char *)phdr[i].p_paddr, phdr[i].p_memsz); + memset((unsigned char *)phdr[i].p_paddr, 0, phdr[i].p_memsz); /* ok, copy it out */ printk(BIOS_INFO, "Copy to %p from %p for %d bytes\n", (unsigned char *)phdr[i].p_paddr, &header[phdr[i].p_offset], size); memcpy((unsigned char *)phdr[i].p_paddr, &header[phdr[i].p_offset], size);