3

The SYSCALL instruction is said to be the 64-bit version of INT 0X80, however it's still possible to use the latter in 64-bit code (although strace decodes it wrong because of the 64-bit ABI I guess) which usually goes through a "legacy entry". But there's something I don't quite understand, why is the SYSCALL instruction faster?

5

The short answer is that syscall has less overhead than int 0x80.

For more details on why this is the case, see the accepted answer to Intel x86 vs x64 system call, where a nearly identical question was asked:

I'm told that syscall is lighter and faster than generating a software interrupt. Why it is faster on x64 than x86, and can I make a system call on x64 using int 80h?

See also:

  • Intel P6 vs P7 system call performance
    • this email thread discusses the observed slowdown on certain Intel CPUs caused by the overhead associated with int 0x80
  • Sysenter Based System Call Mechanism in Linux 2.6

    It was found out that this software interrupt method [int 0x80] was much slower on Pentium IV processors. To solve this issue, Linus implemented an alternative system call mechanism to take advantage of SYSENTER/SYSEXIT instructions provided by all Pentium II+ processors.

  • The Linux kernel, 4.6 Sysenter and the vsyscall page (2003)

    It has been observed that a 2 GHz Pentium 4 was much slower than an 850 MHz Pentium III on certain tasks, and that this slowness is caused by the very large overhead of the traditional int 0x80 interrupt on a Pentium 4. Some models of the i386 family do have faster ways to enter the kernel. On Pentium II there is the sysenter instruction. Also AMD has a syscall instruction.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.