Page 1 of 1
Getting total system memory.
Posted: Thu Dec 07, 2006 4:08 pm
by smbogan
I'm relatively sure this has been talked about before, but a search didn't get me anywhere.
I'm booting with GRUB straight into protected mode. What's an effective way of getting the total system memory?
Thanks for any help.
Posted: Thu Dec 07, 2006 4:59 pm
by urxae
Did you read the
Multiboot specification? Specifically, the section on the
boot information format?
Posted: Thu Dec 07, 2006 5:03 pm
by Walling
Since you use GRUB I agree with urxae. Use the multiboot information. Otherwise read
How do I determine the amount of RAM? on OsFaq2.
Posted: Mon Dec 11, 2006 12:19 am
by smbogan
Thanks, I got the info from the multiboot specification to work nicely. I'm just curious if anyone knows the following, in regaurds to the memory map structure:
where `size' is the size of the associated structure in bytes, which can be greater than the minimum of 20 bytes. `base_addr_low' is the lower 32 bits of the starting address, and `base_addr_high' is the upper 32 bits, for a total of a 64-bit starting address. `length_low' is the lower 32 bits of the size of the memory region in bytes, and `length_high' is the upper 32 bits, for a total of a 64-bit length. `type' is the variety of address range represented, where a value of 1 indicates available ram, and all other values currently indicated a reserved area.
The multiboot specification says that the type number of 1 represents available. Does anyone know what 2-4 mean. I mean beyond the definition of reserved.
Thanks.
Posted: Mon Dec 11, 2006 2:25 am
by AJ
Hi,
I think it's the same as in int15 ah=0xE820 (
http://www.ctyme.com/intr/rb-1741.htm) - at least, this method and GRUB both seem to give me the same memory regions on both Bochs and VPC...
HTH
Adam