summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-12-19 18:14:47 (GMT)
committernijtmans <nijtmans>2010-12-19 18:14:47 (GMT)
commit0f14c521fa2b0c2b3c918852597b8235d604dd32 (patch)
tree0e4a2448ea391b15bf57c4a84a51ab0de0cba133 /win/tclWin32Dll.c
parentbcf76985e02074220f86d2cb6e8bfedf6db60447 (diff)
downloadtcl-0f14c521fa2b0c2b3c918852597b8235d604dd32.zip
tcl-0f14c521fa2b0c2b3c918852597b8235d604dd32.tar.gz
tcl-0f14c521fa2b0c2b3c918852597b8235d604dd32.tar.bz2
[Patch 3124554]: fixes for mingw64 - gcc4.5.1 tdm64-1:
Fixed for gcc, not yet for MSVC 64-bit.
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index ce8293d..1f06703 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.71 2010/11/19 20:47:09 nijtmans Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.72 2010/12/19 18:14:47 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -718,12 +718,42 @@ TclWinCPUID(
unsigned int index, /* Which CPUID value to retrieve. */
unsigned int *regsPtr) /* Registers after the CPUID. */
{
-#if defined(__GNUC__) && !defined(_WIN64)
- EXCEPTION_REGISTRATION registration;
-#endif
int status = TCL_ERROR;
-#if defined(__GNUC__) && !defined(_WIN64)
+#if defined(__GNUC__)
+# if defined(_WIN64)
+ /*
+ * Execute the CPUID instruction with the given index, and store results
+ * off 'regPtr'.
+ */
+
+ __asm__ __volatile__(
+ /*
+ * Do the CPUID instruction, and save the results in the 'regsPtr'
+ * area.
+ */
+
+ "movl %[rptr], %%edi" "\n\t"
+ "movl %[index], %%eax" "\n\t"
+ "cpuid" "\n\t"
+ "movl %%eax, 0x0(%%edi)" "\n\t"
+ "movl %%ebx, 0x4(%%edi)" "\n\t"
+ "movl %%ecx, 0x8(%%edi)" "\n\t"
+ "movl %%edx, 0xc(%%edi)" "\n\t"
+
+ :
+ /* No outputs */
+ :
+ [index] "m" (index),
+ [rptr] "m" (regsPtr)
+ :
+ "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
+ status = TCL_OK;
+
+# else
+
+ EXCEPTION_REGISTRATION registration;
+
/*
* Execute the CPUID instruction with the given index, and store results
* off 'regPtr'.
@@ -805,6 +835,7 @@ TclWinCPUID(
"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
status = registration.status;
+# endif /* !_WIN64 */
#elif defined(_MSC_VER) && !defined(_WIN64)
/*
* Define a structure in the stack frame to hold the registers.