3-686
INSTRUCTION SET REFERENCE
SYSEXIT—Fast Transition from System Call Entry Point
(Continued)
The presence of this facility is indicated by the SYSENTER Present (SEP) bit 11 of CPUID. An
operating system that detects the presence of the SEP bit must also qualify the processor family
and model to ensure that the SYSENTER/SYSEXIT instructions are actually present, as
described for the SYSENTER instruction. The Pentium
®
Pro processor (Model = 1) returns a set
SEP CPUID feature bit, but does not support the SYSENTER/SYSEXIT instructions.
Operation
SYSEXIT
IF SYSENTER_CS_MSR == 0 THEN #GP(0)
IF CR0.PE == 0 THEN #GP(0)
IF CPL <> 0 THEN #GP(0)
// Changing CS:EIP and SS:ESP is required
CS.SEL := (SYSENTER_CS_MSR + 16)// Selector for return CS
CS.SEL.RPL := 3
// Set rest of CS to a fixed value
CS.SEL.BASE := 0
// Flat segment
CS.SEL.LIMIT := 0xFFFF
// 4G limit
CS.SEL.G := 1
// 4 KB granularity
CS.SEL.S := 1
CS.SEL.TYPE_xCRA := 1011
// Execute, Read, Non-Conforming Code
CS.SEL.D := 1
// 32 bit code
CS.SEL.DPL := 3
CS.SEL.P := 1
SS.SEL := (SYSENTER_CS_MSR + 24)
SS.SEL.RPL := 3
// Set rest of SS to a fixed value
SS.SEL.BASE := 0
// Flat segment
SS.SEL.LIMIT := 0xFFFF
// 4G limit
SS.SEL.G := 1
// 4 KB granularity
SS.SEL.S := 1
SS.SEL.TYPE_xCRA := 0011
// Expand Up, Read/Write, Data
SS.SEL.D := 1
// 32 bit stack
SS.SEL.DPL := 3
SS.SEL.CPL := 3
SS.SEL.P := 1
ESP := ECX
EIP := EDX