#include "mem/port.hh"
#include "params/System.hh"
#include "sim/sim_object.hh"
+
#if FULL_SYSTEM
#include "kern/system_events.hh"
-#include "mem/vport.hh"
#endif
class BaseCPU;
#if FULL_SYSTEM
class Platform;
+class FunctionalPort;
+class VirtualPort;
#endif
class GDBListener;
-namespace TheISA
-{
- class RemoteGDB;
-}
+class BaseRemoteGDB;
class System : public SimObject
{
PCEventQueue pcEventQueue;
std::vector<ThreadContext *> threadContexts;
- int numcpus;
+ int _numContexts;
- int getNumCPUs()
+ ThreadContext *getThreadContext(ThreadID tid)
{
- if (numcpus != threadContexts.size())
- panic("cpu array not fully populated!");
+ return threadContexts[tid];
+ }
- return numcpus;
+ int numContexts()
+ {
+ assert(_numContexts == (int)threadContexts.size());
+ return _numContexts;
}
+ /** Return number of running (non-halted) thread contexts in
+ * system. These threads could be Active or Suspended. */
+ int numRunningContexts();
+
#if FULL_SYSTEM
Platform *platform;
uint64_t init_param;
/** Port to physical memory used for writing object files into ram at
* boot.*/
- FunctionalPort functionalPort;
- VirtualPort virtPort;
+ FunctionalPort *functionalPort;
+ VirtualPort *virtPort;
/** kernel symbol table */
SymbolTable *kernelSymtab;
/** Entry point in the kernel to start at */
Addr kernelEntry;
+ /** Mask that should be anded for binary/symbol loading.
+ * This allows one two different OS requirements for the same ISA to be
+ * handled. Some OSes are compiled for a virtual address and need to be
+ * loaded into physical memory that starts at address 0, while other
+ * bare metal tools generate images that start at address 0.
+ */
+ Addr loadAddrMask;
+
#else
- int page_ptr;
+ Addr pagePtr;
+
+ protected:
+ uint64_t nextPID;
+
+ public:
+ uint64_t allocatePID()
+ {
+ return nextPID++;
+ }
+
+ /** Amount of physical memory that is still free */
+ Addr freeMemSize();
+
+ /** Amount of physical memory that exists */
+ Addr memSize();
#endif // FULL_SYSTEM
#endif
public:
- std::vector<TheISA::RemoteGDB *> remoteGDB;
+ std::vector<BaseRemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
bool breakpoint();
System(Params *p);
~System();
- void startup();
+ void initState();
const Params *params() const { return (const Params *)_params; }
#endif // FULL_SYSTEM
- int registerThreadContext(ThreadContext *tc, int tcIndex);
- void replaceThreadContext(ThreadContext *tc, int tcIndex);
+ int registerThreadContext(ThreadContext *tc, int assigned=-1);
+ void replaceThreadContext(ThreadContext *tc, int context_id);
void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string §ion);