Page 1 of 1
Restoring real-mode
Posted: Fri Aug 15, 2003 11:00 pm
by moth
What needs to be backed up before entering and restored after leaving
protected mode? The things I can think of off hand are:
all registers
GDT
IDT
Anything else? Anyone have a doc that explains how to correctly and
safly do this.
RE:Restoring real-mode
Posted: Wed Aug 20, 2003 11:00 pm
by Legend
Real mode doesn't care about GDT and IDT.
And I think you don't need to save registers like eax ...
RE:Restoring real-mode
Posted: Wed Aug 20, 2003 11:00 pm
by Jamethiel
Real mode -does- care about the IDT. You need to restore it to base 0 limit 0x3ff.
RE:Restoring real-mode
Posted: Wed Aug 20, 2003 11:00 pm
by Legend
*storesitinmind*, didn't know that
RE:Restoring real-mode
Posted: Wed Aug 20, 2003 11:00 pm
by Jamethiel
Actually, there's a neat trick you can do with this. Allocate a block of memory 0x400 bytes long, and set it as your real-mode IDT. Populate it with interrupt handlers that do an indirect jump through the address in the vector table at 0000:0000. Now you can hook interrupts before anyone else who adds their vectors afterwards, and most software doesn't think to check for this.