[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug-fix elf.c powerpc ieee1275
From: |
Bean |
Subject: |
Re: Bug-fix elf.c powerpc ieee1275 |
Date: |
Tue, 30 Sep 2008 16:14:58 +0800 |
On Tue, Sep 30, 2008 at 3:26 PM, peter cros <address@hidden> wrote:
> The change was between svn version 1421 and 1509 which had bugfixes,
> in grub_elf32_load, and grub_elf64_load.
Hi,
The patch is for bsd loader, but it seems it uses the wrong method to
change load address. This is the right patch:
2008-09-30 Bean <address@hidden>
* kern/elf.c (grub_elf32_load): Revert to previous code.
(grub_elf64_load): Likewise.
* loader/i386/bsd.c (grub_bsd_elf32_hook): Change return address.
diff --git a/kern/elf.c b/kern/elf.c
index 2b1e223..8ddf9e5 100644
--- a/kern/elf.c
+++ b/kern/elf.c
@@ -232,9 +232,9 @@ grub_elf32_load (grub_elf_t _elf,
grub_elf32_load_hook_t _load_hook,
if (phdr->p_type != PT_LOAD)
return 0;
+ load_addr = phdr->p_paddr;
if (load_hook && load_hook (phdr, &load_addr))
return 1;
- load_addr = phdr->p_paddr;
if (load_addr < load_base)
load_base = load_addr;
@@ -411,9 +411,9 @@ grub_elf64_load (grub_elf_t _elf,
grub_elf64_load_hook_t _load_hook,
if (phdr->p_type != PT_LOAD)
return 0;
+ load_addr = phdr->p_paddr;
if (load_hook && load_hook (phdr, &load_addr))
return 1;
- load_addr = phdr->p_paddr;
if (load_addr < load_base)
load_base = load_addr;
diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c
index 4966afa..25d0f59 100644
--- a/loader/i386/bsd.c
+++ b/loader/i386/bsd.c
@@ -454,7 +454,7 @@ grub_bsd_load_aout (grub_file_t file)
}
static grub_err_t
-grub_bsd_elf32_hook (Elf32_Phdr * phdr, UNUSED grub_addr_t * addr)
+grub_bsd_elf32_hook (Elf32_Phdr * phdr, grub_addr_t * addr)
{
Elf32_Addr paddr;
@@ -472,6 +472,8 @@ grub_bsd_elf32_hook (Elf32_Phdr * phdr, UNUSED
grub_addr_t * addr)
if (paddr + phdr->p_memsz > kern_end)
kern_end = paddr + phdr->p_memsz;
+ *addr = paddr;
+
return GRUB_ERR_NONE;
}
--
Bean