Architecture changes (only gem5 implementation right now):
- The register manager is gone. It's functionality is now encapsulated in the CPU classes. - For the client, there is the ConcreteCPU class that encapsulates the access to the CPU state (including registers) and architecture details. The correspondig objects for the CPUs inside the simulator can be accessed through the SimulatorController.getCPU() function. - Listener got a new ConcreteCPU* member to filter for which CPU the events should fire. The default NULL is used as wildcard for all aviable CPUs. The events respectively got a ConcreteCPU* member to indicate which CPU really fired the event. - For the server, there is CPUArchitecture to access the architecture details. git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1966 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
43
src/core/sal/CPU.cc
Normal file
43
src/core/sal/CPU.cc
Normal file
@ -0,0 +1,43 @@
|
||||
#include "CPU.hpp"
|
||||
|
||||
namespace fail {
|
||||
|
||||
// FIXME: Bochs specific? If not, at least get rid of this global variable.
|
||||
int interrupt_to_fire = -1;
|
||||
|
||||
void CPUArchitecture::addRegister(Register* reg)
|
||||
{
|
||||
assert(!reg->isAssigned() && "FATAL ERROR: The register is already assigned!");
|
||||
m_Registers.push_back(reg);
|
||||
|
||||
UniformRegisterSet* urs = getRegisterSetOfType(reg->getType());
|
||||
if (urs == NULL) {
|
||||
urs = new UniformRegisterSet(reg->getType());
|
||||
m_RegisterSubsets.push_back(urs);
|
||||
}
|
||||
urs->m_add(reg);
|
||||
}
|
||||
|
||||
Register* CPUArchitecture::getRegister(size_t i) const
|
||||
{
|
||||
assert(i < m_Registers.size() && "FATAL ERROR: Invalid index provided!");
|
||||
return m_Registers[i];
|
||||
}
|
||||
|
||||
UniformRegisterSet& CPUArchitecture::getRegisterSet(size_t i) const
|
||||
{
|
||||
assert(i < m_RegisterSubsets.size() && "FATAL ERROR: Invalid index provided!");
|
||||
return *m_RegisterSubsets[i];
|
||||
}
|
||||
|
||||
UniformRegisterSet* CPUArchitecture::getRegisterSetOfType(RegisterType t) const
|
||||
{
|
||||
for (std::vector< UniformRegisterSet* >::const_iterator it = m_RegisterSubsets.begin();
|
||||
it != m_RegisterSubsets.end(); it++) {
|
||||
if ((*it)->getType() == t)
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // end-of-namespace: fail
|
||||
Reference in New Issue
Block a user