summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-26 16:55:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-26 16:55:24 (GMT)
commit2ea70632bbcf5060e5114653d4717480c03c0cee (patch)
treeddc0546dab10c8bc2575020750fc67d405b7b617
parentb1e276db9c365ef451ad9d795468ea5daad0e5a0 (diff)
parent38de96ca81b0ff5e34b5d653195a2412a66410dc (diff)
downloadtcl-2ea70632bbcf5060e5114653d4717480c03c0cee.zip
tcl-2ea70632bbcf5060e5114653d4717480c03c0cee.tar.gz
tcl-2ea70632bbcf5060e5114653d4717480c03c0cee.tar.bz2
[Bug 3601804]: platformCPUID segmentation fault on Darwin
-rw-r--r--ChangeLog5
-rw-r--r--unix/tclUnixCompat.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b853e4..0c000b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-26 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tclUnixCompat.c: [Bug 3601804]: platformCPUID segmentation
+ fault on Darwin.
+
2013-01-23 Donal K. Fellows <dkf@users.sf.net>
* library/http/http.tcl (http::geturl): [Bug 2911139]: Do not do vwait
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index c1e1075..2a68f7f 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -995,11 +995,19 @@ TclWinCPUID(
/* See: <http://en.wikipedia.org/wiki/CPUID> */
#if defined(HAVE_CPUID)
+#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
+ __asm__ __volatile__("movq %%rbx, %%rsi \n\t" /* save %rbx */
+ "cpuid \n\t"
+ "xchgq %%rsi, %%rbx \n\t" /* restore the old %rbx */
+ : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
+ : "a"(index));
+#else
__asm__ __volatile__("mov %%ebx, %%esi \n\t" /* save %ebx */
"cpuid \n\t"
"xchg %%esi, %%ebx \n\t" /* restore the old %ebx */
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
: "a"(index));
+#endif
status = TCL_OK;
#endif
return status;