Always jump to the physical entry address of a Multiboot OS image, even
when the physical one differs from the virtual one.
This commit is contained in:
parent
247a4c4a73
commit
123b813394
4 changed files with 33 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2001-06-19 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
<rogelio@victorio.com>.
|
||||||
|
|
||||||
2001-05-30 OKUJI Yoshinori <okuji@gnu.org>
|
2001-05-30 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
* docs/grub.texi: Fix some typos. Reported by Florian Hatat
|
* docs/grub.texi: Fix some typos. Reported by Florian Hatat
|
||||||
|
|
3
NEWS
3
NEWS
|
@ -29,6 +29,9 @@ New in 1.0 - XXXX-XX-XX:
|
||||||
* The configure script now accepts `--disable-auto-linux-mem-opt', which
|
* 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
|
has the same meaning as you specify the option `--no-mem-option' to the
|
||||||
command "kernel".
|
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 in 0.5.96 - 2000-10-04:
|
||||||
* New commands, "reboot" and "halt".
|
* New commands, "reboot" and "halt".
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -62,6 +62,7 @@ Peter Astrand <altic@lysator.liu.se>
|
||||||
Ralf Medow <ralf.medow@t-online.de>
|
Ralf Medow <ralf.medow@t-online.de>
|
||||||
Ramon van Handel <vhandel@chem.vu.nl>
|
Ramon van Handel <vhandel@chem.vu.nl>
|
||||||
Roderich Schupp <rsch@ExperTeam.de>
|
Roderich Schupp <rsch@ExperTeam.de>
|
||||||
|
Rogelio M. Serrano Jr. <rogelio@victorio.com>
|
||||||
Stefan Ondrejicka <ondrej@idata.sk>
|
Stefan Ondrejicka <ondrej@idata.sk>
|
||||||
Stephen Early <steve@greenend.org.uk>
|
Stephen Early <steve@greenend.org.uk>
|
||||||
Takehiro Suzuki <takehiro@coral.ocn.ne.jp>
|
Takehiro Suzuki <takehiro@coral.ocn.ne.jp>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||||
* 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
|
* 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
|
* 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)
|
unsigned long load_flags)
|
||||||
{
|
{
|
||||||
int len, i, exec_type = 0, align_4k = 1;
|
int len, i, exec_type = 0, align_4k = 1;
|
||||||
|
entry_func real_entry_addr = 0;
|
||||||
kernel_t type = KERNEL_TYPE_NONE;
|
kernel_t type = KERNEL_TYPE_NONE;
|
||||||
unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0;
|
unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0;
|
||||||
char *str = 0, *str2 = 0;
|
char *str = 0, *str2 = 0;
|
||||||
|
@ -493,7 +494,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
else
|
else
|
||||||
/* ELF executable */
|
/* ELF executable */
|
||||||
{
|
{
|
||||||
int loaded = 0, memaddr, memsiz, filesiz;
|
unsigned loaded = 0, memaddr, memsiz, filesiz;
|
||||||
Elf32_Phdr *phdr;
|
Elf32_Phdr *phdr;
|
||||||
|
|
||||||
/* reset this to zero for now */
|
/* reset this to zero for now */
|
||||||
|
@ -519,6 +520,15 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
memsiz = phdr->p_memsz;
|
memsiz = phdr->p_memsz;
|
||||||
if (memaddr < RAW_ADDR (0x100000))
|
if (memaddr < RAW_ADDR (0x100000))
|
||||||
errnum = ERR_BELOW_1MB;
|
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! */
|
/* make sure we only load what we're supposed to! */
|
||||||
if (filesiz > memsiz)
|
if (filesiz > memsiz)
|
||||||
filesiz = memsiz;
|
filesiz = memsiz;
|
||||||
|
@ -553,8 +563,15 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!errnum)
|
if (! errnum)
|
||||||
printf (", entry=0x%x]\n", (int) entry_addr);
|
{
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
putchar ('\n');
|
putchar ('\n');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue