riscv-openocd icon indicating copy to clipboard operation
riscv-openocd copied to clipboard

Add functions to decode RVC load and store instructions for watchpoints

Open MrAlexei opened this issue 1 year ago • 1 comments

This commit adds support for RVC (compressed) load and store instructions.

https://github.com/riscv-collab/riscv-openocd/issues/688 https://github.com/riscv-collab/riscv-openocd/pull/291

For GDB to fully support hardware watchpoints, OpenOCD needs to tell GDB which data address has been hit. OpenOCD relies on a target-specific hit_watchpoint function to do this. If GDB is not given the address, it will not print the hit variable name or its old and new value.

There does not seem to be a way for the hardware to tell us which trigger was hit (0.13 introduced the 'hit bit' but this is optional). Alternatively, we can decode the instruction at dpc and find out which memory address it accesses.

MrAlexei avatar Mar 10 '24 17:03 MrAlexei

Converted the pull request to a draft. It is necessary to add processing for Store/Load from extensions "F" and "D"

MrAlexei avatar Mar 18 '24 18:03 MrAlexei

To check all the commits you can use it on the output of the diff

Thank you!

Check all the commits
total: 0 errors, 0 warnings, 0 checks, 517 lines checked

Your patch has no obvious style problems and is ready for submission.

NOTE: Ignored message types: AVOID_EXTERNS BLOCK_COMMENT_STYLE COMPLEX_MACRO CONST_STRUCT ENOSYS FILE_PATH_CHANGES GERRIT_CHANGE_ID LINE_SPACING LOGICAL_CONTINUATIONS MACRO_WITH_FLOW_CONTROL NEW_TYPEDEFS PARENTHESIS_ALIGNMENT PREFER_DEFINED_ATTRIBUTE_MACRO PREFER_FALLTHROUGH PREFER_KERNEL_TYPES SPLIT_STRING SSCANF_TO_KSTRTO SWITCH_CASE_INDENT_LEVEL TRACING_LOGGING VOLATILE

MrAlexei avatar Apr 08 '24 17:04 MrAlexei

@TommyMurphyTM1234, could you please take a look if you have the time? @JanMatCodasip, @MarekVCodasip, I would greatly appreciate your input.

en-sc avatar Apr 09 '24 16:04 en-sc

@MrAlexei Thank you for the contribution and I am sorry for a not very timely review. I will be able to take a look at the changes tomorrow morning.

JanMatCodasip avatar Apr 10 '24 11:04 JanMatCodasip

@TommyMurphyTM1234 or @MrAlexei, please, don't forget to mark the above threads as resolved when done so.

Thank you.

JanMatCodasip avatar Apr 15 '24 10:04 JanMatCodasip

@JanMatCodasip

Also, @MrAlexei, how have you tested your changes?

I've tested regression tests with Spike (w/o the hit bit in the mcontrol) using the riscv-test project and manual testing for RVC instructions.

MrAlexei avatar Apr 21 '24 19:04 MrAlexei

@aap-sc @MrAlexei Please, what is the status on the two last currently open threads (1, 2) in this PR? Thank you.

JanMatCodasip avatar Apr 30 '24 05:04 JanMatCodasip

@JanMatCodasip

@aap-sc @MrAlexei Please, what is the status on the two last currently open threads (1, 2) in this PR? Thank you.

My understanding is that these are not addressed (as of yet). However, these are not blockers. Given the size of the change I don't have strong objections against merging this. It's just we'll have to follow up with additional patches that should address these issues.

aap-sc avatar Apr 30 '24 06:04 aap-sc

@aap-sc @MrAlexei Please, what is the status on the two last currently open threads (1, 2) in this PR? Thank you.

I've finished working on these last threads. Thank you.

MrAlexei avatar Apr 30 '24 07:04 MrAlexei

Thank you all so much for the review!

MrAlexei avatar May 17 '24 14:05 MrAlexei