Extensions
Forms
3 (3 Legacy)
Data
Intel XED v2026.08.23

SYSRET is the way back from a SYSCALL: at CPL 0 it jumps to the address in RCX, loads RFLAGS from R11 and enters CPL 3, with CS and SS selectors taken from bits 63:48 of the IA32_STAR MSR and descriptors that the processor fills in itself rather than reading the GDT, which the operating system must keep matching. RSP stays as it is, so the kernel loads the user’s stack pointer itself before SYSRET, or the program does after it.

Which mode it returns to

With REX.W, SYSRET returns to 64-bit code at STAR[63:48] + 16; without it, to compatibility mode at STAR[63:48], with EIP from ECX. The mnemonic decides which: in our builds the GNU assembler rejects a bare sysret in Intel syntax and in AT&T syntax assembles it, with a warning, as the 32-bit 0F 07; Clang 23 assembles sysret as 0F 07 in both, silently. A 64-bit return needs sysretq (48 0F 07).

Where the manuals differ

  • A non-canonical RCX. Intel’s manual raises #GP(0) for it before leaving CPL 0, and warns that the handler then runs on whatever stack RSP holds, which may already be the user’s; it suggests checking RCX, using paging so that SYSCALL can never save such an address, or giving #GP a stack of its own through the IST. AMD’s manual lists no such check: its SYSRET sets CPL 3 and then loads RIP from RCX.
  • SS. Intel’s forces the RPL of SS to 3 and loads a fixed flat data descriptor; AMD’s takes STAR[63:48] + 8 without forcing the RPL and leaves the hidden part of SS as it was.
  • RFLAGS. Both clear RF and VM. Intel’s masks R11 with 3C7FD7H and sets bit 1; AMD’s loads bits 31:0 of R11 and clears the upper half.
  • Outside 64-bit mode. AMD’s processors also run SYSRET in legacy protected mode, where it only sets IF of the flags; Intel’s raise #UD.

Where it runs

SYSRET raises #UD while EFER.SCE is clear, and #GP(0) at any CPL but 0. Zen 5 recorded #GP for both forms at CPL 3. Intel’s manual adds that nothing after SYSRET executes, even speculatively, before everything ahead of it has completed. With FRED enabled it raises #UD, and the kernel returns with ERETU instead. AMD’s Zen 5 guide lists SYSRET as microcoded.

Forms

Every encoding of SYSRET that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
SYSRET 64-bit mode only SYSRET0F 07LM
SYSRET 64-bit mode only SYSRET64REX.W 0F 07LM
SYSRET not in 64-bit mode SYSRET_AMD0F 07Base instruction set

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

Forms only in 64-bit mode
if not efer & 1 or cr4 >> 32 & 1:
    fault(UD)                    # EFER.SCE clear, or CR4.FRED set
if CPL > 0:
    fault(GP, 0)
s = star >> 48                   # STAR[63:48]
if OSIZE == 64:                  # REX.W: back to 64-bit code
    if not canonical(rcx):
        fault(GP, 0)             # Intel's: at CPL 0. AMD's manual
                                 # has no such check
    rip = rcx
    cs = s + 16 | 3
else:                            # to compatibility mode
    rip = ecx
    cs = s | 3
ss = s + 8 | 3                   # AMD's manual: RPL as STAR has it,
                                 # and SS's descriptor unchanged
f = r11                          # RFLAGS from R11, but for RF and VM
cf = f & 1
pf = f >> 2 & 1
af = f >> 4 & 1
zf = f >> 6 & 1
sf = f >> 7 & 1
tf = f >> 8 & 1
if_ = f >> 9 & 1
df = f >> 10 & 1
of = f >> 11 & 1
iopl = f >> 12 & 3
nt = f >> 14 & 1
ac = f >> 18 & 1
vif = f >> 19 & 1
vip = f >> 20 & 1
id = f >> 21 & 1
rf = 0
# VM stays 0, as in 64-bit mode it always is; RSP stays too

Run on AMD Zen 5 (EPYC 9645): 4 cases. Every one raised an exception, at CPL 3, where the probe runs.

Forms not in 64-bit mode
if not efer & 1:
    fault(UD)                    # EFER.SCE clear
if CPL > 0:
    fault(GP, 0)
s = star >> 48                   # STAR[63:48]
rip = ecx                        # to 32-bit code
cs = s | 3
ss = s + 8                       # RPL as STAR has it
if_ = 1                          # the other flags stay
# Intel's processors raise #UD outside 64-bit mode

Not run on a processor: this SYSRET exists outside 64-bit mode only, where the probe does not run.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
SYSRET 64-bit mode only
EIPimplicitwrite
ECXimplicitread
RFLAGSimplicitwrite
SYSRET 64-bit mode only
RIPimplicitwrite
RCXimplicitread
R11implicitread
RFLAGSimplicitwrite
SYSRET not in 64-bit mode
EIPimplicitwrite
RFLAGSimplicitwrite

Flags

M modified, 0 cleared; blank: not affected. How to read.
OFSFZFAFPFCFDFIFTFACIOPLNTRFVIFVIPID
All forms
MMMMMMMMMMMM0MMM

Attributes

What else XED records about the forms. How to read.

All forms
privileged: CPL 0 only; not in real-address mode
Forms only in 64-bit mode
may abort a TSX transaction

CPUID and processors

Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
LONGMODE

LM
CPUID.80000001H:EDX[29] LM

Every x86-64 processor in XED’s model and Zen 3 to Zen 6
AMD

No CPUID bit: part of the base instruction set.

K10 (Family 10h), Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6

More SYSCALL/SYSRET instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-709 (SYSRET)
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  5. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
  6. AMD64 Architecture Programmer's Manual, Volume 2: System Programming (24593, rev. 3.42, March 2024), Wayback Machine copy of AMD's PDF
  7. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.36, March 2024), Wayback Machine copy of AMD's PDF
  8. Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP

The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The text is our own.