General fixes for Sampling CPU in full system mode, and serialization of sampling CPU
authorRon Dreslinski <rdreslin@umich.edu>
Mon, 3 Nov 2003 00:38:22 +0000 (19:38 -0500)
committerRon Dreslinski <rdreslin@umich.edu>
Mon, 3 Nov 2003 00:38:22 +0000 (19:38 -0500)
cpu/intr_control.cc:
    Fix the reference to the cpu, to look up which cpu is being used
    In sampling mode can't use an absolute pointer to the cpu, use the
    exeContexts vector
cpu/intr_control.hh:
    Add two new functions to simplify MP interrupts, fix it for sampling CPU model

--HG--
extra : convert_revision : a69cdbb81e6aefa3fd5385416713c689300bbea8

cpu/intr_control.cc
cpu/intr_control.hh

index 037b00ef4d40c33f8e5198cc371e31220edbfbc6..c71a36b6f6c87d0f2e8c664449ea9ffa8c4a2d1a 100644 (file)
@@ -40,6 +40,42 @@ IntrControl::IntrControl(const string &name, BaseCPU *c)
     : SimObject(name), cpu(c)
 {}
 
+/* @todo
+ *Fix the cpu sim object parameter to be a system pointer
+ *instead, to avoid some extra dereferencing
+ */
+void
+IntrControl::post(int int_num, int index)
+{
+    std::vector<ExecContext *> &xcvec = cpu->system->execContexts;
+    BaseCPU *temp = xcvec[0]->cpu;
+    temp->post_interrupt(int_num, index);
+}
+
+void
+IntrControl::post(int cpu_id, int int_num, int index)
+{
+    std::vector<ExecContext *> &xcvec = cpu->system->execContexts;
+    BaseCPU *temp = xcvec[cpu_id]->cpu;
+    temp->post_interrupt(int_num, index);
+}
+
+void
+IntrControl::clear(int int_num, int index)
+{
+    std::vector<ExecContext *> &xcvec = cpu->system->execContexts;
+    BaseCPU *temp = xcvec[0]->cpu;
+    temp->clear_interrupt(int_num, index);
+}
+
+void
+IntrControl::clear(int cpu_id, int int_num, int index)
+{
+    std::vector<ExecContext *> &xcvec = cpu->system->execContexts;
+    BaseCPU *temp = xcvec[cpu_id]->cpu;
+    temp->clear_interrupt(int_num, index);
+}
+
 BEGIN_DECLARE_SIM_OBJECT_PARAMS(IntrControl)
 
     SimObjectParam<BaseCPU *> cpu;
@@ -48,7 +84,7 @@ END_DECLARE_SIM_OBJECT_PARAMS(IntrControl)
 
 BEGIN_INIT_SIM_OBJECT_PARAMS(IntrControl)
 
-    INIT_PARAM(cpu, "the processor")
+    INIT_PARAM(cpu, "the cpu")
 
 END_INIT_SIM_OBJECT_PARAMS(IntrControl)
 
index b8fa68f521aa58fbf3c377d94d626c168a3f5867..37e62ed00249204937951f27c791c9c97de4f06a 100644 (file)
 #ifndef __INTR_CONTROL_HH__
 #define __INTR_CONTROL_HH__
 
+#include <vector>
 #include "base/misc.hh"
 #include "cpu/base_cpu.hh"
 #include "sim/sim_object.hh"
+#include "sim/system.hh"
+#include "cpu/exec_context.hh"
+
 
 class IntrControl : public SimObject
 {
@@ -41,16 +45,10 @@ class IntrControl : public SimObject
 
     void clear(int int_num, int index = 0);
     void post(int int_num, int index = 0);
+    void clear(int cpu_id, int int_num, int index);
+    void post(int cpu_id, int int_num, int index);
 };
 
-inline void
-IntrControl::post(int int_num, int index)
-{ cpu->post_interrupt(int_num, index); }
-
-inline void
-IntrControl::clear(int int_num, int index)
-{ cpu->clear_interrupt(int_num, index); }
-
 #endif // __INTR_CONTROL_HH__