This commit is contained in:
Nathan Binkert 2008-09-27 07:25:04 -07:00
parent 83f3bff643
commit 819023b8e2

View file

@ -37,10 +37,15 @@
#include "base/compiler.hh" #include "base/compiler.hh"
#include "cpu/thread_context.hh" #include "cpu/thread_context.hh"
namespace AlphaISA namespace AlphaISA {
class Interrupts
{ {
class Interrupts private:
{ bool newInfoSet;
int newIpl;
int newSummary;
protected: protected:
uint64_t interrupts[NumInterruptLevels]; uint64_t interrupts[NumInterruptLevels];
uint64_t intstatus; uint64_t intstatus;
@ -53,28 +58,30 @@ namespace AlphaISA
newInfoSet = false; newInfoSet = false;
} }
void post(int int_num, int index) void
post(int int_num, int index)
{ {
DPRINTF(Interrupt, "Interrupt %d:%d posted\n", int_num, index); DPRINTF(Interrupt, "Interrupt %d:%d posted\n", int_num, index);
if (int_num < 0 || int_num >= NumInterruptLevels) if (int_num < 0 || int_num >= NumInterruptLevels)
panic("int_num out of bounds\n"); panic("int_num out of bounds\n");
if (index < 0 || index >= sizeof(uint64_t) * 8) if (index < 0 || index >= (int)sizeof(uint64_t) * 8)
panic("int_num out of bounds\n"); panic("int_num out of bounds\n");
interrupts[int_num] |= 1 << index; interrupts[int_num] |= 1 << index;
intstatus |= (ULL(1) << int_num); intstatus |= (ULL(1) << int_num);
} }
void clear(int int_num, int index) void
clear(int int_num, int index)
{ {
DPRINTF(Interrupt, "Interrupt %d:%d cleared\n", int_num, index); DPRINTF(Interrupt, "Interrupt %d:%d cleared\n", int_num, index);
if (int_num < 0 || int_num >= TheISA::NumInterruptLevels) if (int_num < 0 || int_num >= TheISA::NumInterruptLevels)
panic("int_num out of bounds\n"); panic("int_num out of bounds\n");
if (index < 0 || index >= sizeof(uint64_t) * 8) if (index < 0 || index >= (int)sizeof(uint64_t) * 8)
panic("int_num out of bounds\n"); panic("int_num out of bounds\n");
interrupts[int_num] &= ~(1 << index); interrupts[int_num] &= ~(1 << index);
@ -82,7 +89,8 @@ namespace AlphaISA
intstatus &= ~(ULL(1) << int_num); intstatus &= ~(ULL(1) << int_num);
} }
void clear_all() void
clear_all()
{ {
DPRINTF(Interrupt, "Interrupts all cleared\n"); DPRINTF(Interrupt, "Interrupts all cleared\n");
@ -90,24 +98,28 @@ namespace AlphaISA
intstatus = 0; intstatus = 0;
} }
void serialize(std::ostream &os) void
serialize(std::ostream &os)
{ {
SERIALIZE_ARRAY(interrupts, NumInterruptLevels); SERIALIZE_ARRAY(interrupts, NumInterruptLevels);
SERIALIZE_SCALAR(intstatus); SERIALIZE_SCALAR(intstatus);
} }
void unserialize(Checkpoint *cp, const std::string &section) void
unserialize(Checkpoint *cp, const std::string &section)
{ {
UNSERIALIZE_ARRAY(interrupts, NumInterruptLevels); UNSERIALIZE_ARRAY(interrupts, NumInterruptLevels);
UNSERIALIZE_SCALAR(intstatus); UNSERIALIZE_SCALAR(intstatus);
} }
bool check_interrupts(ThreadContext * tc) const bool
check_interrupts(ThreadContext *tc) const
{ {
return (intstatus != 0) && !(tc->readPC() & 0x3); return (intstatus != 0) && !(tc->readPC() & 0x3);
} }
Fault getInterrupt(ThreadContext * tc) Fault
getInterrupt(ThreadContext *tc)
{ {
int ipl = 0; int ipl = 0;
int summary = 0; int summary = 0;
@ -151,7 +163,8 @@ namespace AlphaISA
} }
} }
void updateIntrInfo(ThreadContext *tc) void
updateIntrInfo(ThreadContext *tc)
{ {
assert(newInfoSet); assert(newInfoSet);
tc->setMiscRegNoEffect(IPR_ISR, newSummary); tc->setMiscRegNoEffect(IPR_ISR, newSummary);
@ -159,18 +172,15 @@ namespace AlphaISA
newInfoSet = false; newInfoSet = false;
} }
uint64_t get_vec(int int_num) uint64_t
get_vec(int int_num)
{ {
panic("Shouldn't be called for Alpha\n"); panic("Shouldn't be called for Alpha\n");
M5_DUMMY_RETURN M5_DUMMY_RETURN;
} }
};
private: } // namespace AlphaISA
bool newInfoSet;
int newIpl;
int newSummary;
};
}
#endif #endif // __ARCH_ALPHA_INTERRUPT_HH__