Power ISA: Add an alignment fault to Power ISA and check alignment in TLB.
This commit is contained in:
parent
64999b4343
commit
dd60902152
3 changed files with 48 additions and 2 deletions
|
@ -76,6 +76,22 @@ class MachineCheckFault : public PowerFault
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class AlignmentFault : public PowerFault
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AlignmentFault()
|
||||||
|
: PowerFault("Alignment")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
isAlignmentFault() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline Fault
|
static inline Fault
|
||||||
genMachineCheckFault()
|
genMachineCheckFault()
|
||||||
{
|
{
|
||||||
|
|
|
@ -281,9 +281,15 @@ TLB::regStats()
|
||||||
}
|
}
|
||||||
|
|
||||||
Fault
|
Fault
|
||||||
TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
|
TLB::translateInst(RequestPtr req, ThreadContext *tc)
|
||||||
{
|
{
|
||||||
#if !FULL_SYSTEM
|
// Instruction accesses must be word-aligned
|
||||||
|
if (req->getVaddr() & 0x3) {
|
||||||
|
DPRINTF(TLB, "Alignment Fault on %#x, size = %d\n", req->getVaddr(),
|
||||||
|
req->getSize());
|
||||||
|
return new AlignmentFault();
|
||||||
|
}
|
||||||
|
|
||||||
Process * p = tc->getProcessPtr();
|
Process * p = tc->getProcessPtr();
|
||||||
|
|
||||||
Fault fault = p->pTable->translate(req);
|
Fault fault = p->pTable->translate(req);
|
||||||
|
@ -291,6 +297,28 @@ TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
|
||||||
return fault;
|
return fault;
|
||||||
|
|
||||||
return NoFault;
|
return NoFault;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fault
|
||||||
|
TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
|
||||||
|
{
|
||||||
|
Process * p = tc->getProcessPtr();
|
||||||
|
|
||||||
|
Fault fault = p->pTable->translate(req);
|
||||||
|
if (fault != NoFault)
|
||||||
|
return fault;
|
||||||
|
|
||||||
|
return NoFault;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fault
|
||||||
|
TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
|
||||||
|
{
|
||||||
|
#if !FULL_SYSTEM
|
||||||
|
if (mode == Execute)
|
||||||
|
return translateInst(req, tc);
|
||||||
|
else
|
||||||
|
return translateData(req, tc, mode == Write);
|
||||||
#else
|
#else
|
||||||
fatal("translate atomic not yet implemented\n");
|
fatal("translate atomic not yet implemented\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,6 +156,8 @@ class TLB : public BaseTLB
|
||||||
// static helper functions... really
|
// static helper functions... really
|
||||||
static bool validVirtualAddress(Addr vaddr);
|
static bool validVirtualAddress(Addr vaddr);
|
||||||
static Fault checkCacheability(RequestPtr &req);
|
static Fault checkCacheability(RequestPtr &req);
|
||||||
|
Fault translateInst(RequestPtr req, ThreadContext *tc);
|
||||||
|
Fault translateData(RequestPtr req, ThreadContext *tc, bool write);
|
||||||
Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode);
|
Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode);
|
||||||
void translateTiming(RequestPtr req, ThreadContext *tc,
|
void translateTiming(RequestPtr req, ThreadContext *tc,
|
||||||
Translation *translation, Mode mode);
|
Translation *translation, Mode mode);
|
||||||
|
|
Loading…
Reference in a new issue