up: Chapter 14 -- 80386 Real-Address Mode
prev: 14.4 Entering and Leaving Real-Address Mode
next: 14.6 Real-Address Mode Exceptions


14.5 Switching Back to Real-Address Mode

The processor reenters real-address mode if software clears the PE bit in CR0 with a MOV to CR0 instruction. A procedure that attempts to do this, however, should proceed as follows:
  1. If paging is enabled, perform the following sequence:
  2. Transfer control to a segment that has a limit of 64K (FFFFH). This loads the CS register with the limit it needs to have in real mode.
  3. Load segment registers SS, DS, ES, FS, and GS with a selector that points to a descriptor containing the following values, which are appropriate to real mode:
  4. Disable interrupts. A CLI instruction disables INTR interrupts. NMIs can be disabled with external circuitry.
  5. Clear the PE bit.
  6. Jump to the real mode code to be executed using a far JMP. This action flushes the instruction queue and puts appropriate values in the access rights of the CS register.
  7. Use the LIDT instruction to load the base and limit of the real-mode interrupt vector table.
  8. Enable interrupts.
  9. Load the segment registers as needed by the real-mode code.


up: Chapter 14 -- 80386 Real-Address Mode
prev: 14.4 Entering and Leaving Real-Address Mode
next: 14.6 Real-Address Mode Exceptions