[GRLUG] Why aren't fast system call instructions being used on my system?

Matthew Grochowalski matt at gwalski.com
Thu Mar 10 17:20:20 EST 2011


Supposedly the sysenter/sysexit instructions are significantly faster
than the traditional 'int $0x80' method of calling a syscall. However,
it appears 'int $0x80' is being used on my Pentium 4.
I am not seeing 'sep' as one of the flags in /proc/cpuinfo. (sep
indicates the process supports the sysenter/sysexit instructions).
I am also seeing 'int $0x80' from disassembling linux-gate.dso.1
produced from the following Python script:
https://gist.github.com/raw/369785/ce2d6c579dff397a6feab03e1845bae4e06e690a/gistfile1.pyw
However, looking at the results of a CPUID instruction, sep should be
enabled (see http://www.intel.com/Assets/PDF/appnote/241618.pdf)
This is on Ubuntu 10.04 with kernels 2.6.32 and 2.6.35.
Is everyone else seeing 'sep' in /proc/cpuinfo and the sysenter
instruction in the linux-gate.dso.1?

C program to print CPU features:

#include <stdio.h>
int main(int argc, char **argv) {
    int lEDX, lECX;
    asm ( "mov $1, %%eax; "
        "cpuid;"
        "mov %%edx, %0;"
        "mov %%ecx, %1"
        :"=r"(lEDX), "=r"(lECX) /* output */
        :
        :"%eax","%ebx","%ecx","%edx" /* clobbered register */
        );
    printf( "edx: %08x ecx: %08x\n", lEDX, lECX );
    printf( "%s SEP\n", ( lEDX & ( 1 << 11 ) ) ? "Has" : "Doesn't have" );
    return 0;
}

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the grlug mailing list