Total system physical memory information in linux
I am writing a test code where by I need to check the actual physical memory on the linux system. But I am not able to find the command for that. The linux commands like free, or /proc/meminfo or dmesg | grep Memory only show the physical memory available to linux but not the ACTUAL RAM available on system.
For example, my system has 2GB of RAM and I provide only 512 MB to linux (using mem=512MB command in the grub file). So when I use any of the above commands to see the physical memory they show me 512 MB and not 2GB!
Reading mtrr contents looks like a good option but I am not very sure if it will give correct data on all the systems. Can someone help me?