changeset 606de5b3d116 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=606de5b3d116
description:
        CPU: Add a setCPU function to the interrupt objects.

diffstat:

4 files changed, 30 insertions(+), 3 deletions(-)
src/arch/alpha/interrupts.hh |    9 ++++++++-
src/arch/sparc/interrupts.hh |   12 ++++++++++--
src/arch/x86/interrupts.hh   |    9 +++++++++
src/cpu/base.cc              |    3 +++

diffs (120 lines):

diff -r 6973fc63ff0e -r 606de5b3d116 src/arch/alpha/interrupts.hh
--- a/src/arch/alpha/interrupts.hh      Sun Jan 25 20:26:53 2009 -0800
+++ b/src/arch/alpha/interrupts.hh      Sun Jan 25 20:29:03 2009 -0800
@@ -48,6 +48,7 @@
     bool newInfoSet;
     int newIpl;
     int newSummary;
+    BaseCPU * cpu;
 
   protected:
     uint64_t interrupts[NumInterruptLevels];
@@ -62,7 +63,7 @@
         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 @@
     }
 
     void
+    setCPU(BaseCPU * _cpu)
+    {
+        cpu = _cpu;
+    }
+
+    void
     post(int int_num, int index)
     {
         DPRINTF(Interrupt, "Interrupt %d:%d posted\n", int_num, index);
diff -r 6973fc63ff0e -r 606de5b3d116 src/arch/sparc/interrupts.hh
--- a/src/arch/sparc/interrupts.hh      Sun Jan 25 20:26:53 2009 -0800
+++ b/src/arch/sparc/interrupts.hh      Sun Jan 25 20:29:03 2009 -0800
@@ -43,12 +43,20 @@
 
 class Interrupts : public SimObject
 {
+  private:
+    BaseCPU * cpu;
 
-  private:
     uint64_t interrupts[NumInterruptTypes];
     uint64_t intStatus;
 
   public:
+
+    void
+    setCPU(BaseCPU * _cpu)
+    {
+        cpu = _cpu;
+    }
+
     typedef SparcInterruptsParams Params;
 
     const Params *
@@ -57,7 +65,7 @@
         return dynamic_cast<const Params *>(_params);
     }
 
-    Interrupts(Params * p) : SimObject(p)
+    Interrupts(Params * p) : SimObject(p), cpu(NULL)
     {
         clearAll();
     }
diff -r 6973fc63ff0e -r 606de5b3d116 src/arch/x86/interrupts.hh
--- a/src/arch/x86/interrupts.hh        Sun Jan 25 20:26:53 2009 -0800
+++ b/src/arch/x86/interrupts.hh        Sun Jan 25 20:29:03 2009 -0800
@@ -69,6 +69,7 @@
 #include "sim/eventq.hh"
 
 class ThreadContext;
+class BaseCPU;
 
 namespace X86ISA {
 
@@ -182,6 +183,8 @@
 
     void requestInterrupt(uint8_t vector, uint8_t deliveryMode, bool level);
 
+    BaseCPU *cpu;
+
   public:
     /*
      * Params stuff.
@@ -189,6 +192,12 @@
     typedef X86LocalApicParams Params;
 
     void
+    setCPU(BaseCPU * newCPU)
+    {
+        cpu = newCPU;
+    }
+
+    void
     setClock(Tick newClock)
     {
         clock = newClock;
diff -r 6973fc63ff0e -r 606de5b3d116 src/cpu/base.cc
--- a/src/cpu/base.cc   Sun Jan 25 20:26:53 2009 -0800
+++ b/src/cpu/base.cc   Sun Jan 25 20:29:03 2009 -0800
@@ -194,6 +194,8 @@
         }
     }
 #if FULL_SYSTEM
+    interrupts->setCPU(this);
+
     profileEvent = NULL;
     if (params()->profile)
         profileEvent = new ProfileEvent(this, params()->profile);
@@ -348,6 +350,7 @@
 
 #if FULL_SYSTEM
     interrupts = oldCPU->interrupts;
+    interrupts->setCPU(this);
 
     for (int i = 0; i < threadContexts.size(); ++i)
         threadContexts[i]->profileClear();
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to