1 Fix build issue caused by invalid register usage on x86
3 Patch taken from https://github.com/openexr/openexr/issues/128.
5 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 Index: b/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
8 ===================================================================
9 --- a/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
10 +++ b/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
14 #if defined(IMF_HAVE_SSE2) && defined(__GNUC__)
17 // Helper functions for gcc + SSE enabled
18 - void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
19 + void cpuid(unsigned int n, unsigned int &eax, unsigned int &ebx,
20 + unsigned int &ecx, unsigned int &edx)
22 - __asm__ __volatile__ (
24 - : /* Output */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
25 - : /* Input */ "a"(n)
27 + __get_cpuid(n, &eax, &ebx, &ecx, &edx);
30 #else // IMF_HAVE_SSE2 && __GNUC__
32 // Helper functions for generic compiler - all disabled
33 - void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
34 + void cpuid(unsigned int n, unsigned int &eax, unsigned int &ebx,
35 + unsigned int &ecx, unsigned int &edx)
37 eax = ebx = ecx = edx = 0;
41 #ifdef OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
43 - void xgetbv(int n, int &eax, int &edx)
44 + void xgetbv(unsigned int n, unsigned int &eax, unsigned int &edx)
46 __asm__ __volatile__ (
50 #else // OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
52 - void xgetbv(int n, int &eax, int &edx)
53 + void xgetbv(unsigned int n, unsigned int &eax, unsigned int &edx)
62 - int eax, ebx, ecx, edx;
63 + unsigned int max = 0;
64 + unsigned int eax, ebx, ecx, edx;
66 cpuid(0, max, ebx, ecx, edx);