system.hh revision 1762
16145SN/A/* 26145SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan 36145SN/A * All rights reserved. 46145SN/A * 56145SN/A * Redistribution and use in source and binary forms, with or without 66145SN/A * modification, are permitted provided that the following conditions are 76145SN/A * met: redistributions of source code must retain the above copyright 86145SN/A * notice, this list of conditions and the following disclaimer; 96145SN/A * redistributions in binary form must reproduce the above copyright 106145SN/A * notice, this list of conditions and the following disclaimer in the 116145SN/A * documentation and/or other materials provided with the distribution; 126145SN/A * neither the name of the copyright holders nor the names of its 136145SN/A * contributors may be used to endorse or promote products derived from 146145SN/A * this software without specific prior written permission. 156145SN/A * 166145SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176145SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186145SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196145SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206145SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216145SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226145SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236145SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246145SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256145SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266145SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145SN/A */ 286145SN/A 2911793Sbrandon.potter@amd.com#ifndef __SYSTEM_HH__ 3011793Sbrandon.potter@amd.com#define __SYSTEM_HH__ 317832SN/A 327832SN/A#include <string> 339356Snilay@cs.wisc.edu#include <vector> 348232SN/A 357054SN/A#include "base/statistics.hh" 368257SBrad.Beckmann@amd.com#include "cpu/pc_event.hh" 3711793Sbrandon.potter@amd.com#include "kern/system_events.hh" 387054SN/A#include "sim/sim_object.hh" 396145SN/A 407055SN/Aclass BaseCPU; 417055SN/Aclass ExecContext; 427054SN/Aclass GDBListener; 438257SBrad.Beckmann@amd.comclass MemoryController; 446145SN/Aclass ObjectFile; 456145SN/Aclass PhysicalMemory; 466145SN/Aclass Platform; 476145SN/Aclass RemoteGDB; 486145SN/Aclass SymbolTable; 496145SN/Anamespace Kernel { class Binning; } 506145SN/A 5111096Snilay@cs.wisc.educlass System : public SimObject 5211096Snilay@cs.wisc.edu{ 5311096Snilay@cs.wisc.edu public: 5411096Snilay@cs.wisc.edu MemoryController *memctrl; 5511096Snilay@cs.wisc.edu PhysicalMemory *physmem; 566145SN/A Platform *platform; 576881SN/A PCEventQueue pcEventQueue; 586881SN/A uint64_t init_param; 596285SN/A 6011663Stushar@ece.gatech.edu std::vector<ExecContext *> execContexts; 6111663Stushar@ece.gatech.edu 6211663Stushar@ece.gatech.edu /** kernel Symbol table */ 6311663Stushar@ece.gatech.edu SymbolTable *kernelSymtab; 6411663Stushar@ece.gatech.edu 6511663Stushar@ece.gatech.edu /** console symbol table */ 6611663Stushar@ece.gatech.edu SymbolTable *consoleSymtab; 6711663Stushar@ece.gatech.edu 689594Snilay@cs.wisc.edu /** pal symbol table */ 699594Snilay@cs.wisc.edu SymbolTable *palSymtab; 708257SBrad.Beckmann@amd.com 718257SBrad.Beckmann@amd.com /** Object pointer for the kernel code */ 728257SBrad.Beckmann@amd.com ObjectFile *kernel; 736881SN/A 7410078Snilay@cs.wisc.edu /** Object pointer for the console code */ 759869Sjthestness@gmail.com ObjectFile *console; 767054SN/A 778257SBrad.Beckmann@amd.com /** Object pointer for the PAL code */ 786145SN/A ObjectFile *pal; 798257SBrad.Beckmann@amd.com 8011663Stushar@ece.gatech.edu /** Begining of kernel code */ 8111663Stushar@ece.gatech.edu Addr kernelStart; 8211663Stushar@ece.gatech.edu 8311663Stushar@ece.gatech.edu /** End of kernel code */ 847054SN/A Addr kernelEnd; 856145SN/A 8611663Stushar@ece.gatech.edu /** Entry point in the kernel to start at */ 879594Snilay@cs.wisc.edu Addr kernelEntry; 889594Snilay@cs.wisc.edu 898257SBrad.Beckmann@amd.com Kernel::Binning *kernelBinning; 9011663Stushar@ece.gatech.edu 9111663Stushar@ece.gatech.edu#ifdef DEBUG 926881SN/A /** Event to halt the simulator if the console calls panic() */ 9311664Stushar@ece.gatech.edu BreakPCEvent *consolePanicEvent; 9411664Stushar@ece.gatech.edu#endif 9511664Stushar@ece.gatech.edu 968257SBrad.Beckmann@amd.com public: 978257SBrad.Beckmann@amd.com std::vector<RemoteGDB *> remoteGDB; 988257SBrad.Beckmann@amd.com std::vector<GDBListener *> gdbListen; 9911663Stushar@ece.gatech.edu bool breakpoint(); 10011663Stushar@ece.gatech.edu 1018257SBrad.Beckmann@amd.com public: 10211663Stushar@ece.gatech.edu struct Params 10311664Stushar@ece.gatech.edu { 1047054SN/A std::string name; 1056145SN/A Tick boot_cpu_frequency; 1066145SN/A MemoryController *memctrl; 1078257SBrad.Beckmann@amd.com PhysicalMemory *physmem; 1089799Snilay@cs.wisc.edu uint64_t init_param; 1097054SN/A bool bin; 1107054SN/A std::vector<std::string> binned_fns; 1117054SN/A bool bin_int; 1128257SBrad.Beckmann@amd.com 1138257SBrad.Beckmann@amd.com std::string kernel_path; 11410005Snilay@cs.wisc.edu std::string console_path; 1158257SBrad.Beckmann@amd.com std::string palcode; 11611320Ssteve.reinhardt@amd.com std::string boot_osflags; 1177054SN/A 1186881SN/A std::string readfile; 1198257SBrad.Beckmann@amd.com uint64_t system_type; 1207054SN/A uint64_t system_rev; 12111096Snilay@cs.wisc.edu }; 12211096Snilay@cs.wisc.edu Params *params; 12311096Snilay@cs.wisc.edu 12411096Snilay@cs.wisc.edu System(Params *p); 12511096Snilay@cs.wisc.edu ~System(); 12611096Snilay@cs.wisc.edu 1276145SN/A void startup(); 1287054SN/A 1297054SN/A public: 1307054SN/A /** 1317054SN/A * Returns the addess the kernel starts at. 1326145SN/A * @return address the kernel starts at 1337054SN/A */ 1348257SBrad.Beckmann@amd.com Addr getKernelStart() const { return kernelStart; } 1358257SBrad.Beckmann@amd.com 1368257SBrad.Beckmann@amd.com /** 1378257SBrad.Beckmann@amd.com * Returns the addess the kernel ends at. 1388257SBrad.Beckmann@amd.com * @return address the kernel ends at 1398257SBrad.Beckmann@amd.com */ 14011096Snilay@cs.wisc.edu Addr getKernelEnd() const { return kernelEnd; } 1418257SBrad.Beckmann@amd.com 1427054SN/A /** 14311320Ssteve.reinhardt@amd.com * Returns the addess the entry point to the kernel code. 1447054SN/A * @return entry point of the kernel code 14511096Snilay@cs.wisc.edu */ 14611096Snilay@cs.wisc.edu Addr getKernelEntry() const { return kernelEntry; } 14711096Snilay@cs.wisc.edu 1487054SN/A int registerExecContext(ExecContext *xc); 1497054SN/A void replaceExecContext(ExecContext *xc, int xcIndex); 1507054SN/A 1517054SN/A void regStats(); 1529799Snilay@cs.wisc.edu void serialize(std::ostream &os); 1539799Snilay@cs.wisc.edu void unserialize(Checkpoint *cp, const std::string §ion); 1549799Snilay@cs.wisc.edu 1557054SN/A public: 1567054SN/A //////////////////////////////////////////// 1576895SN/A // 1586895SN/A // STATIC GLOBAL SYSTEM LIST 1596895SN/A // 1607054SN/A //////////////////////////////////////////// 16111664Stushar@ece.gatech.edu 16211664Stushar@ece.gatech.edu static std::vector<System *> systemList; 16311664Stushar@ece.gatech.edu static int numSystemsRunning; 1647054SN/A 1657832SN/A static void printSystems(); 1667832SN/A}; 16711320Ssteve.reinhardt@amd.com 1688257SBrad.Beckmann@amd.com#endif // __SYSTEM_HH__ 1698257SBrad.Beckmann@amd.com