summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2012-05-02 06:48:07 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2012-05-02 06:48:07 (GMT)
commitc88c4b7b794e0b3d2c8ccb86dbee739fd0cd463e (patch)
treefde9de00707597cae4b3e8f87beef3c2f0c7c465 /unix
parente995cec02e72e79430dc6f38a399e54ff8993a13 (diff)
parentf9a62d28d090db78f8611388fc9901e52ce5095b (diff)
downloadtcl-c88c4b7b794e0b3d2c8ccb86dbee739fd0cd463e.zip
tcl-c88c4b7b794e0b3d2c8ccb86dbee739fd0cd463e.tar.gz
tcl-c88c4b7b794e0b3d2c8ccb86dbee739fd0cd463e.tar.bz2
TclWinCPUID now respects -fPIC compilation on 32-bit Linux
FossilOrigin-Name: 64a0a9db46939aee593e49d5b3c78360a2ab940b
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 22573e4..09c8691 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -821,8 +821,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;