]> git.pld-linux.org Git - packages/framewave.git/blob - framewave-cpuid.patch
- enhanced c++ (cover also static_assert keyword, conflicting template arguments...
[packages/framewave.git] / framewave-cpuid.patch
1 --- FRAMEWAVE_1.3.1_SRC/Framewave/domain/fwBase/src/system.cpp.orig     2009-07-09 11:15:36.000000000 +0200
2 +++ FRAMEWAVE_1.3.1_SRC/Framewave/domain/fwBase/src/system.cpp  2017-04-15 12:04:33.188802940 +0200
3 @@ -18,6 +18,8 @@ void * x_baseDataPtr = 0;
4      #pragma intrinsic(__cpuid)
5      #pragma intrinsic(__rdtsc)
6  
7 +    #define get_cpuid __cpuid
8 +
9      static inline __int64 get_rdtsc_sys()
10      {
11          return __rdtsc();
12 @@ -35,37 +37,8 @@ void * x_baseDataPtr = 0;
13  // Linux
14  #elif defined( FW_LIN ) || defined( FW_MAC )
15  
16 -    // CPUID
17 -    #if defined( FW_SYS64 )
18 -
19 -        #define __cpuid(CPUInfo, InfoType)    __asm__ __volatile__("    pushq %%rbx;                      \
20 -                                                                    xorq %%rax, %%rax;                    \
21 -                                                                    movl %%esi, %%eax;                    \
22 -                                                                    cpuid;                                \
23 -                                                                    movl %%eax, 0x0(%%rdi);               \
24 -                                                                    movl %%ebx, 0x4(%%rdi);               \
25 -                                                                    movl %%ecx, 0x8(%%rdi);               \
26 -                                                                    movl %%edx, 0xc(%%rdi);               \
27 -                                                                    popq %%rbx;"                          \
28 -                                                                    : : "D" (CPUInfo), "S" (InfoType)     \
29 -                                                                    : "%rax", "%rcx", "%rdx" )
30 -
31 -    #elif defined( FW_SYS32 )
32 -
33 -        #define __cpuid(CPUInfo, InfoType)    __asm__ __volatile__("    pushl %%ebx;                      \
34 -                                                                    xorl %%eax, %%eax;                    \
35 -                                                                    movl %%esi, %%eax;                    \
36 -                                                                    cpuid;                                \
37 -                                                                    movl %%eax, 0x0(%%edi);               \
38 -                                                                    movl %%ebx, 0x4(%%edi);               \
39 -                                                                    movl %%ecx, 0x8(%%edi);               \
40 -                                                                    movl %%edx, 0xc(%%edi);               \
41 -                                                                    popl %%ebx;"                          \
42 -                                                                    : : "D" (CPUInfo), "S" (InfoType)     \
43 -                                                                    : "%eax", "%ecx", "%edx" )
44 -
45 -    #endif
46 -
47 +    #include <cpuid.h>
48 +    #define get_cpuid(CPUInfo, InfoType) __cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3])
49      // RDTSC
50      #define rdtsc(low,high) __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
51  
52 @@ -127,7 +100,7 @@ void * x_baseDataPtr = 0;
53          }
54  
55          #define rdtsc rdtsc64
56 -        #define __cpuid cpuid64
57 +        #define get_cpuid cpuid64
58  
59      #elif    defined( FW_SYS32 )
60  
61 @@ -157,7 +130,7 @@ void * x_baseDataPtr = 0;
62          }
63          
64          #define rdtsc rdtsc32
65 -        #define __cpuid cpuid32
66 +        #define get_cpuid cpuid32
67  
68      #endif
69  
70 @@ -215,7 +188,7 @@ template< class T >    unsigned MSBPos()
71  FwCpuType GetCpuType()
72  {
73      int out[4];
74 -    __cpuid( out, CPUID_CODE_FEATURES );    
75 +    get_cpuid( out, CPUID_CODE_FEATURES );    
76      
77      if( IsSet( out[CPUID_INDEX_SSE4A   ], CPUID_BIT_SSE4A)) return fwCpuFamily10h;
78      if( IsSet( out[CPUID_INDEX_SSE3    ], CPUID_BIT_SSE3 )) return fwCpuSSE3;
This page took 0.084079 seconds and 3 git commands to generate.