Skip to content

Support build ext/standard for Windows arm64 #7703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

dixyes
Copy link
Contributor

@dixyes dixyes commented Dec 1, 2021

This is a series of work on building php for windows arm64 (cross compile only yet)

ext/standard/crc32.c try to use arm64 crc32 instructions to calculate crc32

This patch used a dirty, not-confirmed method to check if cpu supports these isa extensions: HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\x\CP 4030 registry seems always hold identical value to ID_AA64ISAR0_EL1 register

Tested in windows 11 arm64 macmini vm, qemu simulator "cortex-a57"/"max" cpu, not sure if this always work

see https://docs.microsoft.com/en-us/answers/questions/645412/get-id-aa64isar0-el1-at-windows-arm64.html

@dixyes dixyes changed the title Port standard/crc32 for windows arm64 Support build ext/standard/crc32.c and signal.c for Windows arm64 Dec 1, 2021
@dixyes dixyes changed the title Support build ext/standard/crc32.c and signal.c for Windows arm64 Support build ext/standard/crc32.c for Windows arm64 Dec 1, 2021
@dixyes
Copy link
Contributor Author

dixyes commented Dec 1, 2021

here is my simple demo using this method: isar0.zip

If anyone have win at arm64, please try this and compare if CP4030 it reported matches your ID_AA64ISAR0_EL1

@dixyes dixyes changed the title Support build ext/standard/crc32.c for Windows arm64 Support build ext/standard for Windows arm64 Dec 1, 2021
@dixyes
Copy link
Contributor Author

dixyes commented Dec 6, 2021

First of all, this registry key is not documented and confirmed by other else, so this pr is draft only yet.

I'm not sure if all windows supported cpu have crc32 extension. For which cpus are officially supported at this time, this check is unnecessary.

ID_AA64ISAR0_EL1 provides information of some cpu supported isa extensions, crc32 is necessary for ARMv8-1 cpus. Reading this register at EL0 is undefined behavior (although it's always work at my environment). ELF/unix provides auxiliary vectors for coder to detect this, Windows have no such mechanism documented, I just find that this registry always holds same value to mac m1 cpu/qemu emulated cpu haves, It may be a coincidence only.

I'm waiting for official Microsoft document / technical support about this, you can try the demo above to test this on you own system.

@dixyes
Copy link
Contributor Author

dixyes commented Dec 6, 2021

I've found IsProcessorFeaturePresent Win32API, seems to be ok with this.

@TysonAndre
Copy link
Contributor

I don't see any issues, the build failure seems to have been fixed in master with the change The PDO tests are not supposed to run in parallel

usage of https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent seems reasonable

If the HAL does not support detection of the feature, whether or not the hardware supports the feature, the return value is also zero.

@dixyes dixyes marked this pull request as ready for review February 7, 2022 03:08
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was the need to resolve some trivial merge conflicts; I did that and force-pushed to retrigger CI.

Generally, this looks good to me. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants