Code follower init.
Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/include/common/ocsd_code_follower.h | 4 +-- decoder/include/etmv3/trc_cmp_cfg_etmv3.h | 3 +++ decoder/include/etmv3/trc_pkt_decode_etmv3.h | 18 +++++++------ decoder/include/etmv3/trc_pkt_elem_etmv3.h | 16 ++++++++--- decoder/source/etmv3/trc_pkt_decode_etmv3.cpp | 38 +++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/decoder/include/common/ocsd_code_follower.h b/decoder/include/common/ocsd_code_follower.h index f05ad5b..e8df24a 100644 --- a/decoder/include/common/ocsd_code_follower.h +++ b/decoder/include/common/ocsd_code_follower.h @@ -60,7 +60,7 @@ public:
// set information for decode operation - static or occasionally changing settings // per decode values are passed as parameters into the decode API calls. - void setCoreProfile(const ocsd_arch_profile_t profile); //!< core profile + void setArchProfile(const ocsd_arch_profile_t profile); //!< core profile void setMemSpaceAccess(const ocsd_mem_space_acc_t mem_acc_rule); //!< memory space to use for access (filtered by S/NS, EL etc). void setMemSpaceCSID(const uint8_t csid); //!< memory spaces might be partitioned by CSID void setISA(const ocsd_isa isa); //!< set the ISA for the decode. @@ -129,7 +129,7 @@ private: #endif // ARM_OCSD_CODE_FOLLOWER_H_INCLUDED
//*********** setup API -inline void OcsdCodeFollower::setCoreProfile(const ocsd_arch_profile_t profile) +inline void OcsdCodeFollower::setArchProfile(const ocsd_arch_profile_t profile) { m_instr_info.pe_type = profile; } diff --git a/decoder/include/etmv3/trc_cmp_cfg_etmv3.h b/decoder/include/etmv3/trc_cmp_cfg_etmv3.h index e9df5e8..a169375 100644 --- a/decoder/include/etmv3/trc_cmp_cfg_etmv3.h +++ b/decoder/include/etmv3/trc_cmp_cfg_etmv3.h @@ -119,6 +119,9 @@ public:
const uint8_t getTraceID() const; //!< CoreSight Trace ID for this device.
+ const ocsd_arch_version_t getArchVersion() const; //!< architecture version + const ocsd_core_profile_t getCoreProfile() const; //!< core profile. + private: ocsd_etmv3_cfg m_cfg;
diff --git a/decoder/include/etmv3/trc_pkt_decode_etmv3.h b/decoder/include/etmv3/trc_pkt_decode_etmv3.h index 3987f29..5dd78e4 100644 --- a/decoder/include/etmv3/trc_pkt_decode_etmv3.h +++ b/decoder/include/etmv3/trc_pkt_decode_etmv3.h @@ -36,11 +36,12 @@ #define ARM_TRC_PKT_DECODE_ETMV3_H_INCLUDED
#include "common/trc_pkt_decode_base.h" -#include "etmv3/trc_pkt_elem_etmv3.h" -#include "etmv3/trc_cmp_cfg_etmv3.h" #include "common/trc_gen_elem.h" #include "common/ocsd_pe_context.h" +#include "common/ocsd_code_follower.h"
+#include "etmv3/trc_pkt_elem_etmv3.h" +#include "etmv3/trc_cmp_cfg_etmv3.h"
class TrcPktDecodeEtmV3 : public TrcPktDecodeBase<EtmV3TrcPacket, EtmV3Config> @@ -75,9 +76,14 @@ private:
//** intra packet state;
- + OcsdCodeFollower m_code_follower; //!< code follower for instruction trace
-//** Other processor state; + ocsd_vaddr_t m_IAddr; //!< next instruction address + OcsdPeContext m_pe_context; //!< context for the PE + + EtmV3TrcPacket m_pended_packet; //! Saved packet when processing pended. + +//** Other packet decoder state;
// trace decode FSM typedef enum { @@ -93,10 +99,6 @@ private:
uint8_t m_CSID; //!< Coresight trace ID for this decoder.
- OcsdPeContext m_pe_context; //!< context for the PE - - EtmV3TrcPacket m_pended_packet; //! Saved packet when processing pended. - //** output element OcsdTraceElement m_output_elem; }; diff --git a/decoder/include/etmv3/trc_pkt_elem_etmv3.h b/decoder/include/etmv3/trc_pkt_elem_etmv3.h index bade8cc..6e70ade 100644 --- a/decoder/include/etmv3/trc_pkt_elem_etmv3.h +++ b/decoder/include/etmv3/trc_pkt_elem_etmv3.h @@ -62,7 +62,7 @@ public: operator const ocsd_etmv3_pkt*() const { return &m_pkt_data; }; operator const ocsd_etmv3_pkt&() const { return m_pkt_data; };
-// update interface - set packet values +// update interace - set packet values void Clear(); //!< clear update data in packet ready for new one. void ResetState(); //!< reset intra packet state data -on full decoder reset.
@@ -97,16 +97,26 @@ public:
// packet status interface - get packet info. const ocsd_etmv3_pkt_type getType() const { return m_pkt_data.type; }; + const bool isBadPacket() const;
const int AltISA() const { return m_pkt_data.context.curr_alt_isa; }; const ocsd_isa ISA() const { return m_pkt_data.curr_isa; }; - const bool isBadPacket() const; + const bool changedISA() const { return m_pkt_data.curr_isa != m_pkt_data.prev_isa; };
- const uint32_t getCycleCount() const { return m_pkt_data.cycle_count; }; + const bool isNS() const { return m_pkt_data.context.curr_NS; }; + const bool isHyp() const { return m_pkt_data.context.curr_Hyp; }; + + const bool isCtxtIDUpdated() const { return (m_pkt_data.context.updated_c == 1); } const uint32_t getCtxtID() const { return m_pkt_data.context.ctxtID; }; + const bool isVMIDUpdated() const { return (m_pkt_data.context.updated_v == 1); } const uint32_t getVMID() const { return m_pkt_data.context.VMID; }; + + const uint32_t getCycleCount() const { return m_pkt_data.cycle_count; }; const uint64_t getTS() const { return m_pkt_data.timestamp; };
+ const bool isExcepPkt() const { return (m_pkt_data.exception.bits.present == 1); }; + const ocsd_armv7_exception excepType() const { return m_pkt_data.exception.type; }; + const uint16_t excepNum() const { return m_pkt_data.exception.number; }; const bool isExcepCancel() const { return (m_pkt_data.exception.bits.present == 1) && (m_pkt_data.exception.bits.cancel == 1); };
// printing diff --git a/decoder/source/etmv3/trc_pkt_decode_etmv3.cpp b/decoder/source/etmv3/trc_pkt_decode_etmv3.cpp index 14cea8b..c5bf8d2 100644 --- a/decoder/source/etmv3/trc_pkt_decode_etmv3.cpp +++ b/decoder/source/etmv3/trc_pkt_decode_etmv3.cpp @@ -166,6 +166,13 @@ ocsd_err_t TrcPktDecodeEtmV3::onProtocolConfig() err = OCSD_ERR_HW_CFG_UNSUPP; LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_HW_CFG_UNSUPP,"ETMv3 trace decoder : data trace decode not yet supported")); } + + // need to set up core profile info in follower + ocsd_arch_profile_t arch_profile; + arch_profile.arch = m_config->getArchVersion(); + arch_profile.profile = m_config->getCoreProfile(); + m_code_follower.setArchProfile(arch_profile); + m_code_follower.setMemSpaceCSID(m_CSID); } else err = OCSD_ERR_NOT_INIT; @@ -179,6 +186,7 @@ void TrcPktDecodeEtmV3::initDecoder() { m_CSID = 0; resetDecoder(); + m_code_follower.initInterfaces(getMemoryAccessAttachPt(),getInstrDecodeAttachPt()); }
// reset for first use / re-use. @@ -310,7 +318,37 @@ void TrcPktDecodeEtmV3::pendPacket() m_pended_packet = *m_curr_packet_in; m_curr_state = PEND_PACKET; } + +ocsd_datapath_resp_t TrcPktDecodeEtmV3::processISync(const bool withCC) +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + // look for context changes.... + if(m_curr_packet_in->isCtxtIDUpdated()) + { + + }
+ if(m_config->CtxtIDBytes()) + { + + } + + return resp; +} + +ocsd_datapath_resp_t TrcPktDecodeEtmV3::processBranchAddr() +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + + return resp; +} + +ocsd_datapath_resp_t TrcPktDecodeEtmV3::processPHdr() +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + + return resp; +}
/* End of File trc_pkt_decode_etmv3.cpp */