From 586a219d11e988d392efe7c34d27bd00d1dedf43 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 19 Sep 2014 10:35:12 -0400 Subject: [PATCH] base: Ensure the CP annotation compiles again A bit of revamping to get the CP annotate functionality to compile. --- src/base/cp_annotate.cc | 20 ++++++++++++++----- src/base/cp_annotate.hh | 43 +++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/src/base/cp_annotate.cc b/src/base/cp_annotate.cc index 118c6bf36..858ee0cb8 100644 --- a/src/base/cp_annotate.cc +++ b/src/base/cp_annotate.cc @@ -28,7 +28,7 @@ * Authors: Ali Saidi */ -#include "arch/alpha/linux/threadinfo.hh" +#include "arch/generic/linux/threadinfo.hh" #include "arch/utility.hh" #include "base/loader/object_file.hh" #include "base/callback.hh" @@ -37,6 +37,8 @@ #include "base/trace.hh" #include "config/the_isa.hh" #include "cpu/thread_context.hh" +#include "debug/Annotate.hh" +#include "debug/AnnotateVerbose.hh" #include "sim/arguments.hh" #include "sim/core.hh" #include "sim/sim_exit.hh" @@ -142,6 +144,17 @@ CPA::startup() registerExitCallback(new AnnotateDumpCallback(this)); } + +uint64_t +CPA::getFrame(ThreadContext *tc) +{ + // This code is ISA specific and will need to be changed + // if the annotation code is used for something other than Alpha + return (tc->readMiscRegNoEffect(TheISA::IPR_PALtemp23) & + ~ULL(0x3FFF)); + +} + void CPA::swSmBegin(ThreadContext *tc) { @@ -328,12 +341,9 @@ CPA::swAutoBegin(ThreadContext *tc, Addr next_pc) string sym; Addr sym_addr = 0; - SymbolTable *symtab = NULL; - if (!TheISA::inUserMode(tc)) { debugSymbolTable->findNearestSymbol(next_pc, sym, sym_addr); - symtab = debugSymbolTable; } else { Linux::ThreadInfo ti(tc); string app = ti.curTaskName(); @@ -1285,7 +1295,7 @@ CPA::unserialize(Checkpoint *cp, const std::string §ion) paramIn(cp, section, csprintf("nameCache%d.str", x), str); paramIn(cp, section, csprintf("nameCache%d.int", x), sysi); - nameCache[sys] = std::make_pair(str, sysi); + nameCache[sys] = std::make_pair(str, sysi); } //smStack (SmStack) diff --git a/src/base/cp_annotate.hh b/src/base/cp_annotate.hh index 3e4597ba8..b5c968857 100644 --- a/src/base/cp_annotate.hh +++ b/src/base/cp_annotate.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2014 ARM Limited + * All rights reserved. + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2006-2009 The Regents of The University of Michigan * All rights reserved. * @@ -40,6 +52,7 @@ #include "base/hashmap.hh" #include "base/trace.hh" #include "base/types.hh" +#include "debug/AnnotateQ.hh" #include "config/cp_annotate.hh" #include "config/the_isa.hh" #include "sim/serialize.hh" @@ -109,6 +122,24 @@ class CPA int32_t count = 1) { return; } }; #else + +/** + * Provide a hash function for the CPI Id type + */ +__hash_namespace_begin +template <> +struct hash > +{ + + size_t + operator()(const std::pair& x) const + { + return hash()(x.first); + } + +}; +__hash_namespace_end + class CPA : SimObject { public: @@ -290,7 +321,7 @@ class CPA : SimObject if (smi == 0) { smCache[sysi-1][smid] = smi = ++numSm; assert(smi < 65535); - smMap.push_back(std::make_pair(sysi, smid)); + smMap.push_back(std::make_pair(sysi, smid)); } return smi; } @@ -325,7 +356,7 @@ class CPA : SimObject { NameCache::iterator i = nameCache.find(s); if (i == nameCache.end()) { - nameCache[s] = std::make_pair(s->name(), ++numSys); + nameCache[s] = std::make_pair(s->name(), ++numSys); i = nameCache.find(s); // might need to put smstackid into map here, but perhaps not //smStack.push_back(std::vector()); @@ -354,7 +385,7 @@ class CPA : SimObject qBytes.push_back(0); qData.push_back(AnnotateList()); numQ[sys-1]++; - qMap.push_back(std::make_pair(sys, qid)); + qMap.push_back(std::make_pair(sys, qid)); } return qi; } @@ -494,11 +525,7 @@ class CPA : SimObject CPA(Params *p); void startup(); - // This code is ISA specific and will need to be changed - // if the annotation code is used for something other than Alpha - inline uint64_t getFrame(ThreadContext *tc) - { return (tc->readMiscRegNoEffect(TheISA::IPR_PALtemp23) & - ~ULL(0x3FFF)); } + uint64_t getFrame(ThreadContext *tc); static bool available() { return true; } -- 2.30.2