From OSDev Wiki
Jump to: navigation, search

BIOS in Protected Mode

A few times the topic has appeared on the forums talking about software real-mode emulation to call the BIOS in protected and long mode. How this is achieved is currently outside my field of knowledge, but I think it would be a valuable addition if someone is able to add the following to the article;

1. Why can't BIOS functions be called in pmode?

2. What happens when they are called? (Beyond 'it crashes' - why? What is the CPU doing?)

3. How do software 'real mode emulators' work?

4. What are the minimum requirements of such an emulator in order to interact with the BIOS and how does it do so?

5. Could such an emulator dynamically recompile/wrap real-mode BIOS calls so you can call them from pmode/lmode natively?

--MessiahAndrw 02:56, 14 December 2009 (UTC)

Re 2: In real mode, at address given by [DS:AX] means "[(DS << 4) + AX]". In protected mode, it means [{segment descriptor indicated by DS}.base + AX]. There is little chance these two will match (even less, since the code will probably try to put new values into DS, which are not going to resolve into proper descriptors.

The BIOS code is written assuming real mode.

Nedbrek 04:01, 16 December 2009 (UTC)

Personal tools