Re: Not enough memory when entering CLI

Joshua Oreman <[email protected]> Wed, 21 Oct 2009 13:58:31 -0400
Newsgroups gmane.network.etherboot.user
Message-ID <[email protected]>
On Wed, Oct 21, 2009 at 1:19 PM, Joshua Oreman <[email protected]> wrote:
> How much memory is in your client machine? It looks like the BIOS
> isn't giving us a memory map, so we have to "guess" based on a query
> of total installed memory. Yours is the first machine I've seen that
> reports more than 4GB of memory via this interface, and it seems
> there's some nasty overflow going on...
>
> [snip]
>
> I'm not too familiar with the exact mechanism of the memory map, but
> it would seem this is a bug in gPXE. I'll work on a solution when I
> get a bit of time, unless someone else would like to do it first :-)

Found the bug:

diff --git a/src/arch/i386/firmware/pcbios/memmap.c
b/src/arch/i386/firmware/pcbios/memmap.c
index 8a30dba..817da0b 100644
--- a/src/arch/i386/firmware/pcbios/memmap.c
+++ b/src/arch/i386/firmware/pcbios/memmap.c
@@ -307,6 +307,6 @@ void get_memmap ( struct memory_map *memmap ) {
        DBG ( "INT 15,e820 failed; constructing map\n" );
        memmap->regions[0].end = ( basemem * 1024 );
        memmap->regions[1].start = 0x100000;
-       memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
+       memmap->regions[1].end = 0x100000 + ( ( uint64_t ) extmem * 1024 );
        memmap->count = 2;
 }

Without the cast, "extmem * 1024" is truncated to 32 bits.

With the cast, though, gPXE probably won't load at all, because now
relocate() will actually follow the statement by your BIOS that you
have 4GB+ of accessible RAM, and in your original message you say you
have only 2GB. Even if you did have 4GB, not all of it would be
accessible in the first 32 bits of address space, because your PCI
devices must be mapped somewhere. Currently gPXE thinks you only have
16MB of memory, which explains why you can't fit the 20MB Mellanox
card.

Perhaps the output of a boot with DEBUG=relocate,memmap,hidemem would be useful.

What type of BIOS do you have? What kind of machine? What are the
first few dozen lines of dmesg output from a Linux boot?

-- Josh

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference