SYSEXIT executes a fast return to privilege level 3 user code.
This instruction is a companion instruction to the SYSENTER
instruction, and can only be executed by privilege level 0 code.
Various registers need to be set up before calling this instruction:
-
SYSENTER_CS_MSRcontains the 32-bit segment selector for the privilege level 0 code segment in which the processor is currently executing. (This value is used to compute the segment selectors for the privilege level 3 code and stack segments.) -
EDXcontains the 32-bit offset into the privilege level 3 code segment to the first instruction to be executed in the user code. -
ECXcontains the 32-bit stack pointer for the privilege level 3 stack.
SYSEXIT performs the following sequence of operations:
-
Adds 16 to the value in
SYSENTER_CS_MSRand loads the sum into theCSselector register. -
Loads the instruction pointer from the
EDXregister into theEIPregister. -
Adds 24 to the value in
SYSENTER_CS_MSRand loads the sum into theSSselector register. -
Loads the stack pointer from the
ECXregister into theESPregister. -
Switches to privilege level 3.
-
Begins executing the user code at the
EIPaddress.
For more information on the use of the SYSENTER and SYSEXIT
instructions, see the Intel Architecture Software Developer's
Manual, Volume 2.