-
Notifications
You must be signed in to change notification settings - Fork 92
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
mte/mpte apply only to breakpoint traps #723
Conversation
This makes it possible to use triggers to debug some of the exception handling code as well. See 2022 email subject:"trigger questions"
This seems like it's not backwards compatible. I think that a note should be added to 1.2.1.5. |
Huh. I'd written that but not pushed it up yet. Here it is. |
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.
Sounds good.
The e-mail thread about this really starts at https://lists.riscv.org/g/tech-debug/topic/89848254#691. This change solves some problems when stepping into exception handlers when native debugging the highest privilege mode. (This is really the ideal use case for external debug, but we try to accommodate native debugging here as well.) If every trap into M-Mode clears mte, then you can't use icount triggers to step into an exception handler. By limiting this clearing to breakpoint exceptions only, more code can be debugged. |
AR feedback is that this change results in the mechanism not serving its purpose when non-breakpoint traps occur. That sounds right to me. Consider:
@pdonahue-ventana can you look this over? You have a gift for corner cases. |
Reverts #723, which would result in mepc etc. being clobbered if a breakpoint trigger would fire in the most privileged mode. Specifically, consider: 1. icount is set so that it'll trigger on the first instruction of an exception handler. 2. Code takes an exception, saving mepc etc. 3. Now icount fires causing a breakpoint exception, clobbering mepc.
Reverts #723, which would result in mepc etc. being clobbered if a breakpoint trigger would fire in the most privileged mode. Specifically, consider: 1. icount is set so that it'll trigger on the first instruction of an exception handler. 2. Code takes an exception, saving mepc etc. 3. Now icount fires causing a breakpoint exception, clobbering mepc.
This makes it possible to use triggers to debug some of the exception
handling code as well.
See 2022 email subject:"trigger questions"