system.hh revision 803
1/* 2 * Copyright (c) 2003 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef __LINUX_SYSTEM_HH__ 30#define __LINUX_SYSTEM_HH__ 31 32#include <vector> 33 34#include "sim/system.hh" 35#include "targetarch/isa_traits.hh" 36 37#ifdef FS_MEASURE 38#include <map> 39#endif 40 41class ExecContext; 42class ElfObject; 43class SymbolTable; 44 45class BreakPCEvent; 46class LinuxBadAddrEvent; 47class LinuxSkipFuncEvent; 48class LinuxSkipDelayLoopEvent; 49class LinuxPrintfEvent; 50class LinuxDebugPrintfEvent; 51class LinuxDumpMbufEvent; 52#ifdef FS_MEASURE 53class FnEvent; 54#endif 55class AlphaArguments; 56 57class LinuxSystem : public System 58{ 59 private: 60 ElfObject *kernel; 61 ElfObject *console; 62 ElfObject *bootloader; 63 64 SymbolTable *kernelSymtab; 65 SymbolTable *bootloaderSymtab; 66 SymbolTable *consoleSymtab; 67 68#ifdef FS_MEASURE 69 //INSTRUMENTATION CODEGEN BEGIN ONE 70 Statistics::MainBin *esIntrBin; 71 Statistics::MainBin *esRxeofBin; 72 Statistics::MainBin *esNewbufBin; 73 Statistics::MainBin *esDmaLoadBin; 74 Statistics::MainBin *dmaMapLoadBin; 75 Statistics::MainBin *etherInputBin; 76 Statistics::MainBin *netisrInputBin; 77 Statistics::MainBin *schednetisrIsrBin; 78 Statistics::MainBin *ipintrBin; 79 Statistics::MainBin *ipDooptionsBin; 80 Statistics::MainBin *ipReassBin; 81 Statistics::MainBin *tcpInputBin; 82 Statistics::MainBin *sbappendBin; 83 Statistics::MainBin *readBin; 84 Statistics::MainBin *sooReadBin; 85 Statistics::MainBin *orecvBin; 86 Statistics::MainBin *recvitBin; 87 Statistics::MainBin *soreceiveBin; 88 Statistics::MainBin *osendBin; 89 Statistics::MainBin *writeBin; 90 Statistics::MainBin *sooWriteBin; 91 Statistics::MainBin *senditBin; 92 Statistics::MainBin *sosendBin; 93 Statistics::MainBin *tcpSosendBin; 94 Statistics::MainBin *tcpOutputBin; 95 Statistics::MainBin *ipOutputBin; 96 Statistics::MainBin *etherOutputBin; 97 Statistics::MainBin *esStartBin; 98 Statistics::MainBin *esTransmitBin; 99 Statistics::MainBin *esTxeofBin; 100 Statistics::MainBin *idleThreadBin; 101 //INSTRUMENTATION CODEGEN END 102#endif //FS_MEASURE 103 104 BreakPCEvent *kernelPanicEvent; 105 BreakPCEvent *consolePanicEvent; 106 LinuxBadAddrEvent *badaddrEvent; 107 LinuxSkipFuncEvent *skipPowerStateEvent; 108 LinuxSkipFuncEvent *skipScavengeBootEvent; 109 LinuxSkipDelayLoopEvent *skipDelayLoopEvent; 110 LinuxPrintfEvent *printfEvent; 111 LinuxDebugPrintfEvent *debugPrintfEvent; 112 LinuxDebugPrintfEvent *debugPrintfrEvent; 113 LinuxDumpMbufEvent *dumpMbufEvent; 114#ifdef FS_MEASURE 115 //INSTRUMENTATION CODEGEN BEGIN TWO 116 FnEvent *esIntrEvent; 117 FnEvent *esRxeofEvent; 118 FnEvent *esNewbufEvent; 119 FnEvent *esDmaLoadEvent; 120 FnEvent *dmaMapLoadEvent; 121 FnEvent *etherInputEvent; 122 FnEvent *netisrInputEvent; 123 FnEvent *schednetisrIsrEvent; 124 FnEvent *ipintrEvent; 125 FnEvent *ipDooptionsEvent; 126 FnEvent *ipReassEvent; 127 FnEvent *tcpInputEvent; 128 FnEvent *sbappendEvent; 129 FnEvent *readEvent; 130 FnEvent *sooReadEvent; 131 FnEvent *orecvEvent; 132 FnEvent *recvitEvent; 133 FnEvent *soreceiveEvent; 134 FnEvent *osendEvent; 135 FnEvent *writeEvent; 136 FnEvent *sooWriteEvent; 137 FnEvent *senditEvent; 138 FnEvent *sosendEvent; 139 FnEvent *tcpSosendEvent; 140 FnEvent *tcpOutputEvent; 141 FnEvent *ipOutputEvent; 142 FnEvent *etherOutputEvent; 143 FnEvent *esStartEvent; 144 FnEvent *esTransmitEvent; 145 FnEvent *esTxeofEvent; 146 FnEvent *idleThreadEvent; 147 //INSTRUMENTATION CODEGEN END 148#endif //FS_MEASURE 149 150 private: 151 152 Addr kernelStart; 153 Addr kernelEnd; 154 Addr kernelEntry; 155 bool bin; 156 157#ifdef FS_MEASURE 158 std::multimap<const std::string, std::string> callerMap; 159 void populateMap(std::string caller, std::string callee); 160#endif 161 162 public: 163 std::vector<RemoteGDB *> remoteGDB; 164 std::vector<GDBListener *> gdbListen; 165 166 public: 167 LinuxSystem(const std::string _name, 168 const uint64_t _init_param, 169 MemoryController *_memCtrl, 170 PhysicalMemory *_physmem, 171 const std::string &kernel_path, 172 const std::string &console_path, 173 const std::string &palcode, 174 const std::string &boot_osflags, 175 const std::string &bootloader_path, 176 const bool _bin); 177 ~LinuxSystem(); 178 179 void setDelayLoop(ExecContext *xc); 180 181 int registerExecContext(ExecContext *xc); 182 void replaceExecContext(ExecContext *xc, int xcIndex); 183 184 Addr getKernelStart() const { return kernelStart; } 185 Addr getKernelEnd() const { return kernelEnd; } 186 Addr getKernelEntry() const { return kernelEntry; } 187 bool breakpoint(); 188 189 static void Printf(AlphaArguments args); 190 static void DumpMbuf(AlphaArguments args); 191 192#ifdef FS_MEASURE 193 bool findCaller(std::string callee, std::string caller) const; 194 void dumpState(ExecContext *xc) const; 195#endif //FS_MEASURE 196}; 197 198#endif // __LINUX_SYSTEM_HH__ 199