-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Arch arm fix is in isr #19688
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
Merged
andrewboie
merged 9 commits into
zephyrproject-rtos:master
from
ioannisg:arch_arm_fix_is_in_isr
Oct 24, 2019
Merged
Arch arm fix is in isr #19688
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c07cb8c
arch: arm: swap: add useful inline comment for SVC return
ioannisg 78083ef
arch: arm: fatal: add documentation for z_do_kernel_oops()
ioannisg c70d043
arch: arm: major cleanup and refactoring for fault function
ioannisg baed7d6
arch: arm: re-implement z_arch_is_in_isr
ioannisg 3c6a1e3
arch: add Kconfig to signify ability to detect nested IRQ
ioannisg ae3ec32
arch: arm: internal API to check return execution mode
ioannisg 5f160a5
kernel: fatal: use nested exception info in z_fatal_error
ioannisg d5f313d
arch: arm: do not add CODE_UNREACHABLE in Z_ARCH_EXCEPT
ioannisg f6bd594
tests: arch: arm: add a test for fatal errors in interrupts
ioannisg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need to make a copy of the ESF?
AFAIK every other platform just passes the original stack frame along.
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.
The main reason is that kernel/fatal.c needs to query, whether this a nested exception. And it needs to do it by inspecting the ESF. So the ESF must be holding correct information. The problem with the ARM ESF is that it may be, originally, corrupted due to e.g. stack overflow.
The only GENERIC way for ARM Software to detect if it is in a nested exception, is to inspect the EXC_RETURN value that is placed in LR upon exception entry. But EXC_RETURN value is neither part of ESF, nor stored in fault.c (as a global state variable), nor is it passed to kernel/fatal.c as argument.
So, unless we want to change the internal API of z_fatal_error(), for instance, by adding a "flags" parameter, we need the sole parameter, *esf, to hold all the required info. That's why I do the copy here.
if we define
z_fatal_error(*esf, some_generic_flags) {
}, we should be able to pass the EXC_RETURN value or the nested_exception boolean value, but all these require cross-arch changes.