summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--win/tclWin32Dll.c41
2 files changed, 41 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b2531be..82a3328 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tclWin32Dll.c: [Patch 3124554]: fixes for mingw64 - gcc4.5.1
+ tdm64-1: Fixed for gcc, not yet for MSVC 64-bit.
+
2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
* unix/Makefile.in: Remove unwanted/obsolete 'ddd' target.
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.