system.hh revision 1067
15086Sgblack@eecs.umich.edu/* 25086Sgblack@eecs.umich.edu * Copyright (c) 2002-2004 The Regents of The University of Michigan 38466Snilay@cs.wisc.edu * All rights reserved. 45086Sgblack@eecs.umich.edu * 55086Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 67087Snate@binkert.org * modification, are permitted provided that the following conditions are 77087Snate@binkert.org * met: redistributions of source code must retain the above copyright 87087Snate@binkert.org * notice, this list of conditions and the following disclaimer; 97087Snate@binkert.org * redistributions in binary form must reproduce the above copyright 107087Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 117087Snate@binkert.org * documentation and/or other materials provided with the distribution; 127087Snate@binkert.org * neither the name of the copyright holders nor the names of its 137087Snate@binkert.org * contributors may be used to endorse or promote products derived from 145086Sgblack@eecs.umich.edu * this software without specific prior written permission. 157087Snate@binkert.org * 167087Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177087Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187087Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197087Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207087Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217087Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227087Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235086Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247087Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255086Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265086Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275086Sgblack@eecs.umich.edu */ 285086Sgblack@eecs.umich.edu 295086Sgblack@eecs.umich.edu#ifndef __SYSTEM_HH__ 305086Sgblack@eecs.umich.edu#define __SYSTEM_HH__ 315086Sgblack@eecs.umich.edu 325086Sgblack@eecs.umich.edu#include <string> 335086Sgblack@eecs.umich.edu#include <vector> 345086Sgblack@eecs.umich.edu 355086Sgblack@eecs.umich.edu#include "base/loader/symtab.hh" 365086Sgblack@eecs.umich.edu#include "base/statistics.hh" 375086Sgblack@eecs.umich.edu#include "cpu/pc_event.hh" 385086Sgblack@eecs.umich.edu#include "kern/system_events.hh" 395086Sgblack@eecs.umich.edu#include "sim/sim_object.hh" 405086Sgblack@eecs.umich.edu#include "sim/sw_context.hh" 415647Sgblack@eecs.umich.edu 428466Snilay@cs.wisc.educlass MemoryController; 438466Snilay@cs.wisc.educlass PhysicalMemory; 445086Sgblack@eecs.umich.educlass Platform; 455135Sgblack@eecs.umich.educlass RemoteGDB; 465647Sgblack@eecs.umich.educlass GDBListener; 479889Sandreas@sandberg.pp.se 485234Sgblack@eecs.umich.educlass ExecContext; 495086Sgblack@eecs.umich.edu 505086Sgblack@eecs.umich.educlass System : public SimObject 515086Sgblack@eecs.umich.edu{ 527707Sgblack@eecs.umich.edu // lisa's binning stuff 537707Sgblack@eecs.umich.edu private: 547707Sgblack@eecs.umich.edu std::map<const std::string, Stats::MainBin *> fnBins; 559887Sandreas@sandberg.pp.se std::map<const Addr, SWContext *> swCtxMap; 569887Sandreas@sandberg.pp.se 579887Sandreas@sandberg.pp.se protected: 589887Sandreas@sandberg.pp.se std::vector<FnEvent *> fnEvents; 599887Sandreas@sandberg.pp.se 609887Sandreas@sandberg.pp.se public: 619887Sandreas@sandberg.pp.se Stats::Scalar<> fnCalls; 629887Sandreas@sandberg.pp.se Stats::MainBin *Kernel; 639887Sandreas@sandberg.pp.se Stats::MainBin *User; 649887Sandreas@sandberg.pp.se 659887Sandreas@sandberg.pp.se Stats::MainBin * getBin(const std::string &name); 669887Sandreas@sandberg.pp.se bool findCaller(std::string, std::string) const; 679887Sandreas@sandberg.pp.se 689887Sandreas@sandberg.pp.se SWContext *findContext(Addr pcb); 699887Sandreas@sandberg.pp.se bool addContext(Addr pcb, SWContext *ctx) { 709887Sandreas@sandberg.pp.se return (swCtxMap.insert(make_pair(pcb, ctx))).second; 719887Sandreas@sandberg.pp.se } 729887Sandreas@sandberg.pp.se void remContext(Addr pcb) { 739887Sandreas@sandberg.pp.se swCtxMap.erase(pcb); 745086Sgblack@eecs.umich.edu return; 755135Sgblack@eecs.umich.edu } 765135Sgblack@eecs.umich.edu void dumpState(ExecContext *xc) const; 775135Sgblack@eecs.umich.edu 786048Sgblack@eecs.umich.edu virtual void serialize(std::ostream &os); 796048Sgblack@eecs.umich.edu virtual void unserialize(Checkpoint *cp, const std::string §ion); 806048Sgblack@eecs.umich.edu 816048Sgblack@eecs.umich.edu 826048Sgblack@eecs.umich.edu private: 836048Sgblack@eecs.umich.edu std::multimap<const std::string, std::string> callerMap; 847720Sgblack@eecs.umich.edu void populateMap(std::string caller, std::string callee); 857720Sgblack@eecs.umich.edu// 867720Sgblack@eecs.umich.edu 877720Sgblack@eecs.umich.edu public: 885135Sgblack@eecs.umich.edu const uint64_t init_param; 895135Sgblack@eecs.umich.edu MemoryController *memCtrl; 905135Sgblack@eecs.umich.edu PhysicalMemory *physmem; 915135Sgblack@eecs.umich.edu Platform *platform; 925135Sgblack@eecs.umich.edu bool bin; 935135Sgblack@eecs.umich.edu std::vector<string> binned_fns; 945135Sgblack@eecs.umich.edu 955135Sgblack@eecs.umich.edu PCEventQueue pcEventQueue; 965135Sgblack@eecs.umich.edu 975135Sgblack@eecs.umich.edu std::vector<ExecContext *> execContexts; 985135Sgblack@eecs.umich.edu 995135Sgblack@eecs.umich.edu std::string readfile; 1005135Sgblack@eecs.umich.edu 1015135Sgblack@eecs.umich.edu virtual int registerExecContext(ExecContext *xc); 1025135Sgblack@eecs.umich.edu virtual void replaceExecContext(int xcIndex, ExecContext *xc); 1035135Sgblack@eecs.umich.edu 1045135Sgblack@eecs.umich.edu public: 1055264Sgblack@eecs.umich.edu System(const std::string _name, const uint64_t _init_param, 1065135Sgblack@eecs.umich.edu MemoryController *, PhysicalMemory *, const bool, 1075135Sgblack@eecs.umich.edu const std::vector<string> &binned_fns); 1085135Sgblack@eecs.umich.edu ~System(); 1095135Sgblack@eecs.umich.edu 1105141Sgblack@eecs.umich.edu virtual Addr getKernelStart() const = 0; 1115141Sgblack@eecs.umich.edu virtual Addr getKernelEnd() const = 0; 1125141Sgblack@eecs.umich.edu virtual Addr getKernelEntry() const = 0; 1135141Sgblack@eecs.umich.edu virtual bool breakpoint() = 0; 1145141Sgblack@eecs.umich.edu 1155141Sgblack@eecs.umich.edu public: 1165141Sgblack@eecs.umich.edu //////////////////////////////////////////// 1175141Sgblack@eecs.umich.edu // 1185141Sgblack@eecs.umich.edu // STATIC GLOBAL SYSTEM LIST 1195182Sgblack@eecs.umich.edu // 1205141Sgblack@eecs.umich.edu //////////////////////////////////////////// 1215141Sgblack@eecs.umich.edu 1225141Sgblack@eecs.umich.edu static std::vector<System *> systemList; 1235141Sgblack@eecs.umich.edu static int numSystemsRunning; 1245141Sgblack@eecs.umich.edu 1255141Sgblack@eecs.umich.edu static void printSystems(); 1265135Sgblack@eecs.umich.edu}; 1275141Sgblack@eecs.umich.edu 1285141Sgblack@eecs.umich.edu#endif // __SYSTEM_HH__ 1295141Sgblack@eecs.umich.edu