summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 06:43:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 06:43:53 (GMT)
commit8f59032301d90407ca472bd7f347d36abcc4c9d6 (patch)
tree9dbe20d66310b168f79c71664b8c22f16295bd46 /unix
parent321969beb37a3d30ebb0f675720eb8bf39f3d39b (diff)
downloadtcl-8f59032301d90407ca472bd7f347d36abcc4c9d6.zip
tcl-8f59032301d90407ca472bd7f347d36abcc4c9d6.tar.gz
tcl-8f59032301d90407ca472bd7f347d36abcc4c9d6.tar.bz2
TclWinCPUID now respects -fPIC compilation on 32-bit Linux
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixCompat.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index 3f7bbdf..0456faf 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -693,8 +693,13 @@ TclWinCPUID(
int status = TCL_ERROR;
#ifdef HAVE_CPUID
- __asm__ __volatile__ ("cpuid":\
- "=a" (regsPtr[0]), "=b" (regsPtr[1]), "=c" (regsPtr[2]), "=d" (regsPtr[3]) : "a" (index));
+ __asm__ __volatile__("pushl %%ebx \n\t" /* save %ebx */
+ "cpuid \n\t"
+ "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */
+ "popl %%ebx \n\t" /* restore the old %ebx */
+ : "=a"(regsPtr[0]), "=r"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
+ : "a"(index)
+ : "cc");
status = TCL_OK;
#endif
return status;