diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-02 21:39:10 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-05-02 21:39:10 (GMT) |
commit | 197d98cbfed32d739d52afb672a62fbbdd085008 (patch) | |
tree | 8835c59d6164b82f15ea847bacc04e7a074b666c /unix/tclUnixCompat.c | |
parent | 5dbbcd78f8c724c077a2c6e5a9a75aa600a45893 (diff) | |
parent | 9882b4443f62dbec04ef04c57e9c77ead3e49e4c (diff) | |
download | tcl-197d98cbfed32d739d52afb672a62fbbdd085008.zip tcl-197d98cbfed32d739d52afb672a62fbbdd085008.tar.gz tcl-197d98cbfed32d739d52afb672a62fbbdd085008.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.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 1043115..6e2666b 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -675,8 +675,7 @@ TclpGetHostByAddr(const char *addr, int length, int type) * 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 @@ -692,14 +691,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; |