summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/alpha/interrupts.hh9
-rw-r--r--src/arch/sparc/interrupts.hh12
-rw-r--r--src/arch/x86/interrupts.hh9
-rw-r--r--src/cpu/base.cc3
4 files changed, 30 insertions, 3 deletions
diff --git a/src/arch/alpha/interrupts.hh b/src/arch/alpha/interrupts.hh
index 89db134ff..f8e0ad4ef 100644
--- a/src/arch/alpha/interrupts.hh
+++ b/src/arch/alpha/interrupts.hh
@@ -48,6 +48,7 @@ class Interrupts : public SimObject
bool newInfoSet;
int newIpl;
int newSummary;
+ BaseCPU * cpu;
protected:
uint64_t interrupts[NumInterruptLevels];
@@ -62,7 +63,7 @@ class Interrupts : public SimObject
return dynamic_cast<const Params *>(_params);
}
- Interrupts(Params * p) : SimObject(p)
+ Interrupts(Params * p) : SimObject(p), cpu(NULL)
{
memset(interrupts, 0, sizeof(interrupts));
intstatus = 0;
@@ -70,6 +71,12 @@ class Interrupts : public SimObject
}
void
+ setCPU(BaseCPU * _cpu)
+ {
+ cpu = _cpu;
+ }
+
+ void
post(int int_num, int index)
{
DPRINTF(Interrupt, "Interrupt %d:%d posted\n", int_num, index);
diff --git a/src/arch/sparc/interrupts.hh b/src/arch/sparc/interrupts.hh
index 66b3792b5..ec930e2b0 100644
--- a/src/arch/sparc/interrupts.hh
+++ b/src/arch/sparc/interrupts.hh
@@ -43,12 +43,20 @@ namespace SparcISA
class Interrupts : public SimObject
{
-
private:
+ BaseCPU * cpu;
+
uint64_t interrupts[NumInterruptTypes];
uint64_t intStatus;
public:
+
+ void
+ setCPU(BaseCPU * _cpu)
+ {
+ cpu = _cpu;
+ }
+
typedef SparcInterruptsParams Params;
const Params *
@@ -57,7 +65,7 @@ class Interrupts : public SimObject
return dynamic_cast<const Params *>(_params);
}
- Interrupts(Params * p) : SimObject(p)
+ Interrupts(Params * p) : SimObject(p), cpu(NULL)
{
clearAll();
}
diff --git a/src/arch/x86/interrupts.hh b/src/arch/x86/interrupts.hh
index 8c7316217..c5e3bde0d 100644
--- a/src/arch/x86/interrupts.hh
+++ b/src/arch/x86/interrupts.hh
@@ -69,6 +69,7 @@
#include "sim/eventq.hh"
class ThreadContext;
+class BaseCPU;
namespace X86ISA {
@@ -182,6 +183,8 @@ class Interrupts : public BasicPioDevice, IntDev
void requestInterrupt(uint8_t vector, uint8_t deliveryMode, bool level);
+ BaseCPU *cpu;
+
public:
/*
* Params stuff.
@@ -189,6 +192,12 @@ class Interrupts : public BasicPioDevice, IntDev
typedef X86LocalApicParams Params;
void
+ setCPU(BaseCPU * newCPU)
+ {
+ cpu = newCPU;
+ }
+
+ void
setClock(Tick newClock)
{
clock = newClock;
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 29095f12a..06fcebad8 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -194,6 +194,8 @@ BaseCPU::BaseCPU(Params *p)
}
}
#if FULL_SYSTEM
+ interrupts->setCPU(this);
+
profileEvent = NULL;
if (params()->profile)
profileEvent = new ProfileEvent(this, params()->profile);
@@ -348,6 +350,7 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc)
#if FULL_SYSTEM
interrupts = oldCPU->interrupts;
+ interrupts->setCPU(this);
for (int i = 0; i < threadContexts.size(); ++i)
threadContexts[i]->profileClear();