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

Michael Mol mikemol at gmail.com
Thu Mar 10 19:08:21 EST 2011


If you're using a 32-bit binary distribution, then it was probably
compiled to the least common denominator of supported CPUs. Right now,
I think that's whatever you get if you pass -march=i686 to gcc.

gcc may not take advantage of that instruction with -march=i686.

On Thu, Mar 10, 2011 at 5:20 PM, Matthew Grochowalski <matt at gwalski.com> wrote:
> 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.
>
> _______________________________________________
> grlug mailing list
> grlug at grlug.org
> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug
>



-- 
:wq

-- 
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