[ipxe-devel] question about memory in ipxe

Levente LEVAI levail at aviatronic.hu
Sat Aug 11 16:11:37 BST 2012


Dear Michael,

Thank you for enlightening me.
> In general, be aware of the size constraints for both code and data.  For
> reference, the TCP stack is 3.1kB, the Realtek driver is 2.8kB, the script
> interpreter is 0.9kB.  Any code you add should be looking at a similar code-
> size budget.
I know that there are severe size constraints on the code, that is
why I think a more powerful scripting engine would be a good thing.
I'm planning to create something like FORTH. Probably not a
full blown FORTH interpreter but something that makes it possible
to add user interface and boot logic without need of more fancy
commands.

Another issue that I would like to solve (and is related to memory
usage) is to add POST method to the http layer, something that I
already missed when I tried to pass detailed hardware information
to my boot scripts on the server.

Levente



On 2012-08-10 21:24, Michael Brown wrote:
> On Friday 10 Aug 2012 19:54:22 Levente LEVAI wrote:
>> I would like to understand memory usage in ipxe (I would like to
>> add some more powerful interpreter to ipxe). Studying the code
>> I have got the impression that "heap" in ipxe is a rather scarce
>> resource (128kB according to core/malloc.c). What are the limitations
>> to increasing heap size?
> Any memory forming part of the heap, along with the memory used by the iPXE
> image itself, will be permanently lost for the duration of the system boot if
> booting from SAN.
>
>> I also found out that images (the image data proper, that is) are
>> stored in a separate area, allocated by umalloc(). What is the exact
>> difference between memory allocated by umalloc() and heap memory?
> Allocating memory with umalloc() changes the system memory map as reported by
> INT 15,e820.  It is therefore not allowed to allocate memory with umalloc()
> from routines that may be called by external code such as a PXE NBP.
>
>> A third kind of memory can be allocated from the stack (temporary
>> strings and arrays are typically allocated this way).
>>
>> There is a separate kind of memory used by drivers for io buffers
>> (dma-able memory, means perhaps that
>>    physical addresses == virtual address?).
> malloc_dma() just allocates memory with specified (physical) alignment
> constraints.  The memory pool is the same as that used by malloc(), i.e. the
> internal heap.
>
>> Are there any documents I should look into or the source code is
>> the only documentation? What points should I study? What
>> are the gotchas?
> No documentation exists for this kind of internal aspect of the code, apart
> from comments in the source code itself.
>
> In general, be aware of the size constraints for both code and data.  For
> reference, the TCP stack is 3.1kB, the Realtek driver is 2.8kB, the script
> interpreter is 0.9kB.  Any code you add should be looking at a similar code-
> size budget.
>
> Michael
>
>
>



More information about the ipxe-devel mailing list