Hal Ashburner wrote:

On Mon, 2005-12-19 at 23:40 +1100, Crossfire wrote:
The 'correct' method to test for MMX (and later extensions) is to
check the output of the CPUID instruction.  (Introduced in the late
486 families - guaranteed to be available on all Pentium class or
newer systems however.)  It is the CPUID instruction that the linux
kernel uses to generate most of the information in /proc/cpuinfo on
i386 systems.

cpuid is awesome!
http://www.livejournal.com/users/kernelslacker/31732.html

A small C code to check if MMX is supported in your Linux System (x86 CPU not AMD64).

#include <stdio.h>
int mmx_init__(void)
{
       int MMX__;
       __asm__ __volatile__ (
               "movl $1, %%eax\n\t"
               "cpuid\n\t"
               "andl $0x800000, %%edx\n\t"
               "movl %%edx, %0"
               : "=q" (MMX__)
       );
       return MMX__;
}

int main(void)
{
       if((int)mmx_init__()==0)
               printf("MMX is not supported\n");
       else
               printf("MMX is supported\n");
       return (0);
}

O Plameras

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to