-
Notifications
You must be signed in to change notification settings - Fork 72
Provide a structure with the debug information to debug_halt() handler #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ TDebugBox g_debug_box; | |
| void debug_reboot(TResetReason reason) | ||
| { | ||
| if (!g_debug_box.initialized || g_active_box != g_debug_box.box_id || reason >= __TRESETREASON_MAX) { | ||
| halt(NOT_ALLOWED); | ||
| halt(NOT_ALLOWED, NULL); | ||
| } | ||
|
|
||
| /* Note: Currently we do not act differently based on the reset reason. */ | ||
|
|
@@ -45,9 +45,12 @@ uint32_t debug_get_version(void) | |
| return 0; | ||
| } | ||
|
|
||
| void debug_halt_error(THaltError reason) | ||
| uint32_t g_debug_interrupt_sp[UVISOR_MAX_BOXES]; | ||
|
|
||
| void debug_halt_error(THaltError reason, const THaltInfo *halt_info) | ||
| { | ||
| static int debugged_once_before = 0; | ||
| void *info = NULL; | ||
|
|
||
| /* If the debug box does not exist (or it has not been initialized yet), or | ||
| * the debug box was already called once, just loop forever. */ | ||
|
|
@@ -56,16 +59,22 @@ void debug_halt_error(THaltError reason) | |
| } else { | ||
| /* Remember that debug_deprivilege_and_return() has been called once. */ | ||
| debugged_once_before = 1; | ||
|
|
||
| /* Place the halt info on the interrupt stack. */ | ||
| if (halt_info) { | ||
| g_debug_interrupt_sp[g_debug_box.box_id] -= sizeof(THaltInfo); | ||
| info = (void *)g_debug_interrupt_sp[g_debug_box.box_id]; | ||
| memcpy(info, halt_info, sizeof(THaltInfo)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is okish. The alternative would be that the debug box reserves a |
||
| } | ||
|
|
||
| /* The following arguments are passed to the destination function: | ||
| * 1. reason | ||
| * 2. halt info | ||
| * Upon return from the debug handler, the system will die. */ | ||
| debug_deprivilege_and_return(g_debug_box.driver->halt_error, debug_die, reason, 0, 0, 0); | ||
| debug_deprivilege_and_return(g_debug_box.driver->halt_error, debug_die, reason, (uint32_t)info, 0, 0); | ||
| } | ||
| } | ||
|
|
||
| uint32_t g_debug_interrupt_sp[UVISOR_MAX_BOXES]; | ||
|
|
||
| void debug_register_driver(const TUvisorDebugDriver * const driver) | ||
| { | ||
| int i; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: We don't want to print uVisor faults, since it could expose secrets. To debug uVisor faults users will have to use a uVisor debug build with semihosting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extend the "For security reasons" comment with this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.