diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-08-04 07:47:22 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-08-04 07:47:22 (GMT) |
commit | ef03a2c7809309b2255f7c82c6abe0db2e4160bf (patch) | |
tree | fd7b6368f954a4c1a95289f5dc388a409605c11c /unix/tclUnixCompat.c | |
parent | bf9624b12a9e6fe010e025b8f76d3e29c8399725 (diff) | |
parent | 24ef33dc101a3e9114318b884c1e99d792f4739d (diff) | |
download | tcl-ef03a2c7809309b2255f7c82c6abe0db2e4160bf.zip tcl-ef03a2c7809309b2255f7c82c6abe0db2e4160bf.tar.gz tcl-ef03a2c7809309b2255f7c82c6abe0db2e4160bf.tar.bz2 |
merge trunk
Diffstat (limited to 'unix/tclUnixCompat.c')
-rw-r--r-- | unix/tclUnixCompat.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 48ba4d3..3818121 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,7 +989,16 @@ TclWinCPUID( { int status = TCL_ERROR; - /* There is no reason this couldn't be implemented on UNIX as well */ + /* See: <http://en.wikipedia.org/wiki/CPUID> */ +#if defined(HAVE_CPUID) + __asm__ __volatile__("mov %%ebx, %%edi \n\t" /* save %ebx */ + "cpuid \n\t" + "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) : "edi"); + status = TCL_OK; +#endif return status; } |