From 10519e225cd46bf39a7ea583f219e74c78289dfe Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Tue, 7 Jul 2020 15:46:04 +0100 Subject: [PATCH] arch-arm: Remove getters/setters from SelfDebug class Change-Id: I63e5ed25e453cb8fcb2c39ba0728cc81c499c166 Signed-off-by: Giacomo Travaglini Reviewed-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31081 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- src/arch/arm/self_debug.cc | 14 ++++++-------- src/arch/arm/self_debug.hh | 39 +++++++------------------------------- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/arch/arm/self_debug.cc b/src/arch/arm/self_debug.cc index c964b113f..63ddb4565 100644 --- a/src/arch/arm/self_debug.cc +++ b/src/arch/arm/self_debug.cc @@ -90,13 +90,13 @@ SelfDebug::testBreakPoints(ThreadContext *tc, Addr vaddr) Addr pc = vaddr; if (pcst.itstate() != 0x0) pc = pcst.pc(); - if (p.getEnable() && p.isActive(pc) &&(!to32 || !p.isSet())){ + if (p.enable && p.isActive(pc) &&(!to32 || !p.onUse)) { const DBGBCR ctr = p.getControlReg(tc); if (p.isEnabled(tc, el, ctr.hmc, ctr.ssc, ctr.pmc)) { bool debug = p.test(tc, pc, el, ctr, false); if (debug){ if (to32) - p.setOnUse(); + p.onUse = true; return triggerException(tc, pc); } } @@ -109,7 +109,7 @@ SelfDebug::testBreakPoints(ThreadContext *tc, Addr vaddr) Fault SelfDebug::triggerException(ThreadContext * tc, Addr vaddr) { - if (isTo32()) { + if (to32) { return std::make_shared(vaddr, ArmFault::DebugEvent, false, ArmFault::UnknownTran, @@ -134,8 +134,7 @@ SelfDebug::testWatchPoints(ThreadContext *tc, Addr vaddr, bool write, int idxtmp = -1; for (auto &p: arWatchPoints){ idxtmp ++; - if (p.getEnable()) - { + if (p.enable) { bool debug = p.test(tc, vaddr, el, write, atomic, size); if (debug){ return triggerWatchpointException(tc, vaddr, write, cm); @@ -149,7 +148,7 @@ Fault SelfDebug::triggerWatchpointException(ThreadContext *tc, Addr vaddr, bool write, bool cm) { - if (isTo32()) { + if (to32) { ArmFault::DebugType d = cm? ArmFault::WPOINT_CM: ArmFault::WPOINT_NOCM; return std::make_shared(vaddr, @@ -211,7 +210,7 @@ BrkPoint::testLinkedBk(ThreadContext *tc, Addr vaddr, ExceptionLevel el) { bool debug = false; const DBGBCR ctr = getControlReg(tc); - if ((ctr.bt & 0x1) && getEnable()){ + if ((ctr.bt & 0x1) && enable) { debug = test(tc, vaddr, el, ctr, true); } return debug; @@ -527,7 +526,6 @@ WatchPoint::compareAddress(ThreadContext *tc, Addr in_addr, uint8_t bas, uint8_t mask, unsigned size) { Addr addr_tocmp = getAddrfromReg(tc); - int maxAddrSize = getMaxAddrSize(); int maxbits = isDoubleAligned(addr_tocmp) ? 4: 8; int bottom = isDoubleAligned(addr_tocmp) ? 2: 3; Addr addr = bits(in_addr, maxAddrSize, 0); diff --git a/src/arch/arm/self_debug.hh b/src/arch/arm/self_debug.hh index 121ddde44..c185223a4 100644 --- a/src/arch/arm/self_debug.hh +++ b/src/arch/arm/self_debug.hh @@ -68,6 +68,8 @@ class BrkPoint bool onUse; public: + friend class SelfDebug; + BrkPoint(MiscRegIndex _ctrlIndex, MiscRegIndex _valIndex, MiscRegIndex _xIndex, SelfDebug* _conf, bool _ctxAw, bool lva, bool vmid16, bool aarch32): @@ -77,20 +79,9 @@ class BrkPoint { maxAddrSize = lva ? 52: 48 ; maxAddrSize = aarch32 ? 31 : maxAddrSize; - onUse=false; - } - void setOnUse() - { - onUse = true; - } - void unsetOnUse() - { onUse = false; } - bool isSet() - { - return onUse; - } + bool testLinkedBk(ThreadContext *tc, Addr vaddr, ExceptionLevel el); bool test(ThreadContext *tc, Addr pc, ExceptionLevel el, DBGBCR ctr, bool from_link); @@ -138,11 +129,6 @@ class BrkPoint { enable = val.e == 0x1; } - bool getEnable() - { - return enable; - } - }; class WatchPoint @@ -154,13 +140,9 @@ class WatchPoint bool enable; int maxAddrSize; - inline int getMaxAddrSize() - { - return maxAddrSize; - } - - public: + friend class SelfDebug; + WatchPoint(MiscRegIndex _ctrlIndex, MiscRegIndex _valIndex, SelfDebug* _conf, bool lva, bool aarch32): ctrlRegIndex(_ctrlIndex), @@ -188,10 +170,6 @@ class WatchPoint { enable = val.e == 0x1; } - bool getEnable() - { - return enable; - } bool isEnabled(ThreadContext* tc, ExceptionLevel el, bool hmc, uint8_t ssc, uint8_t pac); @@ -368,7 +346,7 @@ class SelfDebug void activateDebug() { for (auto &p: arBrkPoints){ - p.unsetOnUse(); + p.onUse = false; } } @@ -432,10 +410,6 @@ class SelfDebug return aarch32; } - inline bool isTo32() - { - return to32; - } inline void setAArch32(ThreadContext * tc) { ExceptionLevel fromEL = (ExceptionLevel) currEL(tc); @@ -445,6 +419,7 @@ class SelfDebug aarch32 = ELIs32(tc, fromEL); return; } + SoftwareStep * getSstep() { return softStep; -- 2.30.2