Merge zizzer.eecs.umich.edu:/z/m5/Bitkeeper/m5
[gem5.git] / cpu / intr_control.cc
index 037b00ef4d40c33f8e5198cc371e31220edbfbc6..5f17c7212c6c4c0eabe99c701271d640c157a437 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
 #include <string>
 #include <vector>
 
-#include "cpu/base_cpu.hh"
+#include "cpu/base.hh"
 #include "cpu/intr_control.hh"
 #include "sim/builder.hh"
 #include "sim/sim_object.hh"
@@ -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)