changeset eb279d6e08a2 in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=eb279d6e08a2 description: Trace: Allow printing ASIDs and selectively tracing based on user/kernel code.
Debug flags are ExecUser, ExecKernel, and ExecAsid. ExecUser and ExecKernel are set by default when Exec is specified. Use minus sign with ExecUser or ExecKernel to remove user or kernel tracing respectively. diffstat: src/arch/alpha/utility.cc | 1 - src/arch/alpha/utility.hh | 7 +++++++ src/arch/arm/utility.hh | 7 ++++++- src/arch/mips/utility.hh | 6 ++++++ src/arch/power/utility.hh | 13 +++++++++++++ src/arch/sparc/utility.hh | 6 ++++++ src/arch/x86/utility.hh | 7 +++++++ src/cpu/SConscript | 12 +++++++++--- src/cpu/exetrace.cc | 9 +++++++++ 9 files changed, 63 insertions(+), 5 deletions(-) diffs (178 lines): diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/alpha/utility.cc --- a/src/arch/alpha/utility.cc Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/alpha/utility.cc Fri May 13 17:27:00 2011 -0500 @@ -29,7 +29,6 @@ * Ali Saidi */ -#include "arch/alpha/ev5.hh" #include "arch/alpha/utility.hh" #if FULL_SYSTEM diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/alpha/utility.hh --- a/src/arch/alpha/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/alpha/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -39,6 +39,7 @@ #include "config/full_system.hh" #include "cpu/static_inst.hh" #include "cpu/thread_context.hh" +#include "arch/alpha/ev5.hh" namespace AlphaISA { @@ -111,6 +112,12 @@ pc.advance(); } +inline uint64_t +getExecutingAsid(ThreadContext *tc) +{ + return DTB_ASN_ASN(tc->readMiscRegNoEffect(IPR_DTB_ASN)); +} + } // namespace AlphaISA #endif // __ARCH_ALPHA_UTILITY_HH__ diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/arm/utility.hh --- a/src/arch/arm/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/arm/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -173,7 +173,12 @@ Addr truncPage(Addr addr); Addr roundPage(Addr addr); +inline uint64_t +getExecutingAsid(ThreadContext *tc) +{ + return tc->readMiscReg(MISCREG_CONTEXTIDR); +} + }; - #endif diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/mips/utility.hh --- a/src/arch/mips/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/mips/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -120,6 +120,12 @@ pc.advance(); } +inline uint64_t +getExecutingAsid(ThreadContext *tc) +{ + return 0; +} + }; diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/power/utility.hh --- a/src/arch/power/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/power/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -78,6 +78,19 @@ pc.advance(); } +static inline bool +inUserMode(ThreadContext *tc) +{ + return 0; +} + +inline uint64_t +getExecutingAsid(ThreadContext *tc) +{ + return 0; +} + } // namespace PowerISA + #endif // __ARCH_POWER_UTILITY_HH__ diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/sparc/utility.hh --- a/src/arch/sparc/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/sparc/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -94,6 +94,12 @@ inst->advancePC(pc); } +inline uint64_t +getExecutingAsid(ThreadContext *tc) +{ + return tc->readMiscRegNoEffect(MISCREG_MMU_P_CONTEXT); +} + } // namespace SparcISA #endif diff -r 64a938a8b7fc -r eb279d6e08a2 src/arch/x86/utility.hh --- a/src/arch/x86/utility.hh Fri May 13 17:27:00 2011 -0500 +++ b/src/arch/x86/utility.hh Fri May 13 17:27:00 2011 -0500 @@ -102,6 +102,13 @@ { inst->advancePC(pc); } + + inline uint64_t + getExecutingAsid(ThreadContext *tc) + { + return 0; + } + }; #endif // __ARCH_X86_UTILITY_HH__ diff -r 64a938a8b7fc -r eb279d6e08a2 src/cpu/SConscript --- a/src/cpu/SConscript Fri May 13 17:27:00 2011 -0500 +++ b/src/cpu/SConscript Fri May 13 17:27:00 2011 -0500 @@ -168,6 +168,9 @@ TraceFlag('ExecTicks') TraceFlag('ExecMicro') TraceFlag('ExecMacro') +TraceFlag('ExecUser') +TraceFlag('ExecKernel') +TraceFlag('ExecAsid') TraceFlag('Fetch') TraceFlag('IntrControl') TraceFlag('PCEvent') @@ -176,8 +179,11 @@ CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', - 'ExecTicks', 'ExecMicro', 'ExecMacro' ]) + 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', + 'ExecAsid' ]) CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', - 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting' ]) + 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting', + 'ExecUser', 'ExecKernel' ]) CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', - 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting' ]) + 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting', + 'ExecUser', 'ExecKernel' ]) diff -r 64a938a8b7fc -r eb279d6e08a2 src/cpu/exetrace.cc --- a/src/cpu/exetrace.cc Fri May 13 17:27:00 2011 -0500 +++ b/src/cpu/exetrace.cc Fri May 13 17:27:00 2011 -0500 @@ -60,6 +60,12 @@ { ostream &outs = Trace::output(); + if (!Debug::ExecUser || !Debug::ExecKernel) { + bool in_user_mode = TheISA::inUserMode(thread); + if (in_user_mode && !Debug::ExecUser) return; + if (!in_user_mode && !Debug::ExecKernel) return; + } + if (Debug::ExecTicks) dumpTicks(outs); @@ -68,6 +74,9 @@ if (Debug::ExecSpeculative) outs << (misspeculating ? "-" : "+") << " "; + if (Debug::ExecAsid) + outs << "A" << dec << TheISA::getExecutingAsid(thread) << " "; + if (Debug::ExecThread) outs << "T" << thread->threadId() << " : "; _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev