From 11b931df6aad5a3063812647a577957ad9443b7b Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 8 Nov 2007 10:46:41 -0500 Subject: [PATCH] Interrupts: Inline some code and remove duplication. --HG-- extra : convert_revision : 0631c601f281bdd2a12ff0d0ae94576780115c2a --- src/cpu/intr_control.cc | 27 +++++++-------------------- src/cpu/intr_control.hh | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/cpu/intr_control.cc b/src/cpu/intr_control.cc index 018ae1886..c3a11ad91 100644 --- a/src/cpu/intr_control.cc +++ b/src/cpu/intr_control.cc @@ -32,6 +32,7 @@ #include #include +#include "base/trace.hh" #include "cpu/base.hh" #include "cpu/thread_context.hh" #include "cpu/intr_control.hh" @@ -43,36 +44,22 @@ IntrControl::IntrControl(const Params *p) : SimObject(p), sys(p->sys) {} -void -IntrControl::post(int int_num, int index) -{ - std::vector &tcvec = sys->threadContexts; - BaseCPU *temp = tcvec[0]->getCpuPtr(); - temp->post_interrupt(int_num, index); -} - void IntrControl::post(int cpu_id, int int_num, int index) { + DPRINTF(IntrControl, "post %d:%d (cpu %d)\n", int_num, index, cpu_id); std::vector &tcvec = sys->threadContexts; - BaseCPU *temp = tcvec[cpu_id]->getCpuPtr(); - temp->post_interrupt(int_num, index); -} - -void -IntrControl::clear(int int_num, int index) -{ - std::vector &tcvec = sys->threadContexts; - BaseCPU *temp = tcvec[0]->getCpuPtr(); - temp->clear_interrupt(int_num, index); + BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr(); + cpu->post_interrupt(int_num, index); } void IntrControl::clear(int cpu_id, int int_num, int index) { + DPRINTF(IntrControl, "clear %d:%d (cpu %d)\n", int_num, index, cpu_id); std::vector &tcvec = sys->threadContexts; - BaseCPU *temp = tcvec[cpu_id]->getCpuPtr(); - temp->clear_interrupt(int_num, index); + BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr(); + cpu->clear_interrupt(int_num, index); } IntrControl * diff --git a/src/cpu/intr_control.hh b/src/cpu/intr_control.hh index 746859fab..2a63cf608 100644 --- a/src/cpu/intr_control.hh +++ b/src/cpu/intr_control.hh @@ -47,10 +47,20 @@ class IntrControl : public SimObject typedef IntrControlParams Params; IntrControl(const Params *p); - 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); + + void + clear(int int_num, int index = 0) + { + clear(0, int_num, index); + } + + void + post(int int_num, int index = 0) + { + post(0, int_num, index); + } }; #endif // __INTR_CONTROL_HH__ -- 2.30.2