Protected mode is the main operating mode of modern Intel processors (and clones) since the 80286 (16 bit). On 80386s and later, the 32 bit Protected Mode allows working with several virtual address spaces, each of which has a maximum of 4GB of addressable memory; and enables the system to enforce strict memory and hardware I/O protection as well as restricting the available instruction set via Rings.
A CPU that is initialized by the BIOS starts in Real Mode. Enabling Protected Mode unleashes the real power of your CPU. However, it will prevent you from using most of the BIOS interrupts, since these work in Real Mode (unless you have also written a V86 monitor).
Entering Protected ModeBefore switching to protected mode, you must:
Whether the CPU is in Real Mode or in Protected Mode is defined by the lowest bit of the CR0 or MSW register.
This example loads a descriptor table into the processor's GDTR register, and then sets the lowest bit of CR0:
cli ; disable interrupts lgdt [gdtr] ; load GDT register with start address of Global Descriptor Table mov eax, cr0 or al, 1 ; set PE (Protection Enable) bit in CR0 (Control Register 0) mov cr0, eax ; Perform far jump to selector 08h (offset into GDT, pointing at a 32bit PM code segment descriptor) ; to load CS with proper PM32 descriptor) jmp 08h:PModeMain PModeMain: ; load DS, ES, FS, GS, SS, ESPSee Also Articles External Links
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3