Skip to content

Commit

Permalink
assert:read content of undefinedinsn address
Browse files Browse the repository at this point in the history
read content of undefinedinsn address to catch
possibly ram bit flip

Signed-off-by: liaoao <[email protected]>
  • Loading branch information
leo11261 committed Nov 21, 2023
1 parent eddd90d commit d182b1a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
11 changes: 10 additions & 1 deletion arch/arm/src/arm/arm_undefinedinsn.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@

void arm_undefinedinsn(uint32_t *regs)
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
if (regs[REG_PC] >= (uint32_t)_stext && regs[REG_PC] < (uint32_t)_etext)
{
_alert("Undefined instruction at 0x%" PRIx32 ":0x%" PRIx32 "\n",
regs[REG_PC], *(uint32_t *)regs[REG_PC]);
}
else
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
}

CURRENT_REGS = regs;
PANIC_WITH_REGS("panic", regs);
}
11 changes: 10 additions & 1 deletion arch/arm/src/armv7-a/arm_undefinedinsn.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@

uint32_t *arm_undefinedinsn(uint32_t *regs)
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
if (regs[REG_PC] >= (uint32_t)_stext && regs[REG_PC] < (uint32_t)_etext)
{
_alert("Undefined instruction at 0x%" PRIx32 ":0x%" PRIx32 "\n",
regs[REG_PC], *(uint32_t *)regs[REG_PC]);
}
else
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
}

CURRENT_REGS = regs;
PANIC_WITH_REGS("panic", regs);
return regs; /* To keep the compiler happy */
Expand Down
11 changes: 10 additions & 1 deletion arch/arm/src/armv7-r/arm_undefinedinsn.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@

uint32_t *arm_undefinedinsn(uint32_t *regs)
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
if (regs[REG_PC] >= (uint32_t)_stext && regs[REG_PC] < (uint32_t)_etext)
{
_alert("Undefined instruction at 0x%" PRIx32 ":0x%" PRIx32 "\n",
regs[REG_PC], *(uint32_t *)regs[REG_PC]);
}
else
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
}

CURRENT_REGS = regs;
PANIC_WITH_REGS("panic", regs);
return regs; /* To keep the compiler happy */
Expand Down
11 changes: 10 additions & 1 deletion arch/arm/src/armv8-r/arm_undefinedinsn.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@

uint32_t *arm_undefinedinsn(uint32_t *regs)
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
if (regs[REG_PC] >= (uint32_t)_stext && regs[REG_PC] < (uint32_t)_etext)
{
_alert("Undefined instruction at 0x%" PRIx32 ":0x%" PRIx32 "\n",
regs[REG_PC], *(uint32_t *)regs[REG_PC]);
}
else
{
_alert("Undefined instruction at 0x%" PRIx32 "\n", regs[REG_PC]);
}

CURRENT_REGS = regs;
PANIC_WITH_REGS("panic", regs);
return regs; /* To keep the compiler happy */
Expand Down

0 comments on commit d182b1a

Please sign in to comment.