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

4-362 Vol. 2B
INSTRUCTION SET REFERENCE, N-Z
SYSENTER—Fast System Call
Description
Executes a fast call to a level 0 system procedure or routine. SYSENTER is a
companion instruction to SYSEXIT. The instruction is optimized to provide the
maximum performance for system calls from user code running at privilege level 3 to
operating system or executive procedures running at privilege level 0.
Prior to executing the SYSENTER instruction, software must specify the privilege
level 0 code segment and code entry point, and the privilege level 0 stack segment
and stack pointer by writing values to the following MSRs:
IA32_SYSENTER_CS — Contains a 32-bit value, of which the lower 16 bits are
the segment selector for the privilege level 0 code segment. This value is also
used to compute the segment selector of the privilege level 0 stack segment.
IA32_SYSENTER_EIP — Contains the 32-bit offset into the privilege level 0 code
segment to the first instruction of the selected operating procedure or routine.
IA32_SYSENTER_ESP — Contains the 32-bit stack pointer for the privilege level
0 stack.
These MSRs can be read from and written to using RDMSR/WRMSR. Register
addresses are listed in Table 4-6. The addresses are defined to remain fixed for future
Intel 64 and IA-32 processors.
When SYSENTER is executed, the processor:
1. Loads the segment selector from the IA32_SYSENTER_CS into the CS register.
2. Loads the instruction pointer from the IA32_SYSENTER_EIP into the EIP register.
3. Adds 8 to the value in IA32_SYSENTER_CS and loads it into the SS register.
4. Loads the stack pointer from the IA32_SYSENTER_ESP into the ESP register.
5. Switches to privilege level 0.
Opcode Instruction
64-Bit
Mode
Compat/
Leg Mode Description
0F 34 SYSENTER Valid Valid Fast call to privilege level 0 system
procedures.
Table 4-6. MSRs Used By the SYSENTER and SYSEXIT Instructions
MSR Address
IA32_SYSENTER_CS 174H
IA32_SYSENTER_ESP 175H
IA32_SYSENTER_EIP 176H