From owner-freebsd-stable Tue Jun 29 19:29:37 1999 Delivered-To: freebsd-stable@freebsd.org Received: from kusanagi.boing.com (silver234.mminternet.com [209.241.149.234]) by hub.freebsd.org (Postfix) with ESMTP id 7DE74152B2 for ; Tue, 29 Jun 1999 19:29:33 -0700 (PDT) (envelope-from boing@kusanagi.boing.com) Received: (from boing@localhost) by kusanagi.boing.com (8.9.3/8.9.3) id TAA06545; Tue, 29 Jun 1999 19:29:23 -0700 (PDT) (envelope-from boing) Message-Id: <199906300229.TAA06545@kusanagi.boing.com> Date: Tue, 29 Jun 1999 19:29:22 -0700 (PDT) From: Geff Hanoian Subject: RE: MMX To: darius@dons.net.au Cc: frodef@acm.org, freebsd-stable@FreeBSD.ORG In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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