php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #76654
Patch zend_cpuinfo.c.patch revision 2018-11-15 09:18 UTC by php-bugs-2018 at ryandesign dot com
revision 2018-11-15 07:11 UTC by php-bugs-2018 at ryandesign dot com

Patch zend_cpuinfo.c.patch for Compile Failure Bug #76654

Patch version 2018-11-15 09:18 UTC

Return to Bug #76654 | Download this patch
Patch Revisions:

Developer: php-bugs-2018@ryandesign.com

Provide an i386 implementation of __zend_cpuid, based on __cpuid_count from
cpuid.h in Xcode 5.1.1.
https://bugs.php.net/bug.php?id=76654
--- a/Zend/zend_cpuinfo.c.orig	2018-11-06 04:22:56.000000000 -0600
+++ b/Zend/zend_cpuinfo.c	2018-11-15 00:16:54.000000000 -0600
@@ -36,11 +36,23 @@
 }
 # 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__)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC