-
Notifications
You must be signed in to change notification settings - Fork 26
Allow aarsize==3 (aka 64-bit) Abstract Commands in the debug module. #431
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
base: main
Are you sure you want to change the base?
Conversation
These are already correctly handled by the AC ROM as reading/writing the cap metadata bits for GPCRs. This diff also extends that handling to access the same bits on CSRs as well.
|
Thanks for this fix. As this is a "vendored" file it will need some additional work to avoid your changes being lost next time someone runs the vendoring script to update the vendored files. You've got two options:
Or
|
|
Opened a PR on the upstream repository: CHERIoT-Platform/cheriot-dbg-module#3 |
|
Thanks for getting the upstream changes made @resistor. Would you like to update this PR to vendor in the changes or would you prefer I created a PR to do that? |
If you could do it, it’s much more likely to be done correctly. |
|
Hi @resistor, I'm having some trouble getting the modified debug module to work, and am wondering if the I've vendored in the updated debug module into sonata-system locally and have been trying to connect to it using OpenOCD and gdb, but keep getting an illegal instruction exception. Specifically, the message reported by Verilator is I believe the underlying issue is that the increase in I've not yet thought up a way around this issue (assuming my diagnosis is correct), but perhaps you can as you know more about what this change is ultimately trying to achieve. |
Could you try using this fork of OpenOCD, which we've been customizing for talking to CHERIoT? It should handle the issue you're seeing correctly. https://github.com/cherioT-Platform/openocd |
|
Thanks, I managed to build the OpenOCD fork and it seemed to detect the XLEN and Do you recommend any particular commit of CHERIoT-Platform/llvm-project for me to build? One with any required LLDB changes that is also fairly stable perhaps. I'm currently building the latest (3fcf44fb), but it would be good to have a known-good version to fall-back to if I encounter problems. |
|
My first issue seems to be that I cannot seem to read general-purpose registers using the modified debug module and OpenOCD. A loop counter in my test program (reg Previous DM + OpenOCD + GDB: Modified DM + CHERIoT-OpenOCD + CHERIoT-LLDB: (Note that processor state is probably not identical between these two register snapshots as they were two different Verilator runs and halted at different places) Currently I'm using I'm not familiar with LLDB, so perhaps I've made a mistake somewhere. Do you have any ideas why register reading is not working? |
|
The formatting you're seeing from lldb is in Cheriot capability decoding format, showing the cap metadata. If you'd prefer to view it in a more GDB-like format, just pass |
|
I don't know offhand why you would be getting different results. What path is it taking through the AC command ROM? |
|
This seems to be the section where it is reading a4 ("c14"). Looks like the register does have an expected value ( Let me know if another instruction trace section would be of use. |
|
I don't see anything wrong with the instruction trace. I assume the offset is correct for the store? I might not be able to get to it for a few days, but is it possible for to reproduce this? If so I can try debugging cheriot openocd/lldb and see what's going on. |
|
Could it be these shift instructions (time 24957400000 and 24957450000 in the trace above)? Looks like it is loading a capability into c10, using non-capability operations on it, then trying to use it to store data (which presumably fails): |
Sure, in what environment would you like to reproduce this? If you are familiar with sonata-system, I could put together some instructions. |
I had the same question the first time I looked at the AC ROM. It turns out that cap exceptions are suppressed when we are in debug mode, so that code works. It's also unchanged by this patch. |
I have a Sonata board. I could also try to run a simulation with Verilator if you can give me instructions. I'm normally a software type working on the toolchain, not a Verilog person. |
|
One other thing that might be worth trying is connection to OpenOCD over telnet on port 4444 and controlling it directly via this command set: https://openocd.org/doc/html/General-Commands.html That should make it possible to determine if the register values are wrong in OpenOCD even without LLDB involved. |
|
Thanks for the tip about the telnet interface, it helped me find the root issue and get register reads working. Unfortunately, this seems to have been yet another bug that has already been fixed in the upstream PULP debug module. In this old version of the code, the location in the debug module where the data from a register read is stored doesn't support storing a 64-bit value using two 32-bit stores. The second 32-bit store simply overwrites the first. This appears to have been fixed by pulp-platform/riscv-dbg#94. Another update to the CHERIoT-Platform debug module to either cherry-pick this fix or rebase onto a more recent version would be much appreciated. Here's the working LLDB register read output, if that's of interest: |
|
I think these debug module changes will be left out of the v1.3 release at this point. We're keen to get the recent performance improvements released. We can do a v1.4 release once the debug module is working nicely with Sonata, hopefully not long after. |
|
@resistor would it help if I opened the fix cherry-pick PR on the CHERIoT-Platform debug module? |
|
@elliotb-lowrisc Unfortunately Colin is on holiday at the moment. I'm hoping to get him to weigh in here once he's back. |
|
Ah, fair enough. I hope he's having a good break |
These are already correctly handled by the AC ROM as reading/writing the cap metadata
bits for GPCRs. This diff also extends that handling to access the same bits on CSRs as well.