13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

AMD64 Technology 24594 Rev. 3.10 February 2005• RFLAGS.RF is cleared to 0.For further details on the SYSCALL <strong>and</strong> SYSRET instructions <strong>and</strong> their associatedMSR registers (STAR, LSTAR, CSTAR, <strong>and</strong> SYSCALL_FLAG_MASK), see “Fast<strong>System</strong> Call <strong>and</strong> Return” in <strong>Volume</strong> 2.Mnemonic Opcode DescriptionSYSCALL 0F 05 Call operating system.Action// See “Pseudocode Definitions” on page 49.SYSCALL_START:IF (MSR_EFER.SCE = 0)EXCEPTION [#UD]// Check if syscall/sysret are enabled.IF (LONG_MODE)SYSCALL_LONG_MODEELSE // (LEGACY_MODE)SYSCALL_LEGACY_MODESYSCALL_LONG_MODE:RCX.q = next_RIPR11.q = RFLAGS// with rf clearedIF (64BIT_MODE)temp_RIP.q = MSR_LSTARELSE // (COMPATIBILITY_MODE)temp_RIP.q = MSR_CSTARCS.sel = MSR_STAR.SYSCALL_CS AND 0xFFFCCS.attr = 64-bit code,dpl0 // Always switch to 64-bit mode in long mode.CS.base = 0x00000000CS.limit = 0xFFFFFFFFSS.sel = MSR_STAR.SYSCALL_CS + 8SS.attr = 64-bit stack,dpl0SS.base = 0x00000000SS.limit = 0xFFFFFFFFRFLAGS = RFLAGS AND ~MSR_SFMASKRFLAGS.RF = 0CPL = 0356 SYSCALL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!