On Feb 13 16:01, Peter Maydell wrote: > On Thu, 2 Feb 2023 at 21:13, Aaron Lindsay <aa...@os.amperecomputing.com> > wrote: > > +static inline bool isar_feature_aa64_pauth_epac(const ARMISARegisters *id) > > +{ > > + return isar_feature_pauth_get_features(id) == 0b0010; > > This should ideally be ">= 0b0010", but it depends a bit on > where we call it.
FYI - I did make this `>= 0b0010` after changing the logic around elsewhere to be compatible as you suggested. I'm also planning to add a comment like this: /* * Note that unlike most AArch64 features, EPAC is treated (in the ARM * psedocode, at least) as not being implemented by larger values of this * field. Our usage of '>=' rather than '==' here causes our implementation * of PAC logic to diverge slightly from ARM pseudocode. */ > This field, like most ID register fields, follows the "standard > scheme", where the value increases and larger numbers always > imply "all of the functionality from the lower values, plus > some more". In QEMU we implement this by doing a >= type > comparison on the field value. > > The PAC related ID fields are documented slightly confusingly, > but they do work this way. The documentation suggests it might not > be quite that way for FEAT_EPAC because it says that > HaveEnhancedPAC() returns TRUE for 2 and FALSE for 3 and up. > However this is more because the definition of the architectural > features means that FEAT_EPAC is irrelevant, and it's an accident > of the way the pseudocode was written that means that > HaveEnhancedPAC() ever gets called when FEAT_PAuth2 is present. > > Other than EPAC, the rest of the values in these fields are > straightforward and we can implement the isar_feature functions > with a single >= comparison. Thanks for your review! I've made a number of your (simpler) suggested changes already, and will target getting a new patchset out in the next couple weeks after I spend more time withi the the remaining GETPC() changes that need a little more thought/rework, and we sort out what the command-line options should look like. -Aaron