/*
- * Copyright (c) 2002-2004 The Regents of The University of Michigan
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <string>
#include <vector>
+#include "base/loader/symtab.hh"
+#include "base/misc.hh"
#include "base/statistics.hh"
#include "cpu/pc_event.hh"
-#include "kern/system_events.hh"
+#include "mem/port.hh"
#include "sim/sim_object.hh"
+#if FULL_SYSTEM
+#include "kern/system_events.hh"
+#include "mem/vport.hh"
+#endif
class BaseCPU;
class ExecContext;
-class GDBListener;
-class MemoryController;
class ObjectFile;
class PhysicalMemory;
+
+#if FULL_SYSTEM
class Platform;
+class GDBListener;
class RemoteGDB;
-class SymbolTable;
namespace Kernel { class Binning; }
+#endif
class System : public SimObject
{
public:
- MemoryController *memctrl;
PhysicalMemory *physmem;
- Platform *platform;
PCEventQueue pcEventQueue;
- uint64_t init_param;
std::vector<ExecContext *> execContexts;
+ int numcpus;
- /** kernel Symbol table */
- SymbolTable *kernelSymtab;
+ int getNumCPUs()
+ {
+ if (numcpus != execContexts.size())
+ panic("cpu array not fully populated!");
+
+ return numcpus;
+ }
+
+#if FULL_SYSTEM
+ Platform *platform;
+ uint64_t init_param;
- /** console symbol table */
- SymbolTable *consoleSymtab;
+ /** Port to physical memory used for writing object files into ram at
+ * boot.*/
+ FunctionalPort functionalPort;
+ VirtualPort virtPort;
- /** pal symbol table */
- SymbolTable *palSymtab;
+ /** kernel symbol table */
+ SymbolTable *kernelSymtab;
/** Object pointer for the kernel code */
ObjectFile *kernel;
- /** Object pointer for the console code */
- ObjectFile *console;
-
- /** Object pointer for the PAL code */
- ObjectFile *pal;
-
/** Begining of kernel code */
Addr kernelStart;
Kernel::Binning *kernelBinning;
-#ifdef DEBUG
- /** Event to halt the simulator if the console calls panic() */
- BreakPCEvent *consolePanicEvent;
-#endif
+#else
+
+ int page_ptr;
+
+
+#endif // FULL_SYSTEM
+
+ protected:
+
+#if FULL_SYSTEM
+ /**
+ * Fix up an address used to match PCs for hooking simulator
+ * events on to target function executions. See comment in
+ * system.cc for details.
+ */
+ virtual Addr fixFuncEventAddr(Addr addr) = 0;
+ /**
+ * Add a function-based event to the given function, to be looked
+ * up in the specified symbol table.
+ */
+ template <class T>
+ T *System::addFuncEvent(SymbolTable *symtab, const char *lbl)
+ {
+ Addr addr = 0; // initialize only to avoid compiler warning
+
+ if (symtab->findAddress(lbl, addr)) {
+ T *ev = new T(&pcEventQueue, lbl, fixFuncEventAddr(addr));
+ return ev;
+ }
+
+ return NULL;
+ }
+
+ /** Add a function-based event to kernel code. */
+ template <class T>
+ T *System::addKernelFuncEvent(const char *lbl)
+ {
+ return addFuncEvent<T>(kernelSymtab, lbl);
+ }
+
+#endif
public:
+#if FULL_SYSTEM
std::vector<RemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
- bool breakpoint();
+ virtual bool breakpoint() = 0;
+#endif // FULL_SYSTEM
public:
struct Params
{
std::string name;
- Tick boot_cpu_frequency;
- MemoryController *memctrl;
PhysicalMemory *physmem;
+
+#if FULL_SYSTEM
+ Tick boot_cpu_frequency;
+ std::string boot_osflags;
uint64_t init_param;
bool bin;
std::vector<std::string> binned_fns;
bool bin_int;
std::string kernel_path;
- std::string console_path;
- std::string palcode;
- std::string boot_osflags;
-
std::string readfile;
- uint64_t system_type;
- uint64_t system_rev;
+#endif
};
- Params *params;
+ protected:
+ Params *_params;
+
+ public:
System(Params *p);
~System();
void startup();
+ const Params *params() const { return (const Params *)_params; }
+
public:
+
+#if FULL_SYSTEM
/**
* Returns the addess the kernel starts at.
* @return address the kernel starts at
*/
Addr getKernelEntry() const { return kernelEntry; }
- int registerExecContext(ExecContext *xc);
+#else
+
+ Addr new_page();
+
+#endif // FULL_SYSTEM
+
+ int registerExecContext(ExecContext *xc, int xcIndex);
void replaceExecContext(ExecContext *xc, int xcIndex);
void regStats();
static int numSystemsRunning;
static void printSystems();
+
+
};
#endif // __SYSTEM_HH__