An doubt about detecting amount of RAM

Programming, for all ages and all languages.
Post Reply
nikito
Member
Member
Posts: 42
Joined: Thu Jul 15, 2010 7:16 pm

An doubt about detecting amount of RAM

Post by nikito »

Hi!

I have read the detecting memory page on the Osdev-wiki.
There are talking about using BIOS function, and use the E*X extended register in the some time. I miss a point here. Need to call BIOS trough protected mode? What directive have to use in NASM([bits 16] or [bits 32]) or some prefixes.

Thanks for the help!
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: An doubt about detecting amount of RAM

Post by neon »

Hello,

Typically the boot loader would pass this information to the operating system. If this is not possible, you may need to fall back to real mode or v86 mode in order to use the BIOS services for detecting memory.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: An doubt about detecting amount of RAM

Post by bewing »

But the answer to your other question is that you use the "operand size prefix" in order to use extended registers when you are in real mode. NASM will know to put one in for you, and you do not need to do anything other than say "MOV EAX, 0xe820". You should be in "BITS 16" mode.
nikito
Member
Member
Posts: 42
Joined: Thu Jul 15, 2010 7:16 pm

Re: An doubt about detecting amount of RAM

Post by nikito »

Thanks guys!
Post Reply