From 0f14c521fa2b0c2b3c918852597b8235d604dd32 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Sun, 19 Dec 2010 18:14:47 +0000 Subject: [Patch 3124554]: fixes for mingw64 - gcc4.5.1 tdm64-1: Fixed for gcc, not yet for MSVC 64-bit. --- ChangeLog | 5 +++++ win/tclWin32Dll.c | 41 ++++++++++++++++++++++++++++++++++++----- 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 + + * 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 * 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. -- cgit v0.12