diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2020-06-15 11:30:04 +0000 | 
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2020-06-15 11:30:04 +0000 | 
| commit | d7aa8d0a1f110421252d79f5acfb72d89187ad1f (patch) | |
| tree | 8b0efac880d3949a9d25ab9bb34792eac605eee6 /decoder/include/common/trc_core_arch_map.h | |
| parent | cf98ba14dc260458f757fa46419575cf69f45a44 (diff) | |
Diffstat (limited to 'decoder/include/common/trc_core_arch_map.h')
| -rw-r--r-- | decoder/include/common/trc_core_arch_map.h | 34 | 
1 files changed, 33 insertions, 1 deletions
| diff --git a/decoder/include/common/trc_core_arch_map.h b/decoder/include/common/trc_core_arch_map.h index 5a24149180fc..b72b4b411fa4 100644 --- a/decoder/include/common/trc_core_arch_map.h +++ b/decoder/include/common/trc_core_arch_map.h @@ -39,6 +39,23 @@  #include <string>  #include "opencsd/ocsd_if_types.h" +/** @class CoreArchProfileMap + * + *  @brief Map core / arch name to profile for decoder. + * + *  Helper class for library clients to map core or architecture version names onto  + *  a profile / arch version pair suitable for use with the decode library. + *  + *  Valid core names are:- + *   - Cortex-Axx : where xx = 5,7,12,15,17,32,35,53,55,57,65,72,73,75,76,77; + *   - Cortex-Rxx : where xx = 5,7,8,52; + *   - Cortex-Mxx : where xx = 0,0+,3,4,23,33; + * + *  Valid architecture profile names are:- + *   - ARMv7-A, ARMv7-R, ARMv7-M; + *   - ARMv8-A, ARMv8.3A, ARMv8-R, ARMv8-M; + *   + */  class CoreArchProfileMap  {  public: @@ -50,16 +67,31 @@ public:  private:      std::map<std::string, ocsd_arch_profile_t> core_profiles; +    std::map<std::string, ocsd_arch_profile_t> arch_profiles;  };  inline ocsd_arch_profile_t CoreArchProfileMap::getArchProfile(const std::string &coreName)  {      ocsd_arch_profile_t ap = { ARCH_UNKNOWN, profile_Unknown }; +    bool bFound = false;      std::map<std::string, ocsd_arch_profile_t>::const_iterator it; + +    /* match against the core name map. */      it = core_profiles.find(coreName); -    if(it != core_profiles.end()) +    if (it != core_profiles.end()) +    {          ap = it->second; +        bFound = true; +    } + +    /* scan architecture profiles on no core name match */ +    if (!bFound) +    { +        it = arch_profiles.find(coreName); +        if (it != arch_profiles.end()) +            ap = it->second; +    }      return ap;  } | 
