CPU: Add a setCPU function to the interrupt objects.
This commit is contained in:
parent
3f9e2350a1
commit
d9794784ba
4 changed files with 30 additions and 3 deletions
|
@ -48,6 +48,7 @@ class Interrupts : public SimObject
|
||||||
bool newInfoSet;
|
bool newInfoSet;
|
||||||
int newIpl;
|
int newIpl;
|
||||||
int newSummary;
|
int newSummary;
|
||||||
|
BaseCPU * cpu;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint64_t interrupts[NumInterruptLevels];
|
uint64_t interrupts[NumInterruptLevels];
|
||||||
|
@ -62,13 +63,19 @@ class Interrupts : public SimObject
|
||||||
return dynamic_cast<const Params *>(_params);
|
return dynamic_cast<const Params *>(_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interrupts(Params * p) : SimObject(p)
|
Interrupts(Params * p) : SimObject(p), cpu(NULL)
|
||||||
{
|
{
|
||||||
memset(interrupts, 0, sizeof(interrupts));
|
memset(interrupts, 0, sizeof(interrupts));
|
||||||
intstatus = 0;
|
intstatus = 0;
|
||||||
newInfoSet = false;
|
newInfoSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setCPU(BaseCPU * _cpu)
|
||||||
|
{
|
||||||
|
cpu = _cpu;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
post(int int_num, int index)
|
post(int int_num, int index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,12 +43,20 @@ namespace SparcISA
|
||||||
|
|
||||||
class Interrupts : public SimObject
|
class Interrupts : public SimObject
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BaseCPU * cpu;
|
||||||
|
|
||||||
uint64_t interrupts[NumInterruptTypes];
|
uint64_t interrupts[NumInterruptTypes];
|
||||||
uint64_t intStatus;
|
uint64_t intStatus;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void
|
||||||
|
setCPU(BaseCPU * _cpu)
|
||||||
|
{
|
||||||
|
cpu = _cpu;
|
||||||
|
}
|
||||||
|
|
||||||
typedef SparcInterruptsParams Params;
|
typedef SparcInterruptsParams Params;
|
||||||
|
|
||||||
const Params *
|
const Params *
|
||||||
|
@ -57,7 +65,7 @@ class Interrupts : public SimObject
|
||||||
return dynamic_cast<const Params *>(_params);
|
return dynamic_cast<const Params *>(_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interrupts(Params * p) : SimObject(p)
|
Interrupts(Params * p) : SimObject(p), cpu(NULL)
|
||||||
{
|
{
|
||||||
clearAll();
|
clearAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include "sim/eventq.hh"
|
#include "sim/eventq.hh"
|
||||||
|
|
||||||
class ThreadContext;
|
class ThreadContext;
|
||||||
|
class BaseCPU;
|
||||||
|
|
||||||
namespace X86ISA {
|
namespace X86ISA {
|
||||||
|
|
||||||
|
@ -182,12 +183,20 @@ class Interrupts : public BasicPioDevice, IntDev
|
||||||
|
|
||||||
void requestInterrupt(uint8_t vector, uint8_t deliveryMode, bool level);
|
void requestInterrupt(uint8_t vector, uint8_t deliveryMode, bool level);
|
||||||
|
|
||||||
|
BaseCPU *cpu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
* Params stuff.
|
* Params stuff.
|
||||||
*/
|
*/
|
||||||
typedef X86LocalApicParams Params;
|
typedef X86LocalApicParams Params;
|
||||||
|
|
||||||
|
void
|
||||||
|
setCPU(BaseCPU * newCPU)
|
||||||
|
{
|
||||||
|
cpu = newCPU;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setClock(Tick newClock)
|
setClock(Tick newClock)
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,6 +194,8 @@ BaseCPU::BaseCPU(Params *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
|
interrupts->setCPU(this);
|
||||||
|
|
||||||
profileEvent = NULL;
|
profileEvent = NULL;
|
||||||
if (params()->profile)
|
if (params()->profile)
|
||||||
profileEvent = new ProfileEvent(this, params()->profile);
|
profileEvent = new ProfileEvent(this, params()->profile);
|
||||||
|
@ -348,6 +350,7 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc)
|
||||||
|
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
interrupts = oldCPU->interrupts;
|
interrupts = oldCPU->interrupts;
|
||||||
|
interrupts->setCPU(this);
|
||||||
|
|
||||||
for (int i = 0; i < threadContexts.size(); ++i)
|
for (int i = 0; i < threadContexts.size(); ++i)
|
||||||
threadContexts[i]->profileClear();
|
threadContexts[i]->profileClear();
|
||||||
|
|
Loading…
Reference in a new issue