Updating decoder to ETMv4.4 specification. Add common type updates for additional features Update ETMv4 config for new parameters
Signed-off-by: Mike Leach mike.leach@linaro.org --- .../include/opencsd/etmv4/trc_cmp_cfg_etmv4.h | 20 +++++++++++++++++-- decoder/include/opencsd/ocsd_if_types.h | 11 ++++++++-- decoder/source/etmv4/trc_cmp_cfg_etmv4.cpp | 2 ++ 3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/decoder/include/opencsd/etmv4/trc_cmp_cfg_etmv4.h b/decoder/include/opencsd/etmv4/trc_cmp_cfg_etmv4.h index a3f8835..1d72d97 100644 --- a/decoder/include/opencsd/etmv4/trc_cmp_cfg_etmv4.h +++ b/decoder/include/opencsd/etmv4/trc_cmp_cfg_etmv4.h @@ -108,6 +108,7 @@ public: /* idr 1 */ const uint8_t MajVersion() const; const uint8_t MinVersion() const; + const uint8_t FullVersion() const;
/* idr 2 */ const uint32_t iaSizeMax() const; @@ -117,6 +118,7 @@ public: const uint32_t dvSize() const; const uint32_t ccSize() const; const bool vmidOpt() const; + const bool wfiwfeBranch() const;
/* id regs 8-13*/ const uint32_t MaxSpecDepth() const; @@ -180,7 +182,11 @@ private: bool m_condTraceCalc; CondITrace_t m_CondTrace;
+protected: ocsd_etmv4_cfg m_cfg; + uint8_t m_MajVer; + uint8_t m_MinVer; + };
/* idr 0 */ @@ -265,14 +271,18 @@ inline const bool EtmV4Config::commitOpt1() const /* idr 1 */ inline const uint8_t EtmV4Config::MajVersion() const { - return (uint8_t)((m_cfg.reg_idr1 >> 8) & 0xF); + return m_MajVer; }
inline const uint8_t EtmV4Config::MinVersion() const { - return (uint8_t)((m_cfg.reg_idr1 >> 4) & 0xF); + return m_MinVer; }
+inline const uint8_t EtmV4Config::FullVersion() const +{ + return (m_MajVer << 4) | m_MinVer; +}
/* idr 2 */ inline const uint32_t EtmV4Config::iaSizeMax() const @@ -320,6 +330,12 @@ inline const bool EtmV4Config::vmidOpt() const return (bool)((m_cfg.reg_idr2 & 0x20000000) == 0x20000000) && (MinVersion() > 0); }
+inline const bool EtmV4Config::wfiwfeBranch() const +{ + return (bool)((m_cfg.reg_idr2 & 0x80000000) && (FullVersion() >= 0x43)); +} + + /* id regs 8-13*/
inline const uint32_t EtmV4Config::MaxSpecDepth() const diff --git a/decoder/include/opencsd/ocsd_if_types.h b/decoder/include/opencsd/ocsd_if_types.h index b5a53f2..2fc0fda 100644 --- a/decoder/include/opencsd/ocsd_if_types.h +++ b/decoder/include/opencsd/ocsd_if_types.h @@ -272,11 +272,16 @@ typedef enum _ocsd_dcd_tree_src_t { /** Core Architecture Version */ typedef enum _ocsd_arch_version { ARCH_UNKNOWN, /**< unknown architecture */ + ARCH_CUSTOM, /**< None ARM, custom architecture */ ARCH_V7, /**< V7 architecture */ ARCH_V8, /**< V8 architecture */ - ARCH_CUSTOM, /**< None ARM, custom architecture */ + ARCH_V8r3, /**< V8.3 architecture */ } ocsd_arch_version_t;
+// macros for arch version comparisons. +#define OCSD_IS_V8_ARCH(arch) ((arch >= ARCH_V8) && (arch <= ARCH_V8r3)) +#define OCSD_MIN_V8_ARCH(arch) (arch >= ARCH_V8) + /** Core Profile */ typedef enum _ocsd_core_profile { profile_Unknown, /**< Unknown profile */ @@ -351,7 +356,8 @@ typedef enum _ocsd_instr_type { OCSD_INSTR_BR, /**< Immediate Branch instruction */ OCSD_INSTR_BR_INDIRECT, /**< Indirect Branch instruction */ OCSD_INSTR_ISB, /**< Barrier : ISB instruction */ - OCSD_INSTR_DSB_DMB /**< Barrier : DSB or DMB instruction */ + OCSD_INSTR_DSB_DMB, /**< Barrier : DSB or DMB instruction */ + OCSD_INSTR_WFI_WFE, /**< WFI or WFE traced as direct branch */ } ocsd_instr_type;
/** instruction sub types - addiitonal information passed to the output packets @@ -378,6 +384,7 @@ typedef struct _ocsd_instr_info { ocsd_vaddr_t instr_addr; /**< Input: Instruction address. */ uint32_t opcode; /**< Input: Opcode at address. 16 bit opcodes will use MS 16bits of parameter. */ uint8_t dsb_dmb_waypoints; /**< Input: DMB and DSB are waypoints */ + uint8_t wfi_wfe_branch; /**< Input: WFI, WFE classed as direct branches */
/* instruction decode info */ ocsd_instr_type type; /**< Decoder: Current instruction type. */ diff --git a/decoder/source/etmv4/trc_cmp_cfg_etmv4.cpp b/decoder/source/etmv4/trc_cmp_cfg_etmv4.cpp index 7db0fa6..9f5b373 100644 --- a/decoder/source/etmv4/trc_cmp_cfg_etmv4.cpp +++ b/decoder/source/etmv4/trc_cmp_cfg_etmv4.cpp @@ -75,6 +75,8 @@ void EtmV4Config::PrivateInit() m_VMIDSize = 0; m_condTraceCalc = false; m_CondTrace = COND_TR_DIS; + m_MajVer = (uint8_t)((m_cfg.reg_idr1 >> 8) & 0xF); + m_MinVer = (uint8_t)((m_cfg.reg_idr1 >> 4) & 0xF); }
void EtmV4Config::CalcQSupp()