Skip to content
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

i#5475 Add FEATURE_ detection for AArch64 #5491

Merged
merged 10 commits into from
May 17, 2022

Conversation

AssadHashmi
Copy link
Contributor

@AssadHashmi AssadHashmi commented May 11, 2022

This patch reads from the ID_AA64ISAR0_EL1 features register and sets
the following if supported:
FEATURE_AES FEATURE_PMULL FEATURE_SHA1 FEATURE_SHA256
FEATURE_SHA512 FEATURE_CRC32 FEATURE_LSE FEATURE_RDM
FEATURE_SM3 FEATURE_SM4 FEATURE_DotProd FEATURE_FHM
FEATURE_FlagM2 FEATURE_RNG FEATURE_SHA3 FEATURE_FlagM

Example output in logfile:
Processor features:
ID_AA64ISAR0_EL1 = 0x0000000000011120
Processor has FEATURE_AES
Processor has FEATURE_PMULL
Processor has FEATURE_SHA1
Processor has FEATURE_SHA256
Processor has FEATURE_CRC32

ID_AA64ISAR1_EL1 and ID_AA64PFR0_EL1 are also read. The features for
these will be implemented in the next patch.

Issues: #5475, #1569

This patch reads from the ID_AA64ISAR0_EL1 features register and sets
the following if supported:
FEATURE_AES    FEATURE_PMULL FEATURE_SHA1    FEATURE_SHA256
FEATURE_SHA512 FEATURE_CRC32 FEATURE_LSE     FEATURE_RDM
FEATURE_SM3    FEATURE_SM4   FEATURE_DotProd FEATURE_FHM
FEATURE_FlagM2 FEATURE_RNG   FEATURE_SHA3    FEATURE_FlagM

Example output in logfile:
- - - snip
Processor features:
 ID_AA64ISAR0_EL1 = 0x0000000000011120
   Processor has FEATURE_AES
   Processor has FEATURE_PMULL
   Processor has FEATURE_SHA1
   Processor has FEATURE_SHA256
   Processor has FEATURE_CRC32
- - - snip

ID_AA64ISAR1_EL1 and ID_AA64PFR0_EL1 are also read. The features for
these will be implemented in the next patch.

Issues: #5474, #1569
@AssadHashmi AssadHashmi changed the title i#5474 Add FEATURE_ detection for AArch64 i#5475 Add FEATURE_ detection for AArch64 May 11, 2022
core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/aarch64/aarch64.asm Outdated Show resolved Hide resolved
core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/proc_api.h Show resolved Hide resolved
core/arch/proc_api.h Outdated Show resolved Hide resolved
core/arch/arch_exports.h Outdated Show resolved Hide resolved
core/arch/proc_api.h Show resolved Hide resolved
core/arch/proc_api.h Show resolved Hide resolved
core/arch/proc_api.h Outdated Show resolved Hide resolved
core/arch/proc_api.h Outdated Show resolved Hide resolved
@AssadHashmi AssadHashmi merged commit 624bc4a into master May 17, 2022
@AssadHashmi AssadHashmi deleted the i5475-aarch64-feature-support branch May 17, 2022 15:17
@derekbruening
Copy link
Contributor

Turns out this broke our internal build which sets -Wvla and in C a const int is not a compile-time constant. I'll fix it and add -Wvla to the cmake flags.

derekbruening added a commit that referenced this pull request May 25, 2022
Changes the size of an array added in PR #5491 to be a compile-time C
constant.

Adds -Wvla to the UNIX compile flags to enforce this everywhere.
Fixes one other instances in drfrontendlib, and relaxes for a final
instance in a test.

Issue: #5475
derekbruening added a commit that referenced this pull request May 25, 2022
Changes the size of an array added in PR #5491 to be a compile-time C
constant.

Adds -Wvla to the UNIX compile flags to enforce this everywhere.
Fixes one other instances in drfrontendlib, and relaxes for a final
instance in a test.

Issue: #5475
AssadHashmi added a commit that referenced this pull request Jul 11, 2022
This patch implements the codec side of the AArch64 FEATURE_ support
patch, PR #5491. A feature name field is added to each opcode in
codec_*.txt files which is used to generate feature checks in the
encoder, e.g.

    switch (instr->opcode) {
    case OP_cas:
 #     if !defined(DR_HOST_NOT_TARGET) && !defined(STANDALONE_DECODER)
       if (!proc_has_feature(FEATURE_LSE))
           return ENCFAIL;
 #     endif
       enc = encode_opndsgen_08a07c00_001f03ff(pc, instr,..., di);
       if (enc != ENCFAIL)
           return enc;

Issues: #5475, #1569, #2626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants