Page 1 of 1
Memory Size problem.
Posted: Sat Jul 26, 2008 6:21 am
by huxuelei
Hi.
I wonder how to get the memory size in protected mode?
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 7:07 am
by Adek336
Ask GRUB to provide it, if you use GRUB.
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 9:54 am
by Alboin
Hi,
Check out the
wiki page on memory detection. If you're using GRUB, you can use the memory map it provides from protected mode. If not, however, you'll need to use the BIOS to detect it somewhere in real mode. Details are on the page.
Toodles,
Abloin
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 12:45 pm
by bewing
Unless you're using GRUB (as said above) -- once you have switched to pmode, you are too late, and SOL (you would need to switch back to real/unreal/v86 mode).
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 1:49 pm
by codemastersnake
In protected mode one way is to ask GRUB about the mem specs.
If you are using GRUB then save the global data structure that it provides and check it from there.
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 1:57 pm
by 01000101
I direct probe starting from the top of accessible memory (4GB) and work my way down in large incriments until a value returns true and then work up in smaller chunks.. doesnt take very long and is pretty efficient.
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 2:27 pm
by Brendan
Hi,
01000101 wrote:I direct probe starting from the top of accessible memory (4GB) and work my way down in large incriments until a value returns true and then work up in smaller chunks.. doesnt take very long and is pretty efficient.
I'm sure it finds the video card's memory mapped I/O area fairly quickly, but I thought you were meant to be detecting RAM (instead of trashing the APICs, HPET, etc)?
Cheers,
Brendan
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 2:30 pm
by codemastersnake
01000101 wrote:I direct probe starting from the top of accessible memory (4GB) and work my way down in large incriments until a value returns true and then work up in smaller chunks.. doesnt take very long and is pretty efficient.
Don't Do that. You'll probably mess up with imp part of memory as said above!
Re: Memory Size problem.
Posted: Sat Jul 26, 2008 2:51 pm
by 01000101
hmm, I have never had a problem with any of those things before. I added it recently and it doesn't seem to mess anything up as far as I can tell. I use that memory function before I parse SMP tables and the APIC and no false/weird values get returned.
I guess I will look into it further, but it is not a core function that NEEDS to be there, I can deal without it.
Re: Memory Size problem.
Posted: Sun Jul 27, 2008 2:16 am
by huxuelei
Hi, I do use GRUB as bootloader.
Where can I find the document about memory information in GRUB?
Re: Memory Size problem.
Posted: Sun Jul 27, 2008 2:41 am
by codemastersnake
huxuelei wrote:Hi, I do use GRUB as bootloader.
Where can I find the document about memory information in GRUB?
well I tried to upload the pdf the system says file sioze is too big, anyways here's the link:
http://www.gnu.org/software/grub/manual ... iboot.html
Re: Memory Size problem.
Posted: Sun Jul 27, 2008 3:13 am
by huxuelei
thank you.