diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-08-04 07:51:42 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-08-04 07:51:42 (GMT) |
commit | 26ef4bacfbe3412a0343afe1cad4b94b321f1fc2 (patch) | |
tree | b1a9d657111f70235f3894fdedc5c3a5d86ce480 /unix/tclUnixCompat.c | |
parent | 9d27c20d496ebe21ef04f49dc7b9c100a2de340e (diff) | |
parent | 24ef33dc101a3e9114318b884c1e99d792f4739d (diff) | |
download | tcl-dkf_notifier_poll.zip tcl-dkf_notifier_poll.tar.gz tcl-dkf_notifier_poll.tar.bz2 |
merge trunkdkf_notifier_poll
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; } |