34 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
35 # define HAVE_GNU_INLINE_ASM
38 typedef void (*kde_sighandler_t) (int);
44 static void sighandler(
int )
46 std::longjmp( env, 1 );
51 static sigjmp_buf TDE_NO_EXPORT jmpbuf;
52 static sig_atomic_t TDE_NO_EXPORT canjump = 0;
54 static void TDE_NO_EXPORT sigill_handler(
int sig )
57 signal( sig, SIG_DFL );
61 siglongjmp( jmpbuf, 1 );
65 static int getCpuFeatures()
67 volatile int features = 0;
69 #if defined( HAVE_GNU_INLINE_ASM )
70 #if defined( __i386__ )
71 bool haveCPUID =
false;
72 bool have3DNOW =
false;
80 "movl %%ecx, %%edx \n\t"
81 "xorl $0x00200000, %%ecx \n\t"
88 "xorl %%eax, %%eax \n\t"
89 "cmpl %%ecx, %%edx \n\t"
90 "je .Lno_cpuid_support%= \n\t"
92 ".Lno_cpuid_support%=: \n\t"
93 :
"=a"(haveCPUID) : :
"%ecx",
"%edx" );
100 __asm__ __volatile__(
102 "movl $1, %%eax \n\t"
105 :
"=d"(result) : :
"%eax",
"%ecx" );
108 if ( result & 0x00800000 )
111 __asm__ __volatile__(
113 "movl $0x80000000, %%eax \n\t"
115 "cmpl $0x80000000, %%eax \n\t"
116 "jbe .Lno_extended%= \n\t"
117 "movl $0x80000001, %%eax \n\t"
119 "test $0x80000000, %%edx \n\t"
120 "jz .Lno_extended%= \n\t"
121 "movl $1, %%eax \n\t"
122 ".Lno_extended%=: \n\t"
124 :
"=a"(have3DNOW) : );
131 if ( result & 0x00200000 ) {
136 kde_sighandler_t oldhandler = std::signal( SIGILL, sighandler );
142 __asm__ __volatile__(
"xorps %xmm0, %xmm0");
145 std::signal( SIGILL, oldhandler );
155 #elif defined __PPC__ && defined HAVE_PPC_ALTIVEC
156 signal( SIGILL, sigill_handler );
157 if ( sigsetjmp( jmpbuf, 1 ) ) {
158 signal( SIGILL, SIG_DFL );
161 __asm__ __volatile__(
"mtspr 256, %0\n\t"
162 "vand %%v0, %%v0, %%v0"
165 signal( SIGILL, SIG_DFL );
174 unsigned int KCPUInfo::s_features = getCpuFeatures();
@ IntelSSE
Intel's SSE instructions.
@ IntelSSE2
Intel's SSE2 instructions.
@ AltiVec
Motorola AltiVec instructions.
@ AMD3DNOW
AMD 3DNOW instructions.
@ IntelMMX
Intel's MMX instructions.