Page 1 of 1

hi mem - number of entries ?

Posted: Sun May 10, 2009 11:48 pm
by extremecoder
how many entries will be there when you int 0x15 with eax = 0x0000E820 ...
when I tried, there are 10 entries ... 3 for free mem, 5 for reserved mem and 2 for ACPI ...

will this be common across x86 ?

when I write the mem map code, how many structures will I have to declare ...

right now I am doing like this :

freemem_1 resb 24
freemem_2 resb 24
freemem_3 resb 24
resmem_1 resb 24
resmem_2 resb 24
resmem_3 resb 24
resmem_4 resb 24
resmem_5 resb 24
acpismem_1 resb 24
acpismem_2 resb 24

first I am doing int 0x15 with one 24 byte entry and calculating the number of entries it generates ... once the loop is done, again doing int 0x15 to fill up the ten 24 byte entries ...

want to know, is this the right method to fill up the mem map ?

i am doing all this in RM (stage2 loader) ... i haven't switched to PM ... will this be easy in PM ?

Re: hi mem - number of entries ?

Posted: Mon May 11, 2009 12:25 am
by Brendan
Hi,
extremecoder wrote:how many entries will be there when you int 0x15 with eax = 0x0000E820 ...
when I tried, there are 10 entries ... 3 for free mem, 5 for reserved mem and 2 for ACPI ...

will this be common across x86 ?
Definitely not! The computer I'm using now returns 18 entries (see this post for exact details). :)

IIRC Linux reserves space for 256 entries. My code uses RAM below the EBDA and grows as needed (and could handle over 10000 entries without any problem).


Cheers,

Brendan

Re: hi mem - number of entries ?

Posted: Mon May 11, 2009 1:15 am
by extremecoder
in that case, how do you allocate the space for the entries ?
how many entries, do you want to allocate when you want to code a mem mapper...
for example, right now i am declaring a struct of 240 bytes, assuming to handle 10 entries ...

if I don't know how many entries, it will return, then i need to do allocation dynamically ... i am not that expert in asm though... the other possibility i think is to allocate 2400 bytes of RAM (for 1000 entries) and keep a pointer of filled entries.. something like that ...

i can imagine it will be a tough job in ASM ... that is why i asked, will that be easy if do it in PM and using a C language ... :)

to handle approx 10000 entries, a mem of 235 K is required, which means almost 4 segments I need to waste for this table ??

i don't know whether my understanding is correct... am I thinking in the right path ? :)

Re: hi mem - number of entries ?

Posted: Mon May 11, 2009 1:36 am
by Brendan
Hi,
extremecoder wrote:in that case, how do you allocate the space for the entries ?
I have a pointer that keeps track of the address for the next entry, which is initially set to the address of the byte after the ".bss" section, and when I add a new entry I store it at this address and then add 24 to the pointer...


Cheers,

Brendan