--- Collins Chen <[EMAIL PROTECTED]> wrote: > BTW, if CPU can execute "e8 01 00" correctly in > protected mode?
Almost any 16-bit code can run correctly in protected mode if both CS ans SP refer to GDT entries with D/B flag clear. But it will run only until the first far jump. In V86 mode CPU can do far jumps and other segment registers modifications correctly. > > my code: > > movl %cr0, %eax /*exit protected mode*/ > andb $0xfe, %al > movl %eax, %cr0 After executing the above instruction, current properties of segment registers (limit, stack/address widht, etc.) will be kept by CPU, even in real mode. Before loading cr0 segment registers should refer to GDT entries with 64K limit, 16-bit stack/address width and all remaining attributes set to real mode defaults. This is explained in IA-32 Intel Architecture Software Developer's Manual Volume 3 : System Programming Guide (http://developer.intel.com/design/pro/manuals/) 9.9.2. Switching Back to Real-Address Mode Konstantin __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com
