#if FULL_SYSTEM
void
-AlphaFault::invoke(ThreadContext *tc)
+AlphaFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
FaultBase::invoke(tc);
countStat()++;
}
void
-ArithmeticFault::invoke(ThreadContext *tc)
+ArithmeticFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
FaultBase::invoke(tc);
panic("Arithmetic traps are unimplemented!");
}
void
-DtbFault::invoke(ThreadContext *tc)
+DtbFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
// Set fault address and flags. Even though we're modeling an
// EV5, we use the EV6 technique of not latching fault registers
tc->setMiscRegNoEffect(IPR_VA, vaddr);
// set MM_STAT register flags
+ MachInst machInst = inst->machInst;
tc->setMiscRegNoEffect(IPR_MM_STAT,
- (((Opcode(tc->getInst()) & 0x3f) << 11) |
- ((Ra(tc->getInst()) & 0x1f) << 6) |
+ (((Opcode(machInst) & 0x3f) << 11) |
+ ((Ra(machInst) & 0x1f) << 6) |
(flags & 0x3f)));
// set VA_FORM register with faulting formatted address
}
void
-ItbFault::invoke(ThreadContext *tc)
+ItbFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
if (!tc->misspeculating()) {
tc->setMiscRegNoEffect(IPR_ITB_TAG, pc);
#else
void
-ItbPageFault::invoke(ThreadContext *tc)
+ItbPageFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
Process *p = tc->getProcessPtr();
TlbEntry entry;
}
void
-NDtbMissFault::invoke(ThreadContext *tc)
+NDtbMissFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
Process *p = tc->getProcessPtr();
TlbEntry entry;
#include "arch/alpha/pagetable.hh"
#include "config/full_system.hh"
+#include "mem/request.hh"
#include "sim/faults.hh"
// The design of the "name" and "vect" functions is in sim/faults.hh
virtual bool setRestartAddress() {return true;}
public:
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
virtual FaultVect vect() = 0;
virtual FaultStat & countStat() = 0;
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() = 0;
FaultStat & countStat() = 0;
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if !FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() = 0;
FaultStat & countStat() = 0;
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if !FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
* Authors: Gabe Black
*/
+#include <cassert>
+
#include "arch/alpha/isa.hh"
#include "base/misc.hh"
#include "cpu/thread_context.hh"
#include "base/misc.hh"
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
+#include "sim/byteswap.hh"
#include "sim/process_impl.hh"
#include "sim/system.hh"
#include "base/statistics.hh"
#include "mem/request.hh"
#include "params/AlphaTLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
class ThreadContext;
#include "arch/alpha/tru64/process.hh"
#include "cpu/thread_context.hh"
#include "kern/tru64/tru64.hh"
+#include "sim/byteswap.hh"
#include "sim/process.hh"
#include "sim/syscall_emul.hh"
#if FULL_SYSTEM
void
-ArmFault::invoke(ThreadContext *tc)
+ArmFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
// ARM ARM B1.6.3
FaultBase::invoke(tc);
}
void
-Reset::invoke(ThreadContext *tc)
+Reset::invoke(ThreadContext *tc, StaticInstPtr inst)
{
tc->getCpuPtr()->clearInterrupts();
tc->clearArchRegs();
#else
void
-UndefinedInstruction::invoke(ThreadContext *tc)
+UndefinedInstruction::invoke(ThreadContext *tc, StaticInstPtr inst)
{
// If the mnemonic isn't defined this has to be an unknown instruction.
assert(unknown || mnemonic != NULL);
}
void
-SupervisorCall::invoke(ThreadContext *tc)
+SupervisorCall::invoke(ThreadContext *tc, StaticInstPtr inst)
{
// As of now, there isn't a 32 bit thumb version of this instruction.
assert(!machInst.bigThumb);
template<class T>
void
-AbortFault<T>::invoke(ThreadContext *tc)
+AbortFault<T>::invoke(ThreadContext *tc, StaticInstPtr inst)
{
ArmFaultVals<T>::invoke(tc);
FSR fsr = 0;
}
void
-FlushPipe::invoke(ThreadContext *tc) {
+FlushPipe::invoke(ThreadContext *tc, StaticInstPtr inst) {
DPRINTF(Faults, "Invoking FlushPipe Fault\n");
// Set the PC to the next instruction of the faulting instruction.
tc->setNextMicroPC(1);
}
-template void AbortFault<PrefetchAbort>::invoke(ThreadContext *tc);
-template void AbortFault<DataAbort>::invoke(ThreadContext *tc);
+template void AbortFault<PrefetchAbort>::invoke(ThreadContext *tc,
+ StaticInstPtr inst);
+template void AbortFault<DataAbort>::invoke(ThreadContext *tc,
+ StaticInstPtr inst);
// return via SUBS pc, lr, xxx; rfe, movs, ldm
};
#if FULL_SYSTEM
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
virtual FaultStat& countStat() = 0;
virtual FaultOffset offset() = 0;
#if FULL_SYSTEM
{
public:
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
#else
{};
{
}
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
SupervisorCall(ExtMachInst _machInst) : machInst(_machInst)
{}
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
domain(_domain), status(_status)
{}
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class PrefetchAbort : public AbortFault<PrefetchAbort>
{
public:
FlushPipe() {}
- void invoke(ThreadContext *tc);
+ void invoke(ThreadContext *tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
static inline Fault genMachineCheckFault()
*/
#include "arch/arm/isa.hh"
+#include "sim/faults.hh"
namespace ArmISA
{
#include "arch/arm/insts/vfp.hh"
#include "arch/arm/isa_traits.hh"
#include "mem/packet.hh"
+#include "sim/faults.hh"
}};
output decoder {{
#include "arch/arm/nativetrace.hh"
#include "cpu/thread_context.hh"
#include "params/ArmNativeTrace.hh"
+#include "sim/byteswap.hh"
namespace Trace {
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
#include "mem/translating_port.hh"
+#include "sim/byteswap.hh"
#include "sim/process_impl.hh"
#include "sim/system.hh"
#include "mem/request.hh"
#include "mem/request.hh"
#include "params/ArmTableWalker.hh"
-#include "sim/faults.hh"
#include "sim/eventq.hh"
+#include "sim/fault.hh"
class DmaPort;
class ThreadContext;
#include "base/statistics.hh"
#include "mem/request.hh"
#include "params/ArmTLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
class ThreadContext;
#include "arch/arm/miscregs.hh"
#include "arch/arm/types.hh"
#include "base/hashmap.hh"
+#include "base/misc.hh"
#include "base/trace.hh"
#include "base/types.hh"
#include "cpu/thread_context.hh"
}
void
-ArithmeticFault::invoke(ThreadContext *tc)
+ArithmeticFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0xC);
}
void
-StoreAddressErrorFault::invoke(ThreadContext *tc)
+StoreAddressErrorFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0x5);
}
void
-TrapFault::invoke(ThreadContext *tc)
+TrapFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0xD);
}
void
-BreakpointFault::invoke(ThreadContext *tc)
+BreakpointFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
setExceptionState(tc, 0x9);
}
void
-DtbInvalidFault::invoke(ThreadContext *tc)
+DtbInvalidFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
}
void
-AddressErrorFault::invoke(ThreadContext *tc)
+AddressErrorFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0x4);
}
void
-ItbInvalidFault::invoke(ThreadContext *tc)
+ItbInvalidFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0x2);
}
void
-ItbRefillFault::invoke(ThreadContext *tc)
+ItbRefillFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered (%x).\n", name(), MISCREG_BADVADDR);
Addr HandlerBase;
}
void
-DtbRefillFault::invoke(ThreadContext *tc)
+DtbRefillFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
// Set new PC
DPRINTF(MipsPRA, "%s encountered.\n", name());
}
void
-TLBModifiedFault::invoke(ThreadContext *tc)
+TLBModifiedFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
tc->setMiscRegNoEffect(MISCREG_BADVADDR, badVAddr);
}
void
-SystemCallFault::invoke(ThreadContext *tc)
+SystemCallFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
setExceptionState(tc, 0x8);
}
void
-InterruptFault::invoke(ThreadContext *tc)
+InterruptFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
#if FULL_SYSTEM
DPRINTF(MipsPRA, "%s encountered.\n", name());
#endif // FULL_SYSTEM
void
-ResetFault::invoke(ThreadContext *tc)
+ResetFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
#if FULL_SYSTEM
DPRINTF(MipsPRA, "%s encountered.\n", name());
}
void
-ReservedInstructionFault::invoke(ThreadContext *tc)
+ReservedInstructionFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
#if FULL_SYSTEM
DPRINTF(MipsPRA, "%s encountered.\n", name());
}
void
-ThreadFault::invoke(ThreadContext *tc)
+ThreadFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
panic("%s encountered.\n", name());
}
void
-DspStateDisabledFault::invoke(ThreadContext *tc)
+DspStateDisabledFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
panic("%s encountered.\n", name());
}
void
-CoprocessorUnusableFault::invoke(ThreadContext *tc)
+CoprocessorUnusableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
#if FULL_SYSTEM
DPRINTF(MipsPRA, "%s encountered.\n", name());
Addr entryHiVPN2X;
Addr contextBadVPN2;
#if FULL_SYSTEM
- void invoke(ThreadContext * tc) {};
+ void invoke(ThreadContext * tc,
+ StaticInst::StaticInstPtr inst = StaticInst::nullStaticInstPtr)
+ {}
void setExceptionState(ThreadContext *, uint8_t);
void setHandlerPC(Addr, ThreadContext *);
#endif
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class TLBInvalidIFetchFault : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class NDtbMissFault : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class SoftResetFault : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class DebugSingleStep : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class DebugInterrupt : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class CoprocessorUnusableFault : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
CoprocessorUnusableFault(int _procid){ coProcID = _procid;}
};
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class ThreadFault : public MipsFault
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class ArithmeticFault : public MipsFault
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInst::StaticInstPtr inst = nullStaticInstPtr);
#endif
};
FaultName name() const {return _name;}
FaultVect vect() {return _vect;}
FaultStat & countStat() {return _count;}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
} // MipsISA namespace
#include "arch/mips/registers.hh"
#include "arch/mips/types.hh"
#include "sim/eventq.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
class BaseCPU;
class Checkpoint;
#include "base/statistics.hh"
#include "mem/request.hh"
#include "params/MipsTLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
#include "sim/sim_object.hh"
* Authors: Korey Sewell
*/
+#include <cmath>
+
#include "arch/mips/isa_traits.hh"
#include "arch/mips/utility.hh"
#include "config/full_system.hh"
#include "base/statistics.hh"
#include "mem/request.hh"
#include "params/PowerTLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
class ThreadContext;
#if FULL_SYSTEM
-void SparcFaultBase::invoke(ThreadContext * tc)
+void SparcFaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
{
//panic("Invoking a second fault!\n");
FaultBase::invoke(tc);
tc->setNextNPC(NPC + sizeof(MachInst));
}
-void PowerOnReset::invoke(ThreadContext * tc)
+void PowerOnReset::invoke(ThreadContext * tc, StaticInstPtr inst)
{
//For SPARC, when a system is first started, there is a power
//on reset Trap which sets the processor into the following state.
#else // !FULL_SYSTEM
-void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc)
+void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
+ StaticInstPtr inst)
{
Process *p = tc->getProcessPtr();
TlbEntry entry;
}
}
-void FastDataAccessMMUMiss::invoke(ThreadContext *tc)
+void FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
{
Process *p = tc->getProcessPtr();
TlbEntry entry;
}
}
-void SpillNNormal::invoke(ThreadContext *tc)
+void SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
{
doNormalFault(tc, trapType(), false);
tc->setNextNPC(spillStart + 2*sizeof(MachInst));
}
-void FillNNormal::invoke(ThreadContext *tc)
+void FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
{
doNormalFault(tc, trapType(), false);
tc->setNextNPC(fillStart + 2*sizeof(MachInst));
}
-void TrapInstruction::invoke(ThreadContext *tc)
+void TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst)
{
//In SE, this mechanism is how the process requests a service from the
//operating system. We'll get the process object from the thread context
#define __SPARC_FAULTS_HH__
#include "config/full_system.hh"
+#include "cpu/static_inst.hh"
#include "sim/faults.hh"
// The design of the "name" and "vect" functions is in sim/faults.hh
FaultStat count;
};
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
virtual TrapType trapType() = 0;
virtual FaultPriority priority() = 0;
class PowerOnReset : public SparcFault<PowerOnReset>
{
- void invoke(ThreadContext * tc);
+#if FULL_SYSTEM
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+#endif
};
class WatchDogReset : public SparcFault<WatchDogReset> {};
public:
FastInstructionAccessMMUMiss(Addr addr) : vaddr(addr)
{}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
public:
FastDataAccessMMUMiss(Addr addr) : vaddr(addr)
{}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
SpillNNormal(uint32_t n) : EnumeratedFault<SpillNNormal>(n) {;}
//These need to be handled specially to enable spill traps in SE
#if !FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n) {;}
//These need to be handled specially to enable fill traps in SE
#if !FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n) {;}
//In SE, trap instructions are requesting services from the OS.
#if !FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
#include "arch/sparc/nativetrace.hh"
#include "cpu/thread_context.hh"
#include "params/SparcNativeTrace.hh"
+#include "sim/byteswap.hh"
namespace Trace {
#include "mem/page_table.hh"
#include "mem/physical.hh"
#include "mem/port.hh"
+#include "sim/byteswap.hh"
#include "sim/process.hh"
#include "sim/system.hh"
#include <cstring>
#include "arch/sparc/asi.hh"
+#include "arch/sparc/faults.hh"
#include "arch/sparc/registers.hh"
#include "arch/sparc/tlb.hh"
#include "base/bitfield.hh"
#include "config/full_system.hh"
#include "mem/request.hh"
#include "params/SparcTLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
class ThreadContext;
* Ali Saidi
*/
+#include "arch/sparc/faults.hh"
#include "arch/sparc/utility.hh"
#if FULL_SYSTEM
#include "arch/sparc/vtophys.hh"
dest->setNextPC(src->readNextPC());
dest->setNextNPC(src->readNextNPC());
}
+
+void
+initCPU(ThreadContext *tc, int cpuId)
+{
+ static Fault por = new PowerOnReset();
+ if (cpuId == 0)
+ por->invoke(tc);
+}
+
} //namespace SPARC_ISA
#ifndef __ARCH_SPARC_UTILITY_HH__
#define __ARCH_SPARC_UTILITY_HH__
-#include "arch/sparc/faults.hh"
#include "arch/sparc/isa_traits.hh"
#include "arch/sparc/registers.hh"
#include "arch/sparc/tlb.hh"
#include "base/misc.hh"
#include "base/bitfield.hh"
#include "cpu/thread_context.hh"
+#include "sim/fault.hh"
namespace SparcISA
{
template <class TC>
void zeroRegisters(TC *tc);
- inline void
- initCPU(ThreadContext *tc, int cpuId)
- {
- static Fault por = new PowerOnReset();
- if (cpuId == 0)
- por->invoke(tc);
-
- }
+ void initCPU(ThreadContext *tc, int cpuId);
inline void
startupCPU(ThreadContext *tc, int cpuId)
namespace X86ISA
{
#if FULL_SYSTEM
- void X86FaultBase::invoke(ThreadContext * tc)
+ void X86FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
{
Addr pc = tc->readPC();
DPRINTF(Faults, "RIP %#x: vector %d: %s\n", pc, vector, describe());
return ss.str();
}
- void X86Trap::invoke(ThreadContext * tc)
+ void X86Trap::invoke(ThreadContext * tc, StaticInstPtr inst)
{
X86FaultBase::invoke(tc);
// This is the same as a fault, but it happens -after- the instruction.
tc->setNextNPC(tc->readNextNPC() + sizeof(MachInst));
}
- void X86Abort::invoke(ThreadContext * tc)
+ void X86Abort::invoke(ThreadContext * tc, StaticInstPtr inst)
{
panic("Abort exception!");
}
- void PageFault::invoke(ThreadContext * tc)
+ void PageFault::invoke(ThreadContext * tc, StaticInstPtr inst)
{
HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG);
X86FaultBase::invoke(tc);
}
void
- InitInterrupt::invoke(ThreadContext *tc)
+ InitInterrupt::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(Faults, "Init interrupt.\n");
// The otherwise unmodified integer registers should be set to 0.
}
void
- StartupInterrupt::invoke(ThreadContext *tc)
+ StartupInterrupt::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(Faults, "Startup interrupt with vector %#x.\n", vector);
HandyM5Reg m5Reg = tc->readMiscReg(MISCREG_M5_REG);
#else
void
- PageFault::invoke(ThreadContext * tc)
+ PageFault::invoke(ThreadContext * tc, StaticInstPtr inst)
{
PageFaultErrorCode code = errorCode;
const char *modeStr = "";
}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
virtual std::string describe() const;
#endif
{}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
{}
#if FULL_SYSTEM
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#endif
};
return "unimplemented_micro";
}
- void invoke(ThreadContext * tc)
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr)
{
panic("Unimplemented instruction!");
}
errorCode = code;
}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
#if FULL_SYSTEM
virtual std::string describe() const;
X86Interrupt("INIT Interrupt", "#INIT", _vector)
{}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class StartupInterrupt : public X86Interrupt
X86Interrupt("Startup Interrupt", "#SIPI", _vector)
{}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class SoftwareInterrupt : public X86Interrupt
#include "arch/x86/insts/microop.hh"
#include "mem/packet.hh"
#include "mem/request.hh"
+#include "sim/faults.hh"
namespace X86ISA
{
#include "arch/x86/regs/int.hh"
#include "cpu/thread_context.hh"
#include "params/X86NativeTrace.hh"
+#include "sim/byteswap.hh"
namespace Trace {
#include "mem/mem_object.hh"
#include "mem/request.hh"
#include "params/X86TLB.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/tlb.hh"
#include "sim/sim_object.hh"
typedef int16_t ThreadID;
const ThreadID InvalidThreadID = (ThreadID)-1;
+class FaultBase;
+template <class T> class RefCountingPtr;
+typedef RefCountingPtr<FaultBase> Fault;
+
#endif // __BASE_TYPES_HH__
#include "cpu/static_inst.hh"
#include "cpu/translation.hh"
#include "mem/packet.hh"
+#include "sim/byteswap.hh"
#include "sim/system.hh"
#include "sim/tlb.hh"
if (fault != NoFault) {
#if FULL_SYSTEM
- fault->invoke(tc);
+ fault->invoke(tc, curStaticInst);
willChangePC = true;
newPC = thread->readPC();
DPRINTF(Checker, "Fault, PC is now %#x\n", newPC);
break;
case Trap:
- cpu->trapCPU(fault, tid);
+ cpu->trapCPU(fault, tid, inst);
break;
default:
#endif
void
-InOrderCPU::trap(Fault fault, ThreadID tid, int delay)
+InOrderCPU::trap(Fault fault, ThreadID tid, DynInstPtr inst, int delay)
{
//@ Squash Pipeline during TRAP
- scheduleCpuEvent(Trap, fault, tid, dummyInst[tid], delay);
+ scheduleCpuEvent(Trap, fault, tid, inst, delay);
}
void
-InOrderCPU::trapCPU(Fault fault, ThreadID tid)
+InOrderCPU::trapCPU(Fault fault, ThreadID tid, DynInstPtr inst)
{
- fault->invoke(tcBase(tid));
+ fault->invoke(tcBase(tid), inst->staticInst);
}
void
/** trap() - sets up a trap event on the cpuTraps to handle given fault.
* trapCPU() - Traps to handle given fault
*/
- void trap(Fault fault, ThreadID tid, int delay = 0);
- void trapCPU(Fault fault, ThreadID tid);
+ void trap(Fault fault, ThreadID tid, DynInstPtr inst, int delay = 0);
+ void trapCPU(Fault fault, ThreadID tid, DynInstPtr inst);
/** Add Thread to Active Threads List. */
void activateContext(ThreadID tid, int delay = 0);
void
InOrderDynInst::trap(Fault fault)
{
- this->cpu->trap(fault, this->threadNumber);
+ this->cpu->trap(fault, this->threadNumber, this);
}
scheduleEvent(slot_idx, 1);
- cpu->trap(cache_req->fault, tid);
+ cpu->trap(cache_req->fault, tid, inst);
} else {
DPRINTF(InOrderTLB, "[tid:%i]: [sn:%i] virt. addr %08p translated "
"to phys. addr:%08p.\n", tid, inst->seqNum,
} else {
warn("inst [sn:%i] had a %s fault",
seq_num, fault->name());
- cpu->trap(fault, tid);
+ cpu->trap(fault, tid, inst);
}
}
}
inst->readTid(), inst->readIntResult(0));
} else {
warn("inst [sn:%i] had a %s fault", seq_num, fault->name());
- cpu->trap(fault, tid);
+ cpu->trap(fault, tid, inst);
}
}
scheduleEvent(slot_idx, 1);
// Let CPU handle the fault
- cpu->trap(tlb_req->fault, tid);
+ cpu->trap(tlb_req->fault, tid, inst);
}
} else {
DPRINTF(InOrderTLB, "[tid:%i]: [sn:%i] virt. addr %08p translated "
// needed to update the state as soon as possible. This
// prevents external agents from changing any specific state
// that the trap need.
- cpu->trap(inst_fault, tid);
+ cpu->trap(inst_fault, tid, head_inst);
// Exit state update mode to avoid accidental updating.
thread[tid]->inSyscall = false;
this->interrupts->updateIntrInfo(this->threadContexts[0]);
DPRINTF(O3CPU, "Interrupt %s being handled\n", interrupt->name());
- this->trap(interrupt, 0);
+ DynInstPtr dummyInst;
+ this->trap(interrupt, 0, dummyInst);
}
template <class Impl>
template <class Impl>
void
-FullO3CPU<Impl>::trap(Fault fault, ThreadID tid)
+FullO3CPU<Impl>::trap(Fault fault, ThreadID tid, DynInstPtr inst)
{
// Pass the thread's TC into the invoke method.
- fault->invoke(this->threadContexts[tid]);
+ fault->invoke(this->threadContexts[tid], inst->staticInst);
}
#if !FULL_SYSTEM
{ return globalSeqNum++; }
/** Traps to handle given fault. */
- void trap(Fault fault, ThreadID tid);
+ void trap(Fault fault, ThreadID tid, DynInstPtr inst);
#if FULL_SYSTEM
/** HW return from error interrupt. */
void
BaseO3DynInst<Impl>::trap(Fault fault)
{
- this->cpu->trap(fault, this->threadNumber);
+ this->cpu->trap(fault, this->threadNumber, this);
}
template <class Impl>
#include "mem/packet.hh"
#include "mem/packet_access.hh"
#include "params/AtomicSimpleCPU.hh"
+#include "sim/faults.hh"
#include "sim/system.hh"
using namespace std;
fetchOffset = 0;
if (fault != NoFault) {
curMacroStaticInst = StaticInst::nullStaticInstPtr;
- fault->invoke(tc);
+ fault->invoke(tc, curStaticInst);
predecoder.reset();
} else {
//If we're at the last micro op for this instruction
#include "mem/packet.hh"
#include "mem/packet_access.hh"
#include "params/TimingSimpleCPU.hh"
+#include "sim/faults.hh"
#include "sim/system.hh"
using namespace std;
virtual bool misspeculating();
- Fault instRead(RequestPtr &req)
- {
- panic("instRead not implemented");
- // return funcPhysMem->read(req, inst);
- return NoFault;
- }
-
void copyArchRegs(ThreadContext *tc);
void clearArchRegs()
#include "base/refcnt.hh"
#include "base/types.hh"
#include "cpu/op_class.hh"
-#include "sim/faults.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
// forward declarations
struct AlphaSimpleImpl;
#include "base/types.hh"
#include "config/full_system.hh"
#include "config/the_isa.hh"
-#include "mem/request.hh"
-#include "sim/byteswap.hh"
-#include "sim/faults.hh"
#include "sim/serialize.hh"
// @todo: Figure out a more architecture independent way to obtain the ITB and
#ifndef __CPU_TRANSLATION_HH__
#define __CPU_TRANSLATION_HH__
+#include "sim/faults.hh"
#include "sim/tlb.hh"
/**
#include <string>
#include "cpu/static_inst.hh"
+#include "sim/stats.hh"
#include "sim/serialize.hh"
class BaseCPU;
#include "config/full_system.hh"
#include "kern/operatingsystem.hh"
+#include "sim/byteswap.hh"
#if FULL_SYSTEM
#include <map>
#include <fstream>
-#include "arch/faults.hh"
#include "base/bitfield.hh"
#include "base/intmath.hh"
#include "base/trace.hh"
#include "config/the_isa.hh"
#include "mem/page_table.hh"
+#include "sim/faults.hh"
#include "sim/process.hh"
#include "sim/sim_object.hh"
#include "sim/system.hh"
#include "base/types.hh"
#include "config/the_isa.hh"
#include "mem/request.hh"
-#include "sim/faults.hh"
#include "sim/serialize.hh"
class Process;
--- /dev/null
+/*
+ * Copyright (c) 2010 Advanced Micro Devices
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __SIM_FAULT_HH__
+#define __SIM_FAULT_HH__
+
+class FaultBase;
+template <class T> class RefCountingPtr;
+typedef RefCountingPtr<FaultBase> Fault;
+
+#endif // __SIM_FAULT_HH__
#include "mem/page_table.hh"
#if !FULL_SYSTEM
-void FaultBase::invoke(ThreadContext * tc)
+void FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
{
panic("fault (%s) detected @ PC %p", name(), tc->readPC());
}
#else
-void FaultBase::invoke(ThreadContext * tc)
+void FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
{
DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), tc->readPC());
}
#endif
-void UnimpFault::invoke(ThreadContext * tc)
+void UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst)
{
panic("Unimpfault: %s\n", panicStr.c_str());
}
#if !FULL_SYSTEM
-void GenericPageTableFault::invoke(ThreadContext *tc)
+void GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
Process *p = tc->getProcessPtr();
}
-void GenericAlignmentFault::invoke(ThreadContext *tc)
+void GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
panic("Alignment fault when accessing virtual address %#x\n", vaddr);
}
#define __FAULTS_HH__
#include "base/refcnt.hh"
+#include "base/types.hh"
+#include "sim/fault.hh"
#include "sim/stats.hh"
#include "config/full_system.hh"
+#include "cpu/static_inst.hh"
class ThreadContext;
-class FaultBase;
-typedef RefCountingPtr<FaultBase> Fault;
typedef const char * FaultName;
typedef Stats::Scalar FaultStat;
{
public:
virtual FaultName name() const = 0;
- virtual void invoke(ThreadContext * tc);
+ virtual void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
virtual bool isMachineCheckFault() const {return false;}
virtual bool isAlignmentFault() const {return false;}
};
{ }
FaultName name() const {return "Unimplemented simulator feature";}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
#if !FULL_SYSTEM
public:
FaultName name() const {return "Generic page table fault";}
GenericPageTableFault(Addr va) : vaddr(va) {}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
class GenericAlignmentFault : public FaultBase
public:
FaultName name() const {return "Generic alignment fault";}
GenericAlignmentFault(Addr va) : vaddr(va) {}
- void invoke(ThreadContext * tc);
+ void invoke(ThreadContext * tc,
+ StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
#endif
#include <vector>
#include "mem/translating_port.hh"
+#include "sim/byteswap.hh"
//This needs to be templated for cases where 32 bit pointers are needed.
#include "cpu/thread_context.hh"
#include "mem/translating_port.hh"
#include "mem/page_table.hh"
+#include "sim/byteswap.hh"
#include "sim/system.hh"
#include "sim/process.hh"
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/faults.hh"
#include "sim/tlb.hh"
Fault
#include "base/misc.hh"
#include "mem/request.hh"
-#include "sim/faults.hh"
+#include "sim/fault.hh"
#include "sim/sim_object.hh"
class ThreadContext;