diff options
author | Xinchen Hui <laruence@gmail.com> | 2018-12-11 15:22:50 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2018-12-11 15:22:50 +0800 |
commit | c3eb291e41800df2c516244fb3fce6a9fcc31428 (patch) | |
tree | 83998144ec97101a937c5450122121c0457efd7c | |
parent | 7dc1c7f6306747806208a8a1cb8deaf6b8ae117d (diff) | |
parent | 4fb019994a8420a7989f05b38ee8249ea12541b1 (diff) | |
download | php-git-c3eb291e41800df2c516244fb3fce6a9fcc31428.tar.gz |
Merge branch 'i386-PIC' of https://github.com/ryandesign/php-src into PHP-7.3
* 'i386-PIC' of https://github.com/ryandesign/php-src:
Fix __zend_cpuid on i386 PIC without __cpuid_count
-rw-r--r-- | Zend/zend_cpuinfo.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Zend/zend_cpuinfo.c b/Zend/zend_cpuinfo.c index 5791a11c62..ea1f08f948 100644 --- a/Zend/zend_cpuinfo.c +++ b/Zend/zend_cpuinfo.c @@ -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__) |