[gPXE-devel] Expand heap size
Guo-Fu Tseng
cooldavid at cooldavid.org
Mon Jun 7 10:19:16 EDT 2010
On Mon, 7 Jun 2010 12:34:59 +0100, Michael Brown wrote
> On Friday 04 Jun 2010 14:30:52 Guo-Fu Tseng wrote:
> > I've come up with an idea about expanding heap memory,
> > by relocating the heap to the end of gPXE's used memory.
> >
> > More detail can see my note:
> > http://etherboot.org/wiki/soc/2010/cooldavid/notes/expandheap
> >
> > And here is the commit diff:
> > http://bbs.cooldavid.org/git/?p=gpxe.git;a=commitdiff;h=bd912047fffeebe409a
> > 785f88df58803cfde17cb
> >
> > I've tested it, and it works fine with i386 arch with librm.
> > But I'm not sure if it is reasonable, and I might miss concern
> > something.
> >
> > Asking for opinions. :)
>
> Three things:
>
> 1. Any memory (including heap memory) used is potentially going to be
> permanently lost for the duration of the system boot. (SAN boot
> mechanisms do not get a chance to unhide memory.)
Indeed. If we are going to use large heap, the amount of memory
is definitely a trade-off.
>
> 2. If you want a larger heap, can you not just increase HEAP_SIZE? I
> don't see why the rest of the patch is necessary.
>
> 3. By increasing the total memory footprint beyond 1MB, you lose the
> guarantee of residing entirely within a region with A20=0. iPXE will
> work in a region with A20=1, but gPXE may fail.
By placing the heap to the highest memory address, we can ensure that
all addresses other than heap would still be at region with A20=0.
Since gPXE have not apply your A20 patchset right now.
This is the part that I'm not sure, have not traced all your code yet.
But I'm guessing that the A20=0 limitation is for 16-bit code only.
And the parts that uses heap which written in C are running on 32-bit
protected-mode(for arch i386 with librm). So I'm hoping that it can
make gPXE safer this way.
But if the limitation is really on 16-bit code, and it dose not access
any data that is at A20=1 region(Other then relocation). The linker
script already put all .*16* sections at the begining of the image.
It might be possiable to just increase the HEAP_SIZE as you said,
without your even megabyte patchset(Not considering relocation).
Hoping I can get some tip/openion about it. :)
>
> Michael
Guo-Fu Tseng
More information about the gPXE-devel
mailing list