Memory Size problem.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

Memory Size problem.

Post by huxuelei »

Hi.
I wonder how to get the memory size in protected mode?
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

Re: Memory Size problem.

Post by Adek336 »

Ask GRUB to provide it, if you use GRUB.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Re: Memory Size problem.

Post 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
Last edited by Alboin on Sat Jul 26, 2008 1:38 pm, edited 1 time in total.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Memory Size problem.

Post 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).
User avatar
codemastersnake
Member
Member
Posts: 148
Joined: Sun Nov 07, 2004 12:00 am
Contact:

Re: Memory Size problem.

Post 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.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Memory Size problem.

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Memory Size problem.

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
codemastersnake
Member
Member
Posts: 148
Joined: Sun Nov 07, 2004 12:00 am
Contact:

Re: Memory Size problem.

Post 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!
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Memory Size problem.

Post 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.
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

Re: Memory Size problem.

Post by huxuelei »

Hi, I do use GRUB as bootloader.
Where can I find the document about memory information in GRUB?
User avatar
codemastersnake
Member
Member
Posts: 148
Joined: Sun Nov 07, 2004 12:00 am
Contact:

Re: Memory Size problem.

Post 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
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

Re: Memory Size problem.

Post by huxuelei »

thank you.
Post Reply