target/riscv: warn about truncating register values #1233
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.
When reading a register via Program Buffer the actual value is read from a GPR. The GPR size (XLEN) can be greater than the length of the target register (e.g.
dcsr
is always 32-bit wide). Due to some HW issue GPR read may return a value that needs to be truncated to fit into the target register. Warn the user about it.Moreover, the value in cache was and is truncated, but the
riscv_reg_t
that is filled byriscv_reg_get()
didn't use to be. This may lead to an assertion failure inabstract_data_write_fill_batch()
: Link:riscv-openocd/src/target/riscv/riscv-013.c
Line 757 in fa7e235
Change-Id: I4d8a5ba2451fc5a60f51b9143b6b140dfe3b73b8