SYSRET is the return instruction used in conjunction with the
SYSCALL instruction to provide fast entry/exit to an operating system.
-
The
ECXregister, which points to the next sequential instruction after the correspondingSYSCALLinstruction, is copied into theEIPregister. -
Bits [63-48] of the
STARregister specify the selector that is copied into theCSregister. -
Bits [63-48]+1000b of the
STARregister specify the selector that is copied into theSSregister. -
Bits [1-0] of the
SSregister are set to 11b (RPL of 3) regardless of the value of bits [49-48] of theSTARregister.
The CS and SS registers should not be modified by the operating
system between the execution of the SYSCALL instruction and its
corresponding SYSRET instruction.
For more information, see the SYSCALL and SYSRET Instruction Specification
(AMD document number 21086.pdf).