system.hh revision 841
12SN/A/*
21762SN/A * Copyright (c) 2003 The Regents of The University of Michigan
37534Ssteve.reinhardt@amd.com * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272SN/A */
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.edu#ifndef __LINUX_SYSTEM_HH__
302665Ssaidi@eecs.umich.edu#define __LINUX_SYSTEM_HH__
312SN/A
322SN/A#include <vector>
332SN/A
342SN/A#include "sim/system.hh"
352SN/A#include "targetarch/isa_traits.hh"
362SN/A
372SN/A#include <map>
382SN/A
392SN/Aclass ExecContext;
405491Sgblack@eecs.umich.educlass ElfObject;
415491Sgblack@eecs.umich.educlass SymbolTable;
422SN/A
435491Sgblack@eecs.umich.educlass BreakPCEvent;
442SN/Aclass LinuxBadAddrEvent;
452SN/Aclass LinuxSkipFuncEvent;
464762Snate@binkert.orgclass LinuxSkipDelayLoopEvent;
475605Snate@binkert.orgclass LinuxPrintfEvent;
4856SN/Aclass LinuxDebugPrintfEvent;
492SN/Aclass LinuxDumpMbufEvent;
502797Sktlim@umich.educlass FnEvent;
512797Sktlim@umich.educlass AlphaArguments;
522609SN/A
532SN/Aclass LinuxSystem : public System
542SN/A{
552SN/A  private:
562SN/A    ElfObject *kernel;
572SN/A    ElfObject *console;
587492Ssteve.reinhardt@amd.com    ElfObject *bootloader;
592SN/A
601553SN/A    SymbolTable *kernelSymtab;
612797Sktlim@umich.edu    SymbolTable *bootloaderSymtab;
622901Ssaidi@eecs.umich.edu    SymbolTable *consoleSymtab;
632839Sktlim@umich.edu
642901Ssaidi@eecs.umich.edu
652797Sktlim@umich.edu    //INSTRUMENTATION CODEGEN BEGIN ONE
663202Shsul@eecs.umich.edu    Statistics::MainBin *esIntrBin;
672901Ssaidi@eecs.umich.edu    Statistics::MainBin *esRxeofBin;
682901Ssaidi@eecs.umich.edu    Statistics::MainBin *esNewbufBin;
692797Sktlim@umich.edu    Statistics::MainBin *esDmaLoadBin;
70265SN/A    Statistics::MainBin *dmaMapLoadBin;
712797Sktlim@umich.edu    Statistics::MainBin *etherInputBin;
721553SN/A    Statistics::MainBin *netisrInputBin;
731553SN/A    Statistics::MainBin *schednetisrIsrBin;
742797Sktlim@umich.edu    Statistics::MainBin *ipintrBin;
752797Sktlim@umich.edu    Statistics::MainBin *ipDooptionsBin;
762SN/A    Statistics::MainBin *ipReassBin;
772SN/A    Statistics::MainBin *tcpInputBin;
782SN/A    Statistics::MainBin *sbappendBin;
792SN/A    Statistics::MainBin *readBin;
802SN/A    Statistics::MainBin *sooReadBin;
812SN/A    Statistics::MainBin *orecvBin;
824762Snate@binkert.org    Statistics::MainBin *recvitBin;
834762Snate@binkert.org    Statistics::MainBin *soreceiveBin;
844762Snate@binkert.org    Statistics::MainBin *osendBin;
852SN/A    Statistics::MainBin *writeBin;
864762Snate@binkert.org    Statistics::MainBin *sooWriteBin;
874762Snate@binkert.org    Statistics::MainBin *senditBin;
884762Snate@binkert.org    Statistics::MainBin *sosendBin;
892SN/A    Statistics::MainBin *tcpSosendBin;
902SN/A    Statistics::MainBin *tcpOutputBin;
915034Smilesck@eecs.umich.edu    Statistics::MainBin *ipOutputBin;
925034Smilesck@eecs.umich.edu    Statistics::MainBin *etherOutputBin;
931553SN/A    Statistics::MainBin *esStartBin;
94265SN/A    Statistics::MainBin *esTransmitBin;
957532Ssteve.reinhardt@amd.com    Statistics::MainBin *esTxeofBin;
967532Ssteve.reinhardt@amd.com    Statistics::MainBin *idleThreadBin;
977532Ssteve.reinhardt@amd.com    //INSTRUMENTATION CODEGEN END
987532Ssteve.reinhardt@amd.com
997532Ssteve.reinhardt@amd.com    BreakPCEvent *kernelPanicEvent;
1007532Ssteve.reinhardt@amd.com    BreakPCEvent *consolePanicEvent;
1017532Ssteve.reinhardt@amd.com    LinuxBadAddrEvent *badaddrEvent;
1027532Ssteve.reinhardt@amd.com    LinuxSkipFuncEvent *skipPowerStateEvent;
1037532Ssteve.reinhardt@amd.com    LinuxSkipFuncEvent *skipScavengeBootEvent;
1047532Ssteve.reinhardt@amd.com    LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
1057532Ssteve.reinhardt@amd.com    LinuxPrintfEvent *printfEvent;
106465SN/A    LinuxDebugPrintfEvent *debugPrintfEvent;
107465SN/A    LinuxDebugPrintfEvent *debugPrintfrEvent;
1087532Ssteve.reinhardt@amd.com    LinuxDumpMbufEvent *dumpMbufEvent;
1097532Ssteve.reinhardt@amd.com
1107532Ssteve.reinhardt@amd.com    //INSTRUMENTATION CODEGEN BEGIN TWO
1117532Ssteve.reinhardt@amd.com    FnEvent *esIntrEvent;
1127532Ssteve.reinhardt@amd.com    FnEvent *esRxeofEvent;
1137532Ssteve.reinhardt@amd.com    FnEvent *esNewbufEvent;
1147532Ssteve.reinhardt@amd.com    FnEvent *esDmaLoadEvent;
1157532Ssteve.reinhardt@amd.com    FnEvent *dmaMapLoadEvent;
1167532Ssteve.reinhardt@amd.com    FnEvent *etherInputEvent;
1177532Ssteve.reinhardt@amd.com    FnEvent *netisrInputEvent;
1187532Ssteve.reinhardt@amd.com    FnEvent *schednetisrIsrEvent;
1197532Ssteve.reinhardt@amd.com    FnEvent *ipintrEvent;
1207532Ssteve.reinhardt@amd.com    FnEvent *ipDooptionsEvent;
1217532Ssteve.reinhardt@amd.com    FnEvent *ipReassEvent;
1227532Ssteve.reinhardt@amd.com    FnEvent *tcpInputEvent;
1237532Ssteve.reinhardt@amd.com    FnEvent *sbappendEvent;
1247532Ssteve.reinhardt@amd.com    FnEvent *readEvent;
1257532Ssteve.reinhardt@amd.com    FnEvent *sooReadEvent;
1262SN/A    FnEvent *orecvEvent;
1272SN/A    FnEvent *recvitEvent;
1282SN/A    FnEvent *soreceiveEvent;
129330SN/A    FnEvent *osendEvent;
1302SN/A    FnEvent *writeEvent;
1317532Ssteve.reinhardt@amd.com    FnEvent *sooWriteEvent;
1327532Ssteve.reinhardt@amd.com    FnEvent *senditEvent;
1337532Ssteve.reinhardt@amd.com    FnEvent *sosendEvent;
1347823Ssteve.reinhardt@amd.com    FnEvent *tcpSosendEvent;
1357532Ssteve.reinhardt@amd.com    FnEvent *tcpOutputEvent;
1367532Ssteve.reinhardt@amd.com    FnEvent *ipOutputEvent;
1377492Ssteve.reinhardt@amd.com    FnEvent *etherOutputEvent;
138330SN/A    FnEvent *esStartEvent;
139395SN/A    FnEvent *esTransmitEvent;
140395SN/A    FnEvent *esTxeofEvent;
1412797Sktlim@umich.edu    FnEvent *idleThreadEvent;
142938SN/A    //INSTRUMENTATION CODEGEN END
1432609SN/A
1442609SN/A  private:
1452901Ssaidi@eecs.umich.edu
1462901Ssaidi@eecs.umich.edu    Addr kernelStart;
1472901Ssaidi@eecs.umich.edu    Addr kernelEnd;
1482901Ssaidi@eecs.umich.edu    Addr kernelEntry;
1492797Sktlim@umich.edu    bool bin;
1502797Sktlim@umich.edu
1512797Sktlim@umich.edu    std::multimap<const std::string, std::string> callerMap;
1522797Sktlim@umich.edu    void populateMap(std::string caller, std::string callee);
1532609SN/A
1541031SN/A  public:
1551031SN/A    std::vector<RemoteGDB *>   remoteGDB;
1561031SN/A    std::vector<GDBListener *> gdbListen;
1571031SN/A
1581031SN/A  public:
1591031SN/A    LinuxSystem(const std::string _name,
1605314Sstever@gmail.com                const uint64_t _init_param,
1615314Sstever@gmail.com                MemoryController *_memCtrl,
1625315Sstever@gmail.com                PhysicalMemory *_physmem,
1635314Sstever@gmail.com                const std::string &kernel_path,
1645314Sstever@gmail.com                const std::string &console_path,
1655314Sstever@gmail.com                const std::string &palcode,
1662SN/A                const std::string &boot_osflags,
1672SN/A        const std::string &bootloader_path,
1682SN/A                                const bool _bin);
169    ~LinuxSystem();
170
171    void setDelayLoop(ExecContext *xc);
172
173    int registerExecContext(ExecContext *xc);
174    void replaceExecContext(ExecContext *xc, int xcIndex);
175
176    Addr getKernelStart() const { return kernelStart; }
177    Addr getKernelEnd() const { return kernelEnd; }
178    Addr getKernelEntry() const { return kernelEntry; }
179    bool breakpoint();
180
181    static void Printf(AlphaArguments args);
182    static void DumpMbuf(AlphaArguments args);
183
184    bool findCaller(std::string callee, std::string caller) const;
185    void dumpState(ExecContext *xc) const;
186};
187
188#endif // __LINUX_SYSTEM_HH__
189