Skip to content

Commit

Permalink
Die noisily on a load/store fail exception.
Browse files Browse the repository at this point in the history
This should help point out any remaining offenders trying to write to
const data.
  • Loading branch information
jmattsson committed Jun 30, 2015
1 parent dce0d2c commit 543dedd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/user/user_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#define L16UI_MATCH 0x001002u
#define L16SI_MATCH 0x009002u

#define LOAD_STORE_COMPLAIN_LOUDLY_ON_ERROR
#include "c_stdio.h"

void load_non_32_wide_handler (struct exception_frame *ef, uint32_t cause)
{
Expand Down Expand Up @@ -70,6 +72,11 @@ void load_non_32_wide_handler (struct exception_frame *ef, uint32_t cause)
else
{
die:
#ifdef LOAD_STORE_COMPLAIN_LOUDLY_ON_ERROR
while (1)
c_printf("\nerror: instruction %x at %x failed on memory access to %x\n",
insn, epc1, excvaddr);
#endif
/* Turns out we couldn't fix this, trigger a system break instead
* and hang if the break doesn't get handled. This is effectively
* what would happen if the default handler was installed. */
Expand Down

0 comments on commit 543dedd

Please sign in to comment.