Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
2dacec15
Commit
2dacec15
authored
May 26, 2016
by
Philip Gladstone
Committed by
Johny Mattsson
May 27, 2016
Browse files
Ensure that load_store exceptions trigger the exception handler (#1307)
Chain unhandled load_store exceptions to SDK exception handler
parent
56b4a3ec
Changes
1
Show whitespace changes
Inline
Side-by-side
app/user/user_exceptions.c
View file @
2dacec15
...
...
@@ -38,6 +38,8 @@
#define L16UI_MATCH 0x001002u
#define L16SI_MATCH 0x009002u
static
exception_handler_fn
load_store_handler
;
void
load_non_32_wide_handler
(
struct
exception_frame
*
ef
,
uint32_t
cause
)
{
...
...
@@ -70,9 +72,13 @@ void load_non_32_wide_handler (struct exception_frame *ef, uint32_t cause)
else
{
die:
/* Turns out we couldn't fix this, trigger a system break instead
/* Turns out we couldn't fix this, so try and chain to the handler
* that was set by the SDK. If none then 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. */
if
(
load_store_handler
)
{
load_store_handler
(
ef
,
cause
);
}
asm
(
"break 1, 1"
);
while
(
1
)
{}
}
...
...
@@ -102,11 +108,14 @@ die:
* of whether there's a proper handler installed for EXCCAUSE_LOAD_STORE_ERROR,
* which of course breaks everything if we allow that to go through. As such,
* we use the linker to wrap that call and stop the SDK from shooting itself in
* its proverbial foot.
* its proverbial foot. We do save the EXCCAUSE_LOAD_STORE_ERROR handler so that
* we can chain to it above.
*/
exception_handler_fn
TEXT_SECTION_ATTR
__wrap__xtos_set_exception_handler
(
uint32_t
cause
,
exception_handler_fn
fn
)
{
if
(
cause
!=
EXCCAUSE_LOAD_STORE_ERROR
)
__real__xtos_set_exception_handler
(
cause
,
fn
);
else
load_store_handler
=
fn
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment