summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>2001-10-12 16:49:28 +0000
committerjdp <jdp@FreeBSD.org>2001-10-12 16:49:28 +0000
commitb5831c25304dd586fa1a1d4d5bc6dbc7dc70b061 (patch)
treebc9ff09a10a97e71eee89536515d6d92ddffb328 /sys/amd64
parent369a58f711ffd453dbb3553b998262364eb584d6 (diff)
downloadFreeBSD-src-b5831c25304dd586fa1a1d4d5bc6dbc7dc70b061.zip
FreeBSD-src-b5831c25304dd586fa1a1d4d5bc6dbc7dc70b061.tar.gz
Correct the input/output/clobber specifications for the cpuid
instruction. Stefan Keller <dres@earth.serd.org> noticed that CPU identification was broken when compiled with -O2, and tracked it down to the asm statement, which was storing values into memory without specifying that memory was modified. He submitted a patch which added "memory" as a clobber, but I refined it further to arrive at this version. MFC after: 3 days
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/identcpu.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 949c05f..d81b7ed 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -116,14 +116,9 @@ static void
do_cpuid(u_int ax, u_int *p)
{
__asm __volatile(
- "cpuid;"
- "movl %%eax, (%2);"
- "movl %%ebx, 4(%2);"
- "movl %%ecx, 8(%2);"
- "movl %%edx, 12(%2);"
- : "=a" (ax)
- : "0" (ax), "S" (p)
- : "bx", "cx", "dx"
+ "cpuid"
+ : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3])
+ : "0" (ax)
);
}
OpenPOWER on IntegriCloud