diff options
| author | dgp <dgp@users.sourceforge.net> | 2012-05-24 16:50:40 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2012-05-24 16:50:40 (GMT) |
| commit | 286580c577c4f54efd199d0996a7df88c02d01b4 (patch) | |
| tree | 4251a9956293cba5d933f821e66ea739b15f7dca /unix/tclUnixCompat.c | |
| parent | c8619c8ec837fc2b74af6a04df85b7c5646fae5d (diff) | |
| parent | dce46c947bd11b68d1979b9e708d177acfddb911 (diff) | |
| download | tcl-286580c577c4f54efd199d0996a7df88c02d01b4.zip tcl-286580c577c4f54efd199d0996a7df88c02d01b4.tar.gz tcl-286580c577c4f54efd199d0996a7df88c02d01b4.tar.bz2 | |
merge 8.5
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 782d70c..f582c0c 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -803,8 +803,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 @@ -820,7 +819,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; } |
