Re: why LIDT needed in Real Mode?



Wendy E. McCaughrin wrote:
I note in much working Pmode code that a necessary part of the transition
back to Real Mode is: LIDT [RM_IDT], where `RM_IDT' is a descriptor for an
IDT with limit = 64K and base-address = 0, coinciding with the Real-Mode
IVT. Why is this necessary, since Real Mode does not use the IDTR? Or does
it?

It does. The IDTR is in effect even in real mode, but most real mode code (especially older real mode code) assumes that the settings are as you describe above, so it's good practice to return them to those settings when getting back out of protected mode. Interestingly, it's possible to set up some other IDTR, say something like base=0x1c00, limit=1k and it would also work, provided the real mode code (including interrupt handlers) were set up to accomodate it. This is analgous to the old "flat real mode" trick in which descriptor limits are changed to 4G before returning to real mode.


Ed

.



Relevant Pages