summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/ev5.cc4
-rw-r--r--arch/alpha/faults.cc24
-rw-r--r--arch/alpha/faults.hh10
3 files changed, 31 insertions, 7 deletions
diff --git a/arch/alpha/ev5.cc b/arch/alpha/ev5.cc
index ac0e7e67e..c6da628be 100644
--- a/arch/alpha/ev5.cc
+++ b/arch/alpha/ev5.cc
@@ -166,7 +166,7 @@ AlphaISA::zeroRegisters(CPU *cpu)
void
AlphaISA::intr_post(RegFile *regs, Fault fault, Addr pc)
{
- bool use_pc = (fault == NoFault);
+/* bool use_pc = (fault == NoFault);
if (fault->isA<ArithmeticFault>())
panic("arithmetic faults NYI...");
@@ -186,7 +186,7 @@ AlphaISA::intr_post(RegFile *regs, Fault fault, Addr pc)
(dynamic_cast<AlphaFault *>(fault.get()))->vect();
else
regs->npc = regs->miscRegs.readReg(IPR_PAL_BASE) + pc;
-
+*/
// that's it! (orders of magnitude less painful than x86)
}
diff --git a/arch/alpha/faults.cc b/arch/alpha/faults.cc
index bde7b3db1..7cdcc9bab 100644
--- a/arch/alpha/faults.cc
+++ b/arch/alpha/faults.cc
@@ -107,14 +107,11 @@ void AlphaFault::invoke(ExecContext * xc)
assert(!xc->misspeculating());
xc->kernelStats->fault(this);
- if (isA<ArithmeticFault>())
- panic("Arithmetic traps are unimplemented!");
-
// exception restart address
- if (!isA<InterruptFault>() || !xc->inPalMode())
+ if (setRestartAddress() || !xc->inPalMode())
xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc);
- if (isA<PalFault>() || isA<ArithmeticFault>()) {
+ if (skipFaultingInstruction()) {
// traps... skip faulting instruction.
xc->setMiscReg(AlphaISA::IPR_EXC_ADDR,
xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4);
@@ -127,6 +124,23 @@ void AlphaFault::invoke(ExecContext * xc)
xc->regs.npc = xc->regs.pc + sizeof(MachInst);
}
+void ArithmeticFault::invoke(ExecContext * xc)
+{
+ DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc);
+ xc->cpu->recordEvent(csprintf("Fault %s", name()));
+
+ assert(!xc->misspeculating());
+ xc->kernelStats->fault(this);
+
+ panic("Arithmetic traps are unimplemented!");
+}
+
+
+/*void ArithmeticFault::invoke(ExecContext * xc)
+{
+ panic("Arithmetic traps are unimplemented!");
+}*/
+
#endif
} // namespace AlphaISA
diff --git a/arch/alpha/faults.hh b/arch/alpha/faults.hh
index c0316288c..b9573905a 100644
--- a/arch/alpha/faults.hh
+++ b/arch/alpha/faults.hh
@@ -40,6 +40,9 @@ typedef const Addr FaultVect;
class AlphaFault : public virtual FaultBase
{
+ protected:
+ virtual bool skipFaultingInstruction() {return false;}
+ virtual bool setRestartAddress() {return true;}
public:
#if FULL_SYSTEM
void invoke(ExecContext * xc);
@@ -95,6 +98,8 @@ class ResetFault : public AlphaFault
class ArithmeticFault : public AlphaFault
{
+ protected:
+ bool skipFaultingInstruction() {return true;}
private:
static FaultName _name;
static FaultVect _vect;
@@ -103,10 +108,13 @@ class ArithmeticFault : public AlphaFault
FaultName name() {return _name;}
FaultVect vect() {return _vect;}
FaultStat & stat() {return _stat;}
+ void invoke(ExecContext * xc);
};
class InterruptFault : public AlphaFault
{
+ protected:
+ bool setRestartAddress() {return false;}
private:
static FaultName _name;
static FaultVect _vect;
@@ -227,6 +235,8 @@ class FloatEnableFault : public AlphaFault
class PalFault : public AlphaFault
{
+ protected:
+ bool skipFaultingInstruction() {return true;}
private:
static FaultName _name;
static FaultVect _vect;