diff --git a/ChangeLog b/ChangeLog index 6750ed726..66c4ebf85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-06-19 OKUJI Yoshinori + + * stage2/boot.c (load_image): If the image is a Multiboot ELF OS + image, get the physical entry address, when a loaded memory + segment contains it. And, set ENTRY_ADDR to it, after printing + out the virtual one. Suggested by Rogelio M. Serrano Jr. + . + 2001-05-30 OKUJI Yoshinori * docs/grub.texi: Fix some typos. Reported by Florian Hatat diff --git a/NEWS b/NEWS index 90d7342cb..6f1f68759 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,9 @@ New in 1.0 - XXXX-XX-XX: * The configure script now accepts `--disable-auto-linux-mem-opt', which has the same meaning as you specify the option `--no-mem-option' to the command "kernel". +* Jump to the physical entry address of a Multiboot kernel when booting + it up. The old behavior was to use the virtual one, regardless of the + setting of the physical address. New in 0.5.96 - 2000-10-04: * New commands, "reboot" and "halt". diff --git a/THANKS b/THANKS index b712222fa..56d2b5aef 100644 --- a/THANKS +++ b/THANKS @@ -62,6 +62,7 @@ Peter Astrand Ralf Medow Ramon van Handel Roderich Schupp +Rogelio M. Serrano Jr. Stefan Ondrejicka Stephen Early Takehiro Suzuki diff --git a/stage2/boot.c b/stage2/boot.c index beb927055..3d2000c55 100644 --- a/stage2/boot.c +++ b/stage2/boot.c @@ -2,7 +2,7 @@ /* * GRUB -- GRand Unified Bootloader * Copyright (C) 1996 Erich Boleyn - * Copyright (C) 1999, 2000 Free Software Foundation, Inc. + * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type, unsigned long load_flags) { int len, i, exec_type = 0, align_4k = 1; + entry_func real_entry_addr = 0; kernel_t type = KERNEL_TYPE_NONE; unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0; char *str = 0, *str2 = 0; @@ -493,7 +494,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type, else /* ELF executable */ { - int loaded = 0, memaddr, memsiz, filesiz; + unsigned loaded = 0, memaddr, memsiz, filesiz; Elf32_Phdr *phdr; /* reset this to zero for now */ @@ -519,6 +520,15 @@ load_image (char *kernel, char *arg, kernel_t suggested_type, memsiz = phdr->p_memsz; if (memaddr < RAW_ADDR (0x100000)) errnum = ERR_BELOW_1MB; + + /* If the memory range contains the entry address, get the + physical address here. */ + if (type == KERNEL_TYPE_MULTIBOOT + && (unsigned) entry_addr >= phdr->p_vaddr + && (unsigned) entry_addr < phdr->p_vaddr + memsiz) + real_entry_addr = (entry_func) ((unsigned) entry_addr + + memaddr - phdr->p_vaddr); + /* make sure we only load what we're supposed to! */ if (filesiz > memsiz) filesiz = memsiz; @@ -553,8 +563,15 @@ load_image (char *kernel, char *arg, kernel_t suggested_type, } } - if (!errnum) - printf (", entry=0x%x]\n", (int) entry_addr); + if (! errnum) + { + grub_printf (", entry=0x%x]\n", (unsigned) entry_addr); + + /* If the entry address is physically different from that of the ELF + header, correct it here. */ + if (real_entry_addr) + entry_addr = real_entry_addr; + } else { putchar ('\n');