system.hh revision 603
16145Snate@binkert.org/*
26145Snate@binkert.org * Copyright (c) 2003 The Regents of The University of Michigan
36145Snate@binkert.org * All rights reserved.
46145Snate@binkert.org *
56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without
66145Snate@binkert.org * modification, are permitted provided that the following conditions are
76145Snate@binkert.org * met: redistributions of source code must retain the above copyright
86145Snate@binkert.org * notice, this list of conditions and the following disclaimer;
96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright
106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
116145Snate@binkert.org * documentation and/or other materials provided with the distribution;
126145Snate@binkert.org * neither the name of the copyright holders nor the names of its
136145Snate@binkert.org * contributors may be used to endorse or promote products derived from
146145Snate@binkert.org * this software without specific prior written permission.
156145Snate@binkert.org *
166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276145Snate@binkert.org */
286145Snate@binkert.org
296145Snate@binkert.org#ifndef __SYSTEM_HH__
307039Snate@binkert.org#define __SYSTEM_HH__
317039Snate@binkert.org
327039Snate@binkert.org#include <string>
336145Snate@binkert.org#include <vector>
346145Snate@binkert.org
357039Snate@binkert.org#include "base/loader/symtab.hh"
367039Snate@binkert.org#include "base/statistics.hh"
376145Snate@binkert.org#include "cpu/pc_event.hh"
387002Snate@binkert.org#include "sim/sim_object.hh"
397021Stushar@csail.mit.edu#include "sim/sw_context.hh"
407002Snate@binkert.org
419465Snilay@cs.wisc.educlass MemoryController;
426145Snate@binkert.orgclass PhysicalMemory;
437039Snate@binkert.orgclass RemoteGDB;
447039Snate@binkert.orgclass GDBListener;
457039Snate@binkert.org
469465Snilay@cs.wisc.educlass ExecContext;
4710123Snilay@cs.wisc.edu
487039Snate@binkert.orgclass System : public SimObject
497039Snate@binkert.org{
506145Snate@binkert.org    // lisa's binning stuff
517039Snate@binkert.org  protected:
527039Snate@binkert.org    std::map<const std::string, Statistics::MainBin *> fnBins;
537039Snate@binkert.org    std::map<const Addr, SWContext *> swCtxMap;
546145Snate@binkert.org
557039Snate@binkert.org  public:
567039Snate@binkert.org    Statistics::Scalar<Counter> fnCalls;
577973Snilay@cs.wisc.edu    Statistics::MainBin *nonPath;
586145Snate@binkert.org
597039Snate@binkert.org    Statistics::MainBin * getBin(const std::string &name);
609171Snilay@cs.wisc.edu    virtual bool findCaller(std::string, std::string) const = 0;
617039Snate@binkert.org
627039Snate@binkert.org    SWContext *findContext(Addr pcb);
637039Snate@binkert.org    bool addContext(Addr pcb, SWContext *ctx) {
647039Snate@binkert.org        return (swCtxMap.insert(make_pair(pcb, ctx))).second;
657039Snate@binkert.org    }
669171Snilay@cs.wisc.edu    void remContext(Addr pcb) {
677039Snate@binkert.org        swCtxMap.erase(pcb);
687039Snate@binkert.org        return;
697039Snate@binkert.org    }
707039Snate@binkert.org
719600Snilay@cs.wisc.edu    virtual void dumpState(ExecContext *xc) const = 0;
729600Snilay@cs.wisc.edu
739600Snilay@cs.wisc.edu  public:
749499Snilay@cs.wisc.edu    const uint64_t init_param;
759171Snilay@cs.wisc.edu    MemoryController *memCtrl;
767039Snate@binkert.org    PhysicalMemory *physmem;
779171Snilay@cs.wisc.edu    bool bin;
789465Snilay@cs.wisc.edu
799171Snilay@cs.wisc.edu    PCEventQueue pcEventQueue;
809171Snilay@cs.wisc.edu
819171Snilay@cs.wisc.edu    std::vector<ExecContext *> execContexts;
829171Snilay@cs.wisc.edu
839171Snilay@cs.wisc.edu    virtual int registerExecContext(ExecContext *xc);
849171Snilay@cs.wisc.edu    virtual void replaceExecContext(int xcIndex, ExecContext *xc);
859171Snilay@cs.wisc.edu
869171Snilay@cs.wisc.edu  public:
879171Snilay@cs.wisc.edu    System(const std::string _name, const uint64_t _init_param,
8810123Snilay@cs.wisc.edu           MemoryController *, PhysicalMemory *, const bool);
899171Snilay@cs.wisc.edu    ~System();
909171Snilay@cs.wisc.edu
919171Snilay@cs.wisc.edu    virtual Addr getKernelStart() const = 0;
929171Snilay@cs.wisc.edu    virtual Addr getKernelEnd() const = 0;
936145Snate@binkert.org    virtual Addr getKernelEntry() const = 0;
946145Snate@binkert.org    virtual bool breakpoint() = 0;
957039Snate@binkert.org
967039Snate@binkert.org  public:
976145Snate@binkert.org    ////////////////////////////////////////////
987039Snate@binkert.org    //
997039Snate@binkert.org    // STATIC GLOBAL SYSTEM LIST
1007039Snate@binkert.org    //
1016145Snate@binkert.org    ////////////////////////////////////////////
1026145Snate@binkert.org
1037039Snate@binkert.org    static std::vector<System *> systemList;
104    static int numSystemsRunning;
105
106    static void printSystems();
107};
108
109#endif // __SYSTEM_HH__
110