Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

Vol. 2B 4-367
INSTRUCTION SET REFERENCE, N-Z
The SYSEXIT instruction always transfers program control to a protected-mode code
segment with a DPL of 3. The instruction requires that the following conditions are
met by the operating system:
The segment descriptor for the selected user code segment selects a flat, 32-bit
code segment of up to 4 GBytes, with execute, read, accessed, and non-
conforming permissions.
The segment descriptor for selected user stack segment selects a flat, 32-bit
stack segment of up to 4 GBytes, with expand-up, read, write, and accessed
permissions.
The SYSENTER can be invoked from all operating modes except real-address mode
and virtual 8086 mode.
The SYSENTER and SYSEXIT instructions were introduced into the IA-32 architecture
in the Pentium II processor. The availability of these instructions on a processor is
indicated with the SYSENTER/SYSEXIT present (SEP) feature flag returned to the
EDX register by the CPUID instruction. An operating system that qualifies the SEP
flag must also qualify the processor family and model to ensure that the
SYSENTER/SYSEXIT instructions are actually present. For example:
IF CPUID SEP bit is set
THEN IF (Family
= 6) and (Model < 3) and (Stepping < 3)
THEN
SYSENTER/SYSEXIT_Not_Supported; FI;
ELSE
SYSENTER/SYSEXIT_Supported; FI;
FI;
When the CPUID instruction is executed on the Pentium Pro processor (model 1), the
processor returns a the SEP flag as set, but does not support the SYSENTER/SYSEXIT
instructions.
Operation
IF SYSENTER_CS_MSR[15:2] = 0 THEN #GP(0); FI;
IF CR0.PE
= 0 THEN #GP(0); FI;
IF CPL
0 THEN #GP(0); FI;
CS.SEL (SYSENTER_CS_MSR + 16); (* Segment selector for return CS *)
(* Set rest of CS to a fixed value *)
CS.BASE 0; (* Flat segment *)
CS.LIMIT FFFFFH; (* 4-GByte limit *)
CS.ARbyte.G 1; (* 4-KByte granularity *)
CS.ARbyte.S 1;
CS.ARbyte.TYPE 1011B; (* Execute, Read, Non-Conforming Code *)
CS.ARbyte.D 1; (* 32-bit code segment*)
CS.ARbyte.DPL 3;