Page 1 of 1

What is the max number of entries I ca get from 0x15 0xE820?

Posted: Thu Jul 14, 2011 1:59 pm
by shedokan
I'm trying to make a memory map and inorder to do that I need to read ll of the entries from INT 0x18 0xE820, but the problem with an unmapped memory is where can I put the memory map.
So i would like to know what is the max number of entries that the function will give me(Strictly 32bite machines) :?: so tat I can know how large the free space I am going to need should be(because I don't want to accidently overwrite something important).

So I thought putting my basic memory map at 0x00007E00, using 8byte entries will let me put I believe 61504 entries, so do you think the function will give me more than that number of entries?

Thanks

Re: What is the max number of entries I ca get from 0x15 0xE

Posted: Thu Jul 14, 2011 2:28 pm
by Brendan
Hi,
shedokan wrote:So i would like to know what is the max number of entries that the function will give me(Strictly 32bite machines) :?: so tat I can know how large the free space I am going to need should be(because I don't want to accidently overwrite something important).
There is no "officially guaranteed" maximum (other than the 4294967295 limit caused by the "continuation value" in EBX when calling the BIOS function).

A smart developer would do something like "#define MAX_E820_ENTRIES" so that it's very easy to change the limit if necessary, and then display a meaningful error message if the limit is ever exceeded (so you know if/when the limit needs to be increased a little).

This is probably exactly what Linux does. If you look in "/usr/src/linux/arch/x86/include/asm/e820.h" you'll see:

Code: Select all

#define E820MAX	128		/* number of entries in E820MAP */
Of course this would imply that 128 entries is enough for almost every x86 machine that Linux has ever run on.


Cheers,

Brendan

Re: What is the max number of entries I ca get from 0x15 0xE

Posted: Thu Jul 14, 2011 7:14 pm
by shedokan
Didn't think about that, with so many variables that are not up to me in OS development it's hard to see all of the possibilities.

I once already looked at the grub source for segment settings and things like that, so I think I'll have to keep the source code as a refrence(and I am guessing that is where you took that code).

And if it's good enough for linux and all of it's distros thenit's good enough for small OS developers like me.

Thank you very much.