Tuesday, November 16, 2010

SWITCH FROM REAL MODE TO PROTECTED MODE

http://blog.csdn.net/pengyang/archive/2009/03/10/3977909.aspx

http://blog.sina.com.cn/s/blog_414c0121010005o3.html

http://blog.chinaunix.net/u3/95743/showart.php?id=2286642

Intel CPU manual, 3A, chapter 9.9.1


1. Disable interrupts. A CLI instruction disables maskable hardware interrupts. NMI interrupts can be disabled with external circuitry. (Software must guarantee that no exceptions or interrupts are generated during the mode switching operation.)
2. Execute the LGDT instruction to load the GDTR register with the base address of the GDT.
3. Execute a MOV CR0 instruction that sets the PE flag (and optionally the PG flag) in control register CR0.
4. Immediately following the MOV CR0 instruction, execute a far JMP or far CALL instruction. (This operation is typically a far jump or call to the next instruction in the instruction stream.)
5. The JMP or CALL instruction immediately after the MOV CR0 instruction changes the flow of execution and serializes the processor.

No comments: