2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
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.
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.
35 #include "base/loader/symtab.hh"
36 #include "base/misc.hh"
37 #include "base/statistics.hh"
38 #include "cpu/pc_event.hh"
39 #include "mem/port.hh"
40 #include "sim/sim_object.hh"
42 #include "kern/system_events.hh"
43 #include "mem/vport.hh"
55 namespace Kernel { class Binning; }
58 class System : public SimObject
61 PhysicalMemory *physmem;
62 PCEventQueue pcEventQueue;
64 std::vector<ExecContext *> execContexts;
69 if (numcpus != execContexts.size())
70 panic("cpu array not fully populated!");
79 /** Port to physical memory used for writing object files into ram at
81 FunctionalPort functionalPort;
84 /** kernel symbol table */
85 SymbolTable *kernelSymtab;
87 /** Object pointer for the kernel code */
90 /** Begining of kernel code */
93 /** End of kernel code */
96 /** Entry point in the kernel to start at */
99 Kernel::Binning *kernelBinning;
106 #endif // FULL_SYSTEM
112 * Fix up an address used to match PCs for hooking simulator
113 * events on to target function executions. See comment in
114 * system.cc for details.
116 virtual Addr fixFuncEventAddr(Addr addr) = 0;
119 * Add a function-based event to the given function, to be looked
120 * up in the specified symbol table.
123 T *System::addFuncEvent(SymbolTable *symtab, const char *lbl)
125 Addr addr = 0; // initialize only to avoid compiler warning
127 if (symtab->findAddress(lbl, addr)) {
128 T *ev = new T(&pcEventQueue, lbl, fixFuncEventAddr(addr));
135 /** Add a function-based event to kernel code. */
137 T *System::addKernelFuncEvent(const char *lbl)
139 return addFuncEvent<T>(kernelSymtab, lbl);
145 std::vector<RemoteGDB *> remoteGDB;
146 std::vector<GDBListener *> gdbListen;
147 virtual bool breakpoint() = 0;
148 #endif // FULL_SYSTEM
154 PhysicalMemory *physmem;
157 Tick boot_cpu_frequency;
158 std::string boot_osflags;
161 std::vector<std::string> binned_fns;
164 std::string kernel_path;
165 std::string readfile;
178 const Params *params() const { return (const Params *)_params; }
184 * Returns the addess the kernel starts at.
185 * @return address the kernel starts at
187 Addr getKernelStart() const { return kernelStart; }
190 * Returns the addess the kernel ends at.
191 * @return address the kernel ends at
193 Addr getKernelEnd() const { return kernelEnd; }
196 * Returns the addess the entry point to the kernel code.
197 * @return entry point of the kernel code
199 Addr getKernelEntry() const { return kernelEntry; }
205 #endif // FULL_SYSTEM
207 int registerExecContext(ExecContext *xc, int xcIndex);
208 void replaceExecContext(ExecContext *xc, int xcIndex);
211 void serialize(std::ostream &os);
212 void unserialize(Checkpoint *cp, const std::string §ion);
215 ////////////////////////////////////////////
217 // STATIC GLOBAL SYSTEM LIST
219 ////////////////////////////////////////////
221 static std::vector<System *> systemList;
222 static int numSystemsRunning;
224 static void printSystems();
229 #endif // __SYSTEM_HH__