Skip to content

Commit 745cf34

Browse files
dixyescmb69
authored andcommitted
Port standard/crc32 for windows arm64
We also add arm64 support for php_get_windows_cpu(). Closes GH-7703.
1 parent 079773c commit 745cf34

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ PHP NEWS
5454
for the random_bytes. (Cristian Rodriguez)
5555
. Uses CCRandomGenerateBytes instead of arc4random_buf on macOs. (David Carlier).
5656

57+
- Windows:
58+
. Added preliminary support for (cross-)building for ARM64. (Yun Dou)
59+
5760
07 Jul 2022, PHP 8.2.0alpha3
5861

5962
- Core:

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ PHP 8.2 UPGRADE NOTES
475475
- Core:
476476
. Windows specific error messages are no longer localized, but instead in
477477
English to better match PHP error messages.
478+
. Preliminary and highly experimental support for building on ARM64 has been
479+
added.
478480

479481
- OCI8:
480482
. Since building against Oracle Client 10g is no longer supported anyway,

ext/standard/crc32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include "crc32_x86.h"
2121

2222
#ifdef HAVE_AARCH64_CRC32
23+
#ifndef PHP_WIN32
2324
# include <arm_acle.h>
25+
#endif
2426
# if defined(__linux__)
2527
# include <sys/auxv.h>
2628
# include <asm/hwcap.h>
@@ -53,6 +55,9 @@ static inline int has_crc32_insn() {
5355
if (sysctlbyname("hw.optional.armv8_crc32", &res, &reslen, NULL, 0) < 0)
5456
res = 0;
5557
return res;
58+
# elif defined(WIN32)
59+
res = (int)IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
60+
return res;
5661
# else
5762
res = 0;
5863
return res;

ext/standard/info.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,11 @@ void php_get_windows_cpu(char *buf, int bufsize)
647647
case PROCESSOR_ARCHITECTURE_AMD64 :
648648
snprintf(buf, bufsize, "AMD64");
649649
break;
650+
#endif
651+
#if defined(PROCESSOR_ARCHITECTURE_ARM64)
652+
case PROCESSOR_ARCHITECTURE_ARM64 :
653+
snprintf(buf, bufsize, "ARM64");
654+
break;
650655
#endif
651656
case PROCESSOR_ARCHITECTURE_UNKNOWN :
652657
default:

0 commit comments

Comments
 (0)