Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 1999 19:29:22 -0700 (PDT)
From:      Geff Hanoian <boing@kusanagi.boing.com>
To:        darius@dons.net.au
Cc:        frodef@acm.org, freebsd-stable@FreeBSD.ORG
Subject:   RE: MMX
Message-ID:  <199906300229.TAA06545@kusanagi.boing.com>
In-Reply-To: <XFMail.990630103147.darius@dons.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30 Jun, Daniel J. O'Connor wrote:
> 
> On 29-Jun-99 Frode Vatvedt Fjeld wrote:
>>  What is the preferred way for my application to determine if the CPU
>>  is MMX-capable?

What about taking the code from /usr/src/sys/i386/i386/identcpu.c? 
(and which ever defines, etc are necessary).  Can users execute such
code without special privledges and after boot time?

-----

static void 
do_cpuid(u_int ax, u_int *p)
{
        __asm __volatile(       
        ".byte  0x0f, 0xa2;"
        "movl   %%eax, (%2);"
        "movl   %%ebx, 4(%2);" 
        "movl   %%ecx, 8(%2);"
        "movl   %%edx, 12(%2);"
        : "=a" (ax)
        :  "0" (ax), "S" (p)
        : "bx", "cx", "dx"
        );
}

----

                                do_cpuid(1, regs);
                                cpu_id = regs[0];       /* eax */
                                cpu_feature = regs[3];  /* edx */

----

cpu_feature appears to contain a "feature set".

Geff




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906300229.TAA06545>