arch-power: Fix reporting traps to GDB

Due to inverted logic in POWER fault handlers, unimplemented opcode and
trap faults did not report trap to GDB (if connected). This commit fixes
the problem.

While at it, I opted to use `if (! ...) { panic(...) }` rather than
`panic_if(...)`. I find it easier to understand in this case.

Change-Id: I6cd5dfd5f6546b8541d685e877afef21540d6824
This commit is contained in:
Jan Vrany
2023-08-08 14:36:23 +01:00
parent 3ff6fe0e90
commit fde58a4365

View File

@@ -42,24 +42,28 @@ namespace PowerISA
void
UnimplementedOpcodeFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
panic_if(tc->getSystemPtr()->trapToGdb(GDBSignal::ILL, tc->contextId()),
"Unimplemented opcode encountered at virtual address %#x\n",
tc->pcState().instAddr());
if (! tc->getSystemPtr()->trapToGdb(GDBSignal::ILL, tc->contextId()) ) {
panic("Unimplemented opcode encountered at virtual address %#x\n",
tc->pcState().instAddr());
}
}
void
AlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
panic_if(!tc->getSystemPtr()->trapToGdb(GDBSignal::BUS, tc->contextId()),
"Alignment fault when accessing virtual address %#x\n", vaddr);
if (! tc->getSystemPtr()->trapToGdb(GDBSignal::BUS, tc->contextId()) ) {
panic("Alignment fault when accessing virtual address %#x\n",
vaddr);
}
}
void
TrapFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
panic_if(tc->getSystemPtr()->trapToGdb(GDBSignal::TRAP, tc->contextId()),
"Trap encountered at virtual address %#x\n",
tc->pcState().instAddr());
if (! tc->getSystemPtr()->trapToGdb(GDBSignal::TRAP, tc->contextId()) ) {
panic("Trap encountered at virtual address %#x\n",
tc->pcState().instAddr());
}
}
} // namespace PowerISA