972
edits
[unchecked revision] | [unchecked revision] |
No edit summary |
m (Bot: Replace deprecated source tag with syntaxhighlight) |
||
(18 intermediate revisions by 15 users not shown) | |||
Line 1:
'''Protected mode''' is the
==Entering Protected Mode==
Whether the CPU is in [[Real Mode]] or in protected mode is defined by the lowest bit of the CR0 or MSW register. Example:▼
*Disable interrupts, including [[Non Maskable Interrupt|NMI]] (as suggested by Intel Developers Manual).
*Enable the [[A20 Line]].
*Load the [[Global Descriptor Table]] with segment descriptors suitable for code, data, and stack.
▲Whether the CPU is in
This example loads a descriptor table into the processor's GDTR register, and then sets the lowest bit of CR0:
<syntaxhighlight lang="asm">
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)
JMP 08h:PModeMain▼
; to load CS with proper PM32 descriptor)
PModeMain:
▲This takes you to protected mode...
; load DS, ES, FS, GS, SS, ESP
</syntaxhighlight>
==See Also==
===Articles===
*[[Real Mode]]
*[[Virtual 8086 Mode]]
===External Links===
*http://www.osdever.net/tutorials/view/the-world-of-protected-mode - very good tutorial on how to enter protected mode
*[http://www.nondot.org/sabre/os/articles/ProtectedMode/ OSRC: protected mode]
*http://home.swipnet.se/smaffy/asm/info/embedded_pmode.pdf - pragmatic tutorial on
*http://www.
*[[Wikipedia:Protected_mode|Protected mode Wikipedia page]]
*http://members.tripod.com/protected_mode/alexfru/pmtuts.html - PMode tutorials in C & Asm
[[Category:X86 CPU]]
[[Category:Operating Modes]]
|