system.hh revision 1762
17860SN/A/*
27860SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
37860SN/A * All rights reserved.
48825Snilay@cs.wisc.edu *
57935SN/A * Redistribution and use in source and binary forms, with or without
67935SN/A * modification, are permitted provided that the following conditions are
77935SN/A * met: redistributions of source code must retain the above copyright
87860SN/A * notice, this list of conditions and the following disclaimer;
97860SN/A * redistributions in binary form must reproduce the above copyright
107860SN/A * notice, this list of conditions and the following disclaimer in the
117860SN/A * documentation and/or other materials provided with the distribution;
128825Snilay@cs.wisc.edu * neither the name of the copyright holders nor the names of its
139265SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from
148825Snilay@cs.wisc.edu * this software without specific prior written permission.
158825Snilay@cs.wisc.edu *
168825Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
177860SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
188464SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
198721SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
208825Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
218825Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
227935SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
237935SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247935SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257935SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
267935SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277935SN/A */
287935SN/A
298893Ssaidi@eecs.umich.edu#ifndef __SYSTEM_HH__
307860SN/A#define __SYSTEM_HH__
317860SN/A
327860SN/A#include <string>
338825Snilay@cs.wisc.edu#include <vector>
347860SN/A
357860SN/A#include "base/statistics.hh"
367860SN/A#include "cpu/pc_event.hh"
377860SN/A#include "kern/system_events.hh"
388210SN/A#include "sim/sim_object.hh"
398210SN/A
407860SN/Aclass BaseCPU;
417860SN/Aclass ExecContext;
427860SN/Aclass GDBListener;
437860SN/Aclass MemoryController;
447860SN/Aclass ObjectFile;
457860SN/Aclass PhysicalMemory;
467860SN/Aclass Platform;
477860SN/Aclass RemoteGDB;
487860SN/Aclass SymbolTable;
497860SN/Anamespace Kernel { class Binning; }
507860SN/A
517860SN/Aclass System : public SimObject
527860SN/A{
537860SN/A  public:
547860SN/A    MemoryController *memctrl;
557860SN/A    PhysicalMemory *physmem;
567860SN/A    Platform *platform;
577860SN/A    PCEventQueue pcEventQueue;
587860SN/A    uint64_t init_param;
597860SN/A
607860SN/A    std::vector<ExecContext *> execContexts;
617860SN/A
628825Snilay@cs.wisc.edu    /** kernel Symbol table */
637860SN/A    SymbolTable *kernelSymtab;
647860SN/A
657860SN/A    /** console symbol table */
667860SN/A    SymbolTable *consoleSymtab;
677860SN/A
687860SN/A    /** pal symbol table */
697860SN/A    SymbolTable *palSymtab;
707860SN/A
717860SN/A    /** Object pointer for the kernel code */
727860SN/A    ObjectFile *kernel;
737860SN/A
747860SN/A    /** Object pointer for the console code */
757860SN/A    ObjectFile *console;
767860SN/A
777860SN/A    /** Object pointer for the PAL code */
787860SN/A    ObjectFile *pal;
797860SN/A
808825Snilay@cs.wisc.edu    /** Begining of kernel code */
817860SN/A    Addr kernelStart;
827860SN/A
837860SN/A    /** End of kernel code */
847860SN/A    Addr kernelEnd;
857860SN/A
867860SN/A    /** Entry point in the kernel to start at */
877860SN/A    Addr kernelEntry;
887860SN/A
897860SN/A    Kernel::Binning *kernelBinning;
907860SN/A
917860SN/A#ifdef DEBUG
928825Snilay@cs.wisc.edu    /** Event to halt the simulator if the console calls panic() */
937860SN/A    BreakPCEvent *consolePanicEvent;
947860SN/A#endif
957860SN/A
967860SN/A  public:
977860SN/A    std::vector<RemoteGDB *> remoteGDB;
987860SN/A    std::vector<GDBListener *> gdbListen;
997860SN/A    bool breakpoint();
1008825Snilay@cs.wisc.edu
1017860SN/A  public:
1027860SN/A    struct Params
1037860SN/A    {
1047860SN/A        std::string name;
1057860SN/A        Tick boot_cpu_frequency;
1067860SN/A        MemoryController *memctrl;
1077860SN/A        PhysicalMemory *physmem;
1087860SN/A        uint64_t init_param;
1097860SN/A        bool bin;
1107860SN/A        std::vector<std::string> binned_fns;
1117860SN/A        bool bin_int;
1127860SN/A
1137860SN/A        std::string kernel_path;
1147860SN/A        std::string console_path;
1157860SN/A        std::string palcode;
1167860SN/A        std::string boot_osflags;
1178521SN/A
1187860SN/A        std::string readfile;
1197860SN/A        uint64_t system_type;
1207860SN/A        uint64_t system_rev;
1217860SN/A    };
1227860SN/A    Params *params;
1237860SN/A
1247860SN/A    System(Params *p);
1257860SN/A    ~System();
1267860SN/A
1277860SN/A    void startup();
1287860SN/A
1298893Ssaidi@eecs.umich.edu  public:
1307860SN/A    /**
1317860SN/A     * Returns the addess the kernel starts at.
1329265SAli.Saidi@ARM.com     * @return address the kernel starts at
1337860SN/A     */
1347860SN/A    Addr getKernelStart() const { return kernelStart; }
1359265SAli.Saidi@ARM.com
1368150SN/A    /**
1377860SN/A     * Returns the addess the kernel ends at.
1387860SN/A     * @return address the kernel ends at
1397860SN/A     */
1408835SAli.Saidi@ARM.com    Addr getKernelEnd() const { return kernelEnd; }
1417860SN/A
1427860SN/A    /**
1439265SAli.Saidi@ARM.com     * Returns the addess the entry point to the kernel code.
1447860SN/A     * @return entry point of the kernel code
1457860SN/A     */
1468835SAli.Saidi@ARM.com    Addr getKernelEntry() const { return kernelEntry; }
1477860SN/A
1487860SN/A    int registerExecContext(ExecContext *xc);
1497860SN/A    void replaceExecContext(ExecContext *xc, int xcIndex);
1507860SN/A
1517860SN/A    void regStats();
1528893Ssaidi@eecs.umich.edu    void serialize(std::ostream &os);
1537860SN/A    void unserialize(Checkpoint *cp, const std::string &section);
1547860SN/A
1557860SN/A  public:
1568825Snilay@cs.wisc.edu    ////////////////////////////////////////////
1577860SN/A    //
1588825Snilay@cs.wisc.edu    // STATIC GLOBAL SYSTEM LIST
1598825Snilay@cs.wisc.edu    //
1608825Snilay@cs.wisc.edu    ////////////////////////////////////////////
1618825Snilay@cs.wisc.edu
1629265SAli.Saidi@ARM.com    static std::vector<System *> systemList;
1639265SAli.Saidi@ARM.com    static int numSystemsRunning;
1648825Snilay@cs.wisc.edu
1658893Ssaidi@eecs.umich.edu    static void printSystems();
1667860SN/A};
1677860SN/A
1687860SN/A#endif // __SYSTEM_HH__
1697860SN/A