system.hh revision 1492
14486Sbinkertn@umich.edu/* 24486Sbinkertn@umich.edu * Copyright (c) 2002-2004 The Regents of The University of Michigan 34486Sbinkertn@umich.edu * All rights reserved. 44486Sbinkertn@umich.edu * 54486Sbinkertn@umich.edu * Redistribution and use in source and binary forms, with or without 64486Sbinkertn@umich.edu * modification, are permitted provided that the following conditions are 74486Sbinkertn@umich.edu * met: redistributions of source code must retain the above copyright 84486Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer; 94486Sbinkertn@umich.edu * redistributions in binary form must reproduce the above copyright 104486Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer in the 114486Sbinkertn@umich.edu * documentation and/or other materials provided with the distribution; 124486Sbinkertn@umich.edu * neither the name of the copyright holders nor the names of its 134486Sbinkertn@umich.edu * contributors may be used to endorse or promote products derived from 144486Sbinkertn@umich.edu * this software without specific prior written permission. 154486Sbinkertn@umich.edu * 164486Sbinkertn@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174486Sbinkertn@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184486Sbinkertn@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194486Sbinkertn@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204486Sbinkertn@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214486Sbinkertn@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224486Sbinkertn@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234486Sbinkertn@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244486Sbinkertn@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254486Sbinkertn@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264486Sbinkertn@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274486Sbinkertn@umich.edu */ 284486Sbinkertn@umich.edu 296654Snate@binkert.org#ifndef __SYSTEM_HH__ 303102SN/A#define __SYSTEM_HH__ 313102SN/A 321681SN/A#include <string> 333223SN/A#include <vector> 341681SN/A 356654Snate@binkert.org#include "base/statistics.hh" 364486Sbinkertn@umich.edu#include "cpu/pc_event.hh" 374486Sbinkertn@umich.edu#include "kern/system_events.hh" 382817SN/A#include "sim/sim_object.hh" 392817SN/A 402932SN/Aclass MemoryController; 411681SN/Aclass PhysicalMemory; 426654Snate@binkert.orgclass Platform; 436654Snate@binkert.orgclass RemoteGDB; 442932SN/Aclass GDBListener; 453223SN/Aclass SymbolTable; 463223SN/Aclass ObjectFile; 472932SN/Aclass ExecContext; 482932SN/Anamespace Kernel { class Binning; } 492932SN/A 503223SN/Aclass System : public SimObject 513223SN/A{ 524997Sgblack@eecs.umich.edu public: 534997Sgblack@eecs.umich.edu MemoryController *memctrl; 542318SN/A PhysicalMemory *physmem; 554597Sbinkertn@umich.edu Platform *platform; 562871SN/A PCEventQueue pcEventQueue; 572871SN/A uint64_t init_param; 585236Sgblack@eecs.umich.edu 591681SN/A std::vector<ExecContext *> execContexts; 602932SN/A 612932SN/A /** kernel Symbol table */ 622932SN/A SymbolTable *kernelSymtab; 632932SN/A 642932SN/A /** console symbol table */ 652932SN/A SymbolTable *consoleSymtab; 662932SN/A 672932SN/A /** pal symbol table */ 682932SN/A SymbolTable *palSymtab; 691681SN/A 702932SN/A /** Object pointer for the kernel code */ 712932SN/A ObjectFile *kernel; 722932SN/A 731681SN/A /** Object pointer for the console code */ 742932SN/A ObjectFile *console; 751681SN/A 762932SN/A /** Object pointer for the PAL code */ 772932SN/A ObjectFile *pal; 782932SN/A 791681SN/A /** Begining of kernel code */ 802932SN/A Addr kernelStart; 812932SN/A 822932SN/A /** End of kernel code */ 832932SN/A Addr kernelEnd; 842932SN/A 852932SN/A /** Entry point in the kernel to start at */ 862932SN/A Addr kernelEntry; 872932SN/A 882932SN/A Kernel::Binning *kernelBinning; 892932SN/A 903223SN/A#ifdef DEBUG 912932SN/A /** Event to halt the simulator if the console calls panic() */ 922932SN/A BreakPCEvent *consolePanicEvent; 931681SN/A#endif 942932SN/A 952932SN/A public: 962932SN/A std::vector<RemoteGDB *> remoteGDB; 972932SN/A std::vector<GDBListener *> gdbListen; 982932SN/A bool breakpoint(); 991681SN/A 1002932SN/A public: 1012932SN/A struct Params 1021681SN/A { 1032932SN/A std::string name; 1042932SN/A MemoryController *memctrl; 1052932SN/A PhysicalMemory *physmem; 1062932SN/A uint64_t init_param; 1072932SN/A bool bin; 1082932SN/A std::vector<std::string> binned_fns; 1092932SN/A bool bin_int; 1103223SN/A 1112932SN/A std::string kernel_path; 1122932SN/A std::string console_path; 1131681SN/A std::string palcode; 1142932SN/A std::string boot_osflags; 1152932SN/A 1162873SN/A std::string readfile; 1172932SN/A uint64_t system_type; 1181681SN/A uint64_t system_rev; 1192932SN/A }; 1202932SN/A Params *params; 1212932SN/A 1222932SN/A System(Params *p); 1231681SN/A ~System(); 1242932SN/A 1251681SN/A void startup(); 1262932SN/A 1272932SN/A public: 1282932SN/A /** 1292932SN/A * Returns the addess the kernel starts at. 1302932SN/A * @return address the kernel starts at 1311681SN/A */ 1322932SN/A Addr getKernelStart() const { return kernelStart; } 1331681SN/A 1344597Sbinkertn@umich.edu /** 1354597Sbinkertn@umich.edu * Returns the addess the kernel ends at. 1364597Sbinkertn@umich.edu * @return address the kernel ends at 1374597Sbinkertn@umich.edu */ 1384597Sbinkertn@umich.edu Addr getKernelEnd() const { return kernelEnd; } 1394597Sbinkertn@umich.edu 1404597Sbinkertn@umich.edu /** 1414597Sbinkertn@umich.edu * Returns the addess the entry point to the kernel code. 1424597Sbinkertn@umich.edu * @return entry point of the kernel code 1434303SN/A */ 1447868Sgblack@eecs.umich.edu Addr getKernelEntry() const { return kernelEntry; } 1457868Sgblack@eecs.umich.edu 1464303SN/A int registerExecContext(ExecContext *xc); 1474303SN/A void replaceExecContext(ExecContext *xc, int xcIndex); 148 149 void regStats(); 150 void serialize(std::ostream &os); 151 void unserialize(Checkpoint *cp, const std::string §ion); 152 153 public: 154 //////////////////////////////////////////// 155 // 156 // STATIC GLOBAL SYSTEM LIST 157 // 158 //////////////////////////////////////////// 159 160 static std::vector<System *> systemList; 161 static int numSystemsRunning; 162 163 static void printSystems(); 164}; 165 166#endif // __SYSTEM_HH__ 167