How to detect memory in protected mode?

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
tas
Posts: 3
Joined: Sun Feb 19, 2012 10:21 am

How to detect memory in protected mode?

Post 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
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: How to detect memory in protected mode?

Post 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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
tas
Posts: 3
Joined: Sun Feb 19, 2012 10:21 am

Re: How to detect memory in protected mode?

Post by tas »

thank you, bubach!!!

Can you explain me why this function does not available in protected mode?
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: How to detect memory in protected mode?

Post 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).
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
tas
Posts: 3
Joined: Sun Feb 19, 2012 10:21 am

Re: How to detect memory in protected mode?

Post by tas »

thank you, thepowersgang!
Post Reply