sysret

Pentium Pro and later

Return From Operating System

sysret

SYSRET is the return instruction used in conjunction with the SYSCALL instruction to provide fast entry/exit to an operating system.

  • The ECX register, which points to the next sequential instruction after the corresponding SYSCALL instruction, is copied into the EIP register.

  • Bits [63-48] of the STAR register specify the selector that is copied into the CS register.

  • Bits [63-48]+1000b of the STAR register specify the selector that is copied into the SS register.

  • Bits [1-0] of the SS register are set to 11b (RPL of 3) regardless of the value of bits [49-48] of the STAR register.

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).

No example here: this instruction either stops the program, or belongs to a mode this emulator does not run.

Forms

Every form of sysret the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
sysret Pentium Propriv