[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] generic ELF loading
From: |
Hollis Blanchard |
Subject: |
Re: [PATCH] generic ELF loading |
Date: |
Tue, 24 Oct 2006 15:03:00 -0500 |
On Sat, 2006-10-14 at 17:33 +0200, Yoshinori K. Okuji wrote:
> On Saturday 14 October 2006 00:37, Hollis Blanchard wrote:
> > This patch adds generic ELF loading infrastructure for both 32-bit and
> > 64-bit ELF. It provides an "iterate" function for program headers, and a
> > "load" function for convenience.
>
> The idea is very good. But I don't like that loaded areas are always
> allocated
> from the heap. GRUB has a staging area for OS images on i386-pc, and I prefer
> to load an image directly instead of consuming the heap.
Actually I'm not using the heap, I'm just directly copying wherever
phdr->p_paddr says to. That's not a good thing actually; in the future
we should add some error checking to make sure we don't clobber GRUB
itself.
Also, I made sure that the load hook could veto loading each segment. So
the x86 loader would do something like this:
int x86_load_hook (Elf32_Phdr *phdr)
{
if (phdr->p_paddr not in x86 OS load area)
return 1;
return 0;
}
grub_elf32_load (elf, x86_load_hook);
-Hollis