1

There is an x86 instruction sysenter. This seems to be the Intel fast-system-call method. SYSENTER seems to be valid in LONG mode (64-bit) on Intel processors. This seems to have fallen out of favor because of the AMD-provided syscall. From my understanding, this instruction is like a syscall but the onus is on the user to set it with EIP/ESP, etc.

You can see the argument list for sysenter 32-bit. With absolute minimal focus to syscall and int 0x80, what does the sysenter instruction do in Linux when the chip is in Long mode? Can it be of any use as-is?

3

CPU instructions providing access to system calls don’t exist in a vacuum: they’re only useful as determined in the context of the operating system’s ABI. The 64-bit x86 Linux ABI supports the following entry points (detailed on LWN):

  • SYSCALL from 64-bit code;
  • interrupt 0x80 from 32- and 64-bit code;
  • SYSENTER from 32-bit code.

(The extra 32-bit SYSCALL documented in the kernel is potentially confusing — it’s the x32 system call interface, which uses 32-bit pointers from 64-bit code.)

From userspace, things are simpler still:

  • i386 code (32-bit code with 32-bit pointers) should use __kernel_vsyscall in the vDSO (this determines which call mechanism to use);
  • anything else should use SYSCALL.

I haven’t tried issuing a SYSENTER from 64-bit code in long mode, but I’m not sure it will do anything useful.

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.