Detecting memory
Posted: Fri Aug 22, 2008 9:18 am
Hi,
I am creating a mechanism at boot-time, for when the user has not got enough memory. Seems hard to believe, as I have started at 8MB RAM in bochs and gone down 1 by 1 until it has stopped working at my memory tests. When I have 4MB as the amount of RAM available, the system freezes when allocating memory, so that's the amount i need to check for.
However, when getting the amount of memory from GRUB and adding the upper memory and lower memory together and dividing the total (to get the memory available in megabytes) it's not what I expected the memory to be. It prints out the value of the megabytes detected, and that is 2MB when I tell bochs to give the emulation 4MB. It's 6MB when I told bochs to give the emulation 8MB. So, logically I got my code to add 2 to whatever the calculated value was. I tried this trick when giving the emulation 32MB, but the amount reported by my OS was 33MB. So obviously that is not the right way of doing it. Anyone know of a method the get *accurate* values for the amount of RAM?
~souradipm
I am creating a mechanism at boot-time, for when the user has not got enough memory. Seems hard to believe, as I have started at 8MB RAM in bochs and gone down 1 by 1 until it has stopped working at my memory tests. When I have 4MB as the amount of RAM available, the system freezes when allocating memory, so that's the amount i need to check for.
However, when getting the amount of memory from GRUB and adding the upper memory and lower memory together and dividing the total (to get the memory available in megabytes) it's not what I expected the memory to be. It prints out the value of the megabytes detected, and that is 2MB when I tell bochs to give the emulation 4MB. It's 6MB when I told bochs to give the emulation 8MB. So, logically I got my code to add 2 to whatever the calculated value was. I tried this trick when giving the emulation 32MB, but the amount reported by my OS was 33MB. So obviously that is not the right way of doing it. Anyone know of a method the get *accurate* values for the amount of RAM?
~souradipm