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