12.07.2015 Views

Geode GXLV Processor Series Low Power Integrated x86 Solutions

Geode GXLV Processor Series Low Power Integrated x86 Solutions

Geode GXLV Processor Series Low Power Integrated x86 Solutions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Processor</strong> Programming (Continued)3.9.3.1 GatesGate descriptors described in Section “Gate Descriptors”on page 74, provide protection for privilege transfersamong executable segments. Gates are used to transitionto routines of the same or a more privileged level. Callgates, interrupt gates and trap gates are used for privilegetransfers within a task. Task gates are used to transferbetween tasks.Gates conform to the standard rules of privilege. In otherwords, gates can be accessed by a task if the effectiveprivilege level (EPL) is the same or more privileged thanthe gate descriptor’s privilege level (DPL).3.9.4 Initialization and Transition to Protected ModeThe <strong>GXLV</strong> processor core switches to real mode immediatelyafter RESET. While operating in real mode, the systemtables and registers should be initialized. The GDTRand IDTR must point to a valid GDT and IDT, respectively. Thesize of the IDT should be at least 256 bytes, and the GDTmust contain descriptors that describe the initial code anddata segments.Theprocessorcanbeplacedinprotectedmodebysettingthe PE bit (CR0 register bit 0). After enabling protectedmode, the CS register should be loaded and the instructiondecode queue should be flushed by executing anintersegment JMP. Finally, all data segment registersshould be initialized with appropriate selector values.3.10 VIRTUAL 8086 MODEBoth real mode and virtual 8086 (V86) modes are supportedby the <strong>GXLV</strong> processor, allowing execution of 8086application programs and 8086 operating systems. V86mode allows the execution of 8086-type applications, yetstill permits use of the paging and protection mechanisms.V86 tasks run at privilege level 3. Before entry, all segmentlimits must be set to FFFFh (64K) as in real mode.3.10.1 Memory AddressingWhile in V86 mode, segment registers are used in anidentical fashion to real mode. The contents of the Segmentregister are multiplied by 16 and added to the offsetto form the Segment Base Linear Address. The <strong>GXLV</strong> processorpermits the operating system to select which programsuse the V86 address mechanism and whichprograms use protected mode addressing for each task.The <strong>GXLV</strong> processor also permits the use of paging whenoperating in V86 mode. Using paging, the 1 MB addressspace of the V86 task can be mapped to any region in the4 GB linear address space.The paging hardware allows multiple V86 tasks to runconcurrently, and provides protection and operating systemisolation. The paging hardware must be enabled torun multiple V86 tasks or to relocate the address space ofa V86 task to physical address space other than 0.3.10.2 ProtectionAll V86 tasks operate with the least amount of privilege(level 3) and are subject to all CPU protected mode protectionchecks. As a result, any attempt to execute a privilegedinstruction within a V86 task results in a generalprotection fault.In V86 mode, a slightly different set of instructions aresensitive to the I/O privilege level (IOPL) than in protectedmode. These instructions are: CLI, INT n, IRET, POPF,PUSHF, and STI. The INT3, INTO and BOUND variationsof the INT instruction are not IOPL sensitive.3.10.3 Interrupt HandlingTo fully support the emulation of an 8086-type machine,interrupts in V86 mode are handled as follows. When aninterrupt or exception is serviced in V86 mode, programexecution transfers to the interrupt service routine at privilegelevel 0 (i.e., transition from V86 to protected modeoccurs). The VM bit in the EFLAGS register (bit 17) iscleared. The protected mode interrupt service routinethen determines if the interrupt came from a protectedmode or V86 application by examining the VM bit in theEFLAGS image stored on the stack. The interrupt serviceroutine may then choose to allow the 8086 operating systemto handle the interrupt or may emulate the function ofthe interrupt handler. Following completion of the interruptservice routine, an IRET instruction restores the EFLAGSregister (restores VM = 1) and segment selectors andcontrol returns to the interrupted V86 task.3.10.4 Entering and Leaving Virtual 8086 ModeV86 mode is entered from protected mode by either executingan IRET instruction at CPL = 0 or by task switching.If an IRET is used, the stack must contain an EFLAGSimage with VM = 1. If a task switch is used, the TSS mustcontain an EFLAGS image containing a 1 in the VM bitposition. The POPF instruction cannot be used to enterV86 mode since the state of the VM bit is not affected.V86 mode can only be exited as the result of an interruptor exception. The transition out must use a 32-bit trap orinterrupt gate that must point to a non-conforming privilegelevel 0 segment (DPL = 0), or a 32-bit TSS. Theserestrictions are required to permit the trap handler to IRETback to the V86 program.<strong>Geode</strong> <strong>GXLV</strong> <strong>Processor</strong> <strong>Series</strong>Revision 1.3 93 www.national.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!