summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixCompat.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 21:55:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 21:55:54 (GMT)
commit95e3cf7eca6be61c793c7237fa0281634ed2d115 (patch)
tree43d2bfa84716bb6f21c91187e06224d7cd785f18 /unix/tclUnixCompat.c
parent675af037ae80376f329f9c1100635cfea7182a19 (diff)
parentdfdef9b81ca277bd758e8b122c23f83f664d55a3 (diff)
downloadtcl-95e3cf7eca6be61c793c7237fa0281634ed2d115.zip
tcl-95e3cf7eca6be61c793c7237fa0281634ed2d115.tar.gz
tcl-95e3cf7eca6be61c793c7237fa0281634ed2d115.tar.bz2
Better detection and implementation for cpuid instruction on Intel-derived processors, both 32-bit and 64-bit
Diffstat (limited to 'unix/tclUnixCompat.c')
-rw-r--r--unix/tclUnixCompat.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index a39dbbe..792d6da 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -973,8 +973,7 @@ CopyString(
* Get CPU ID information on an Intel box under UNIX (either Linux or Cygwin)
*
* Results:
- * Returns TCL_OK if successful, TCL_ERROR if CPUID is not supported or
- * fails.
+ * Returns TCL_OK if successful, TCL_ERROR if CPUID is not supported.
*
* Side effects:
* If successful, stores EAX, EBX, ECX and EDX registers after the CPUID
@@ -990,14 +989,14 @@ TclWinCPUID(
{
int status = TCL_ERROR;
-#if defined(HAVE_CPUID) && defined(__CYGWIN__)
- __asm__ __volatile__("pushl %%ebx \n\t" /* save %ebx */
+ /* See: <http://en.wikipedia.org/wiki/CPUID> */
+#if defined(HAVE_CPUID)
+ __asm__ __volatile__("mov %%ebx, %%edi \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");
+ "mov %%ebx, %%esi \n\t" /* save what cpuid just put in %ebx */
+ "mov %%edi, %%ebx \n\t" /* restore the old %ebx */
+ : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
+ : "a"(index));
status = TCL_OK;
#endif
return status;