system.hh (8765:659670964330) | system.hh (8769:f95b2a679eb0) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * Copyright (c) 2011 Regents of the University of California 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39#include <vector> 40 41#include "base/loader/symtab.hh" 42#include "base/misc.hh" 43#include "base/statistics.hh" 44#include "config/full_system.hh" 45#include "cpu/pc_event.hh" 46#include "enums/MemoryMode.hh" | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * Copyright (c) 2011 Regents of the University of California 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39#include <vector> 40 41#include "base/loader/symtab.hh" 42#include "base/misc.hh" 43#include "base/statistics.hh" 44#include "config/full_system.hh" 45#include "cpu/pc_event.hh" 46#include "enums/MemoryMode.hh" |
47#include "kern/system_events.hh" |
|
47#include "mem/port.hh" 48#include "params/System.hh" 49#include "sim/sim_object.hh" 50 | 48#include "mem/port.hh" 49#include "params/System.hh" 50#include "sim/sim_object.hh" 51 |
51#if FULL_SYSTEM 52#include "kern/system_events.hh" 53#endif 54 | |
55class BaseCPU; | 52class BaseCPU; |
56class ThreadContext; | 53class BaseRemoteGDB; 54class FunctionalPort; 55class GDBListener; |
57class ObjectFile; 58class PhysicalMemory; | 56class ObjectFile; 57class PhysicalMemory; |
59 60#if FULL_SYSTEM | |
61class Platform; | 58class Platform; |
62class FunctionalPort; | 59class ThreadContext; |
63class VirtualPort; | 60class VirtualPort; |
64#endif 65class GDBListener; 66class BaseRemoteGDB; | |
67 68class System : public SimObject 69{ 70 public: 71 72 static const char *MemoryModeStrings[3]; 73 74 Enums::MemoryMode --- 35 unchanged lines hidden (view full) --- 110 111 /** check if an address points to valid system memory 112 * and thus we can fetch instructions out of it 113 */ 114 bool isMemory(const Addr addr) const; 115 116 Addr pagePtr; 117 | 61 62class System : public SimObject 63{ 64 public: 65 66 static const char *MemoryModeStrings[3]; 67 68 Enums::MemoryMode --- 35 unchanged lines hidden (view full) --- 104 105 /** check if an address points to valid system memory 106 * and thus we can fetch instructions out of it 107 */ 108 bool isMemory(const Addr addr) const; 109 110 Addr pagePtr; 111 |
118#if FULL_SYSTEM | |
119 uint64_t init_param; 120 121 /** Port to physical memory used for writing object files into ram at 122 * boot.*/ 123 FunctionalPort *functionalPort; 124 VirtualPort *virtPort; 125 126 /** kernel symbol table */ --- 14 unchanged lines hidden (view full) --- 141 /** Mask that should be anded for binary/symbol loading. 142 * This allows one two different OS requirements for the same ISA to be 143 * handled. Some OSes are compiled for a virtual address and need to be 144 * loaded into physical memory that starts at address 0, while other 145 * bare metal tools generate images that start at address 0. 146 */ 147 Addr loadAddrMask; 148 | 112 uint64_t init_param; 113 114 /** Port to physical memory used for writing object files into ram at 115 * boot.*/ 116 FunctionalPort *functionalPort; 117 VirtualPort *virtPort; 118 119 /** kernel symbol table */ --- 14 unchanged lines hidden (view full) --- 134 /** Mask that should be anded for binary/symbol loading. 135 * This allows one two different OS requirements for the same ISA to be 136 * handled. Some OSes are compiled for a virtual address and need to be 137 * loaded into physical memory that starts at address 0, while other 138 * bare metal tools generate images that start at address 0. 139 */ 140 Addr loadAddrMask; 141 |
149#endif // FULL_SYSTEM 150 | |
151 protected: 152 uint64_t nextPID; 153 154 public: 155 uint64_t allocatePID() 156 { 157 return nextPID++; 158 } --- 44 unchanged lines hidden (view full) --- 203 activeCpus[index] = true; 204 for (std::vector<bool>::iterator i = activeCpus.begin(); 205 i < activeCpus.end(); i++) { 206 if (*i) count++; 207 } 208 return count; 209 } 210 | 142 protected: 143 uint64_t nextPID; 144 145 public: 146 uint64_t allocatePID() 147 { 148 return nextPID++; 149 } --- 44 unchanged lines hidden (view full) --- 194 activeCpus[index] = true; 195 for (std::vector<bool>::iterator i = activeCpus.begin(); 196 i < activeCpus.end(); i++) { 197 if (*i) count++; 198 } 199 return count; 200 } 201 |
211#if FULL_SYSTEM | |
212 /** 213 * Fix up an address used to match PCs for hooking simulator 214 * events on to target function executions. See comment in 215 * system.cc for details. 216 */ | 202 /** 203 * Fix up an address used to match PCs for hooking simulator 204 * events on to target function executions. See comment in 205 * system.cc for details. 206 */ |
217 virtual Addr fixFuncEventAddr(Addr addr) = 0; | 207 virtual Addr fixFuncEventAddr(Addr addr) 208 { 209 panic("Base fixFuncEventAddr not implemented.\n"); 210 } |
218 219 /** 220 * Add a function-based event to the given function, to be looked 221 * up in the specified symbol table. 222 */ 223 template <class T> 224 T *addFuncEvent(SymbolTable *symtab, const char *lbl) 225 { --- 9 unchanged lines hidden (view full) --- 235 236 /** Add a function-based event to kernel code. */ 237 template <class T> 238 T *addKernelFuncEvent(const char *lbl) 239 { 240 return addFuncEvent<T>(kernelSymtab, lbl); 241 } 242 | 211 212 /** 213 * Add a function-based event to the given function, to be looked 214 * up in the specified symbol table. 215 */ 216 template <class T> 217 T *addFuncEvent(SymbolTable *symtab, const char *lbl) 218 { --- 9 unchanged lines hidden (view full) --- 228 229 /** Add a function-based event to kernel code. */ 230 template <class T> 231 T *addKernelFuncEvent(const char *lbl) 232 { 233 return addFuncEvent<T>(kernelSymtab, lbl); 234 } 235 |
243#endif | |
244 public: 245 std::vector<BaseRemoteGDB *> remoteGDB; 246 std::vector<GDBListener *> gdbListen; 247 bool breakpoint(); 248 249 public: 250 typedef SystemParams Params; 251 --- 5 unchanged lines hidden (view full) --- 257 ~System(); 258 259 void initState(); 260 261 const Params *params() const { return (const Params *)_params; } 262 263 public: 264 | 236 public: 237 std::vector<BaseRemoteGDB *> remoteGDB; 238 std::vector<GDBListener *> gdbListen; 239 bool breakpoint(); 240 241 public: 242 typedef SystemParams Params; 243 --- 5 unchanged lines hidden (view full) --- 249 ~System(); 250 251 void initState(); 252 253 const Params *params() const { return (const Params *)_params; } 254 255 public: 256 |
265#if FULL_SYSTEM | |
266 /** 267 * Returns the addess the kernel starts at. 268 * @return address the kernel starts at 269 */ 270 Addr getKernelStart() const { return kernelStart; } 271 272 /** 273 * Returns the addess the kernel ends at. 274 * @return address the kernel ends at 275 */ 276 Addr getKernelEnd() const { return kernelEnd; } 277 278 /** 279 * Returns the addess the entry point to the kernel code. 280 * @return entry point of the kernel code 281 */ 282 Addr getKernelEntry() const { return kernelEntry; } 283 | 257 /** 258 * Returns the addess the kernel starts at. 259 * @return address the kernel starts at 260 */ 261 Addr getKernelStart() const { return kernelStart; } 262 263 /** 264 * Returns the addess the kernel ends at. 265 * @return address the kernel ends at 266 */ 267 Addr getKernelEnd() const { return kernelEnd; } 268 269 /** 270 * Returns the addess the entry point to the kernel code. 271 * @return entry point of the kernel code 272 */ 273 Addr getKernelEntry() const { return kernelEntry; } 274 |
284#endif 285 | |
286 Addr new_page(); 287 288 int registerThreadContext(ThreadContext *tc, int assigned=-1); 289 void replaceThreadContext(ThreadContext *tc, int context_id); 290 291 void serialize(std::ostream &os); 292 void unserialize(Checkpoint *cp, const std::string §ion); 293 virtual void resume(); --- 20 unchanged lines hidden --- | 275 Addr new_page(); 276 277 int registerThreadContext(ThreadContext *tc, int assigned=-1); 278 void replaceThreadContext(ThreadContext *tc, int context_id); 279 280 void serialize(std::ostream &os); 281 void unserialize(Checkpoint *cp, const std::string §ion); 282 virtual void resume(); --- 20 unchanged lines hidden --- |