File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1404,9 +1404,19 @@ extern void __kmp_query_cpuid(kmp_cpuinfo_t *p);
14041404// subleaf is only needed for cache and topology discovery and can be set to
14051405// zero in most cases
14061406static inline void __kmp_x86_cpuid (int leaf, int subleaf, struct kmp_cpuid *p) {
1407+ #if KMP_ARCH_X86 && (defined(__pic__) || defined(__PIC__))
1408+ // on i386 arch, the ebx reg. is used by pic, thus we need to preserve from
1409+ // being trashed beforehand
1410+ __asm__ __volatile__ (" mov %%ebx, %%edi\n "
1411+ " cpuid\n "
1412+ " xchg %%edi, %%ebx\n "
1413+ : " =a" (p->eax ), " =b" (p->ebx ), " =c" (p->ecx ), " =d" (p->edx )
1414+ : " a" (leaf), " c" (subleaf));
1415+ #else
14071416 __asm__ __volatile__ (" cpuid"
14081417 : " =a" (p->eax ), " =b" (p->ebx ), " =c" (p->ecx ), " =d" (p->edx )
14091418 : " a" (leaf), " c" (subleaf));
1419+ #endif
14101420}
14111421// Load p into FPU control word
14121422static inline void __kmp_load_x87_fpu_control_word (const kmp_int16 *p) {
You can’t perform that action at this time.
0 commit comments