From cbfab7204fe62e41912c68f8a39f22b41a3d264d Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Date: Wed, 5 Jan 2011 02:43:43 +0100 Subject: [PATCH] Update of CPUID macros to fix segfaults in amd64 code. --- Eigen/src/Core/util/Memory.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index d7848b645..b139d1831 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -598,10 +598,12 @@ public: //---------- Cache sizes ---------- #if defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) -# if defined(__PIC__) +# if defined(__PIC__) && defined(__i386__) + // Case for x86 with PIC # define EIGEN_CPUID(abcd,func,id) \ __asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id)); # else + // Case for x86_64 or x86 w/o PIC # define EIGEN_CPUID(abcd,func,id) \ __asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id) ); # endif