template <> FaultVals MipsFault<AddressErrorFault>::vals =
{ "Address Error", 0x0180 };
-template <> FaultVals MipsFault<StoreAddressErrorFault>::vals =
- { "Store Address Error", 0x0180 };
-
template <> FaultVals MipsFault<SystemCallFault>::vals =
{ "Syscall", 0x0180 };
setHandlerPC(HandlerBase, tc);
}
-void
-StoreAddressErrorFault::invoke(ThreadContext *tc, StaticInstPtr inst)
-{
- DPRINTF(MipsPRA, "%s encountered.\n", name());
- setExceptionState(tc, 0x5);
- tc->setMiscRegNoEffect(MISCREG_BADVADDR, badVAddr);
-
- // Set new PC
- Addr HandlerBase;
- // Offset 0x180 - General Exception Vector
- HandlerBase = vect() + tc->readMiscReg(MISCREG_EBASE);
- setHandlerPC(HandlerBase, tc);
-}
-
void
TrapFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
AddressErrorFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
DPRINTF(MipsPRA, "%s encountered.\n", name());
- setExceptionState(tc, 0x4);
- tc->setMiscRegNoEffect(MISCREG_BADVADDR, badVAddr);
+ setExceptionState(tc, store ? 0x5 : 0x4);
+ tc->setMiscRegNoEffect(MISCREG_BADVADDR, vaddr);
// Set new PC
Addr HandlerBase;
class AddressErrorFault : public MipsFault<AddressErrorFault>
{
+ protected:
+ Addr vaddr;
+ bool store;
public:
- AddressErrorFault(Addr vaddr) { badVAddr = vaddr; }
+ AddressErrorFault(Addr _vaddr, bool _store) : vaddr(_vaddr), store(_store)
+ {}
#if FULL_SYSTEM
void invoke(ThreadContext * tc,
StaticInstPtr inst = StaticInst::nullStaticInstPtr);
};
-class StoreAddressErrorFault : public MipsFault<StoreAddressErrorFault>
-{
- public:
- StoreAddressErrorFault(Addr vaddr) { badVAddr = vaddr; }
-#if FULL_SYSTEM
- void invoke(ThreadContext * tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
-#endif
-};
-
static inline Fault genMachineCheckFault()
{
return new MachineCheckFault;
req->setPaddr(KSeg02Phys(vaddr));
if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel ||
misaligned) {
- return new AddressErrorFault(vaddr);
+ return new AddressErrorFault(vaddr, false);
}
} else if(IsKSeg1(vaddr)) {
// Address will not be translated through TLB, set response, and go!
uint8_t Asid = req->getAsid();
if (misaligned) {
// Unaligned address!
- return new AddressErrorFault(vaddr);
+ return new AddressErrorFault(vaddr, false);
}
PTE *pte = lookup(VPN,Asid);
if (pte != NULL) {
if (req->getVaddr() & (req->getSize() - 1)) {
DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(),
req->getSize());
- if (write)
- return new StoreAddressErrorFault(req->getVaddr());
- else
- return new AddressErrorFault(req->getVaddr());
+ return new AddressErrorFault(req->getVaddr(), write);
}
req->setPaddr(KSeg02Phys(vaddr));
if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel ||
misaligned) {
- return new StoreAddressErrorFault(vaddr);
+ return new AddressErrorFault(vaddr, true);
}
} else if(IsKSeg1(vaddr)) {
// Address will not be translated through TLB, set response, and go!
uint8_t Asid = req->getAsid();
PTE *pte = lookup(VPN, Asid);
if (misaligned) {
- return new StoreAddressErrorFault(vaddr);
+ return new AddressErrorFault(vaddr, true);
}
if (pte != NULL) {
// Ok, found something