Page 1 of 1

How to detect memory in protected mode?

Posted: Sat Feb 25, 2012 6:32 am
by tas
Hello.
I am beginner in osdev.
I want recieve whole memory map.
There are described about BIOS Function: INT 0x15, EAX = 0xE820 in osdev wiki, but this function intend for real mode.
How can i get the same result in protected mode? or i need use real mode?

thanks

Re: How to detect memory in protected mode?

Posted: Sat Feb 25, 2012 6:46 am
by bubach
You should obtain this information before entering protected mode. GRUB can provide you with a memory map, or you could add memory checks to your custom bootloader.

Re: How to detect memory in protected mode?

Posted: Sat Feb 25, 2012 7:09 am
by tas
thank you, bubach!!!

Can you explain me why this function does not available in protected mode?

Re: How to detect memory in protected mode?

Posted: Sat Feb 25, 2012 7:21 am
by thepowersgang
Detecting memory is very hardware specific. If you're feeling brave you can probe, but you never know if there is memory mapped hardware there, so using a chipset specific function is best.

These are exposed by the BIOS, hence can only be accessed in real mode (because the BIOS code is real mode code, not protected mode code).

Re: How to detect memory in protected mode?

Posted: Sat Feb 25, 2012 7:26 am
by tas
thank you, thepowersgang!