Load/store exception handler: handle re-entry via a NMI. #644
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.
The NMI can asynchronously interrupt the load/store exception handler. This does occur frequently as the NMI handler code does invoke load/store exceptions, and the load/store exception handler is heavily used. This was corrupting the load/store exception handler saved state and thus randomly corrupting registers a0 to a6 of the interruptee.
Re-entry of the load/store handler was quite frequent so this one needs fixing. Testing or review feedback would be welcomed? This PR implements a different strategy to the SDK fix and might be more efficient and supports multiple re-entry via an NMI.
The sdk code also appears to handle NMI re-entry too, but that seems a separate issue. Not yet sure where that is a problem, perhaps very quick repetition of an NMI before the handler disables it, or perhaps on the exit path after re-enabling the NMI but before restoring state from the NMI stack? Shall look into that separately.