From abb2db1c7d38e1577276743cd98199bfdaf1a441 Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 14 Dec 2012 23:23:56 +0100 Subject: [PATCH] Fixed Nazara compilation on 64bits compiler Former-commit-id: 5b9d8208691c34e30f4184c6a35f82a690c221f5 --- src/Nazara/Core/Win32/HardwareInfoImpl.cpp | 82 ++++++++++++---------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp index e18eb860c..21381fe50 100644 --- a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp +++ b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp @@ -37,45 +37,49 @@ unsigned int NzHardwareInfoImpl::GetProcessorCount() bool NzHardwareInfoImpl::IsCpuidSupported() { - #if defined(NAZARA_COMPILER_MSVC) - int supported; - __asm - { - pushfd - pop eax - mov ecx, eax - xor eax, 0x200000 - push eax - popfd - pushfd - pop eax - xor eax, ecx - mov supported, eax - push ecx - popfd - }; - - return supported != 0; - #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) - int supported; - asm volatile (" pushfl\n" - " pop %%eax\n" - " mov %%eax, %%ecx\n" - " xor $0x200000, %%eax\n" - " push %%eax\n" - " popfl\n" - " pushfl\n" - " pop %%eax\n" - " xor %%ecx, %%eax\n" - " mov %%eax, %0\n" - " push %%ecx\n" - " popfl" - : "=m" (supported) // output - : // input - : "eax", "ecx", "memory"); // clobbered register - - return supported != 0; + #ifdef NAZARA_PLATFORM_x64 + return true; // Toujours supporté sur un processeur 64 bits #else - return false; + #if defined(NAZARA_COMPILER_MSVC) + int supported; + __asm + { + pushfd + pop eax + mov ecx, eax + xor eax, 0x200000 + push eax + popfd + pushfd + pop eax + xor eax, ecx + mov supported, eax + push ecx + popfd + }; + + return supported != 0; + #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) + int supported; + asm volatile (" pushfl\n" + " pop %%eax\n" + " mov %%eax, %%ecx\n" + " xor $0x200000, %%eax\n" + " push %%eax\n" + " popfl\n" + " pushfl\n" + " pop %%eax\n" + " xor %%ecx, %%eax\n" + " mov %%eax, %0\n" + " push %%ecx\n" + " popfl" + : "=m" (supported) // output + : // input + : "eax", "ecx", "memory"); // clobbered register + + return supported != 0; + #else + return false; + #endif #endif }