Skip to content

Commit beaea5c

Browse files
committed
Merge branch 'PHP-7.3'
2 parents 043a11c + 5a361c3 commit beaea5c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Zend/zend_cpuinfo.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,24 @@ void zend_cpu_startup(void)
7777
{
7878
if (!cpuinfo.initialized) {
7979
zend_cpu_info ebx;
80+
int max_feature;
8081

8182
cpuinfo.initialized = 1;
8283
__zend_cpuid(0, 0, &cpuinfo);
83-
if (cpuinfo.eax == 0) {
84+
max_feature = cpuinfo.eax;
85+
if (max_feature == 0) {
8486
return;
8587
}
88+
8689
__zend_cpuid(1, 0, &cpuinfo);
90+
8791
/* for avx2 */
88-
__zend_cpuid(7, 0, &ebx);
89-
cpuinfo.ebx = ebx.ebx;
92+
if (max_feature >= 7) {
93+
__zend_cpuid(7, 0, &ebx);
94+
cpuinfo.ebx = ebx.ebx;
95+
} else {
96+
cpuinfo.ebx = 0;
97+
}
9098
}
9199
}
92100

0 commit comments

Comments
 (0)