Skip to content

Commit

Permalink
Merge branch 'i386-PIC' of https://github.com/ryandesign/php-src into…
Browse files Browse the repository at this point in the history
… PHP-7.3

* 'i386-PIC' of https://github.com/ryandesign/php-src:
  Fix __zend_cpuid on i386 PIC without __cpuid_count
  • Loading branch information
laruence committed Dec 11, 2018
2 parents 7dc1c7f + 4fb0199 commit c3eb291
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Zend/zend_cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,23 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
}
# else
static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo) {
#if defined(__i386__) && (defined(__pic__) || defined(__PIC__))
/* PIC on i386 uses %ebx, so preserve it. */
__asm__ __volatile__ (
"pushl %%ebx\n"
"cpuid\n"
"mov %%ebx,%1\n"
"popl %%ebx"
: "=a"(cpuinfo->eax), "=r"(cpuinfo->ebx), "=c"(cpuinfo->ecx), "=d"(cpuinfo->edx)
: "a"(func), "c"(subfunc)
);
#else
__asm__ __volatile__ (
"cpuid"
: "=a"(cpuinfo->eax), "=b"(cpuinfo->ebx), "=c"(cpuinfo->ecx), "=d"(cpuinfo->edx)
: "a"(func), "c"(subfunc)
);
#endif
}
# endif
#elif defined(ZEND_WIN32) && !defined(__clang__)
Expand Down

0 comments on commit c3eb291

Please sign in to comment.