diff options
author | Parshintsev Anatoly <anatoly.parshintsev@syntacore.com> | 2025-01-30 20:22:03 +0300 |
---|---|---|
committer | Parshintsev Anatoly <anatoly.parshintsev@syntacore.com> | 2025-03-07 03:56:39 +0300 |
commit | 3999025add180b5b57e04a4f69444244e094a7da (patch) | |
tree | 87f557ce26b672d3ee6a5ed82fa685dd958d1723 /git-hooks/commit-msg | |
parent | 5de7310881c18a50797e8d96cf6d3f3aeb2aa4d0 (diff) | |
download | riscv-openocd-3999025add180b5b57e04a4f69444244e094a7da.zip riscv-openocd-3999025add180b5b57e04a4f69444244e094a7da.tar.gz riscv-openocd-3999025add180b5b57e04a4f69444244e094a7da.tar.bz2 |
fix expose_csr for CSR with address "0"
This change is a quick-and-dirty workaround for the problem when user
wants to expose CSR with address "0" and instead of user-specified name
"csr0" was used.
The problem looks as follows:
riscv013_reg_examine_all eventually calls init_cache_entry for all CSRs.
init_cache_entry eventually results in a call to riscv_reg_gdb_regno_name.
Then in case of non-standard CSRs we have the following logic:
```
// NULL when regno == 0, since names are not generated yet
if (info->reg_names[regno])
return info->reg_names[regno]
...
if (regno >= GDB_REGNO_CSR0 && regno <= GDB_REGNO_CSR4095) {
// generate names for all exposed CSRs (the function
// lazy-initializes all the required names)
init_custom_csr_names(target);
// And here we have an error, since we overwrite the name generated
// by init_custom_csr_names
info->reg_names[regno] =
init_reg_name_with_prefix("csr", regno - GDB_REGNO_CSR0);
...
```
The error happens because when initially this function is called with
regno = 0, the first condition false, so we have to go and generate all
the names.
Diffstat (limited to 'git-hooks/commit-msg')
0 files changed, 0 insertions, 0 deletions