sim: Style fixes in the base Fault classes.
Change-Id: Iff8588aba929b3909ca1b5ec0e494acb8f838543 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33280 Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -37,43 +37,47 @@
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
void FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst)
|
||||
void
|
||||
FaultBase::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
if (FullSystem) {
|
||||
DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
|
||||
} else {
|
||||
panic("fault (%s) detected @ PC %s", name(), tc->pcState());
|
||||
}
|
||||
panic_if(!FullSystem, "fault (%s) detected @ PC %s",
|
||||
name(), tc->pcState());
|
||||
DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
|
||||
}
|
||||
|
||||
void UnimpFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
|
||||
void
|
||||
UnimpFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
panic("Unimpfault: %s\n", panicStr.c_str());
|
||||
panic("Unimpfault: %s", panicStr.c_str());
|
||||
}
|
||||
|
||||
void ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
void
|
||||
ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
tc->pcState(tc->pcState());
|
||||
}
|
||||
|
||||
void SyscallRetryFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
void
|
||||
SyscallRetryFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
tc->pcState(tc->pcState());
|
||||
}
|
||||
|
||||
void GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
void
|
||||
GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
bool handled = false;
|
||||
if (!FullSystem) {
|
||||
Process *p = tc->getProcessPtr();
|
||||
handled = p->fixupFault(vaddr);
|
||||
}
|
||||
if (!handled)
|
||||
panic("Page table fault when accessing virtual address %#x\n", vaddr);
|
||||
panic_if(!handled, "Page table fault when accessing virtual address %#x",
|
||||
vaddr);
|
||||
|
||||
}
|
||||
|
||||
void GenericAlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
void
|
||||
GenericAlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
panic("Alignment fault when accessing virtual address %#x\n", vaddr);
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
|
||||
class ThreadContext;
|
||||
|
||||
typedef const char * FaultName;
|
||||
typedef const char *FaultName;
|
||||
typedef Stats::Scalar FaultStat;
|
||||
|
||||
class FaultBase
|
||||
{
|
||||
public:
|
||||
virtual FaultName name() const = 0;
|
||||
virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
|
||||
virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst=
|
||||
StaticInst::nullStaticInstPtr);
|
||||
|
||||
virtual ~FaultBase() {};
|
||||
@@ -53,22 +53,19 @@ class UnimpFault : public FaultBase
|
||||
private:
|
||||
std::string panicStr;
|
||||
public:
|
||||
UnimpFault(std::string _str)
|
||||
: panicStr(_str)
|
||||
{ }
|
||||
UnimpFault(std::string _str) : panicStr(_str) {}
|
||||
|
||||
FaultName name() const { return "Unimplemented simulator feature"; }
|
||||
void invoke(ThreadContext * tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr);
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr) override;
|
||||
};
|
||||
|
||||
class ReExec : public FaultBase
|
||||
{
|
||||
public:
|
||||
virtual FaultName name() const { return "Re-execution fault"; }
|
||||
ReExec() {}
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr);
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst=
|
||||
StaticInst::nullStaticInstPtr) override;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -83,8 +80,8 @@ class SyscallRetryFault : public FaultBase
|
||||
public:
|
||||
virtual FaultName name() const { return "System call retry fault"; }
|
||||
SyscallRetryFault() {}
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr);
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst=
|
||||
StaticInst::nullStaticInstPtr) override;
|
||||
};
|
||||
|
||||
class GenericPageTableFault : public FaultBase
|
||||
@@ -94,8 +91,8 @@ class GenericPageTableFault : public FaultBase
|
||||
public:
|
||||
FaultName name() const { return "Generic page table fault"; }
|
||||
GenericPageTableFault(Addr va) : vaddr(va) {}
|
||||
void invoke(ThreadContext * tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr);
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst=
|
||||
StaticInst::nullStaticInstPtr) override;
|
||||
Addr getFaultVAddr() const { return vaddr; }
|
||||
};
|
||||
|
||||
@@ -106,8 +103,8 @@ class GenericAlignmentFault : public FaultBase
|
||||
public:
|
||||
FaultName name() const { return "Generic alignment fault"; }
|
||||
GenericAlignmentFault(Addr va) : vaddr(va) {}
|
||||
void invoke(ThreadContext * tc, const StaticInstPtr &inst =
|
||||
StaticInst::nullStaticInstPtr);
|
||||
void invoke(ThreadContext *tc, const StaticInstPtr &inst=
|
||||
StaticInst::nullStaticInstPtr) override;
|
||||
Addr getFaultVAddr() const { return vaddr; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user