Skip to content

Commit

Permalink
target/riscv: Don't write to zero.
Browse files Browse the repository at this point in the history
During a previous patch, the ignoring of writes to register zero
was deleted. This patch restores it to the original.

Change-Id: Ieb028a5b2e3f691e4847713c7bc809e10726e18c
Signed-off-by: Marek Vrbka <[email protected]>
  • Loading branch information
MarekVCodasip committed Aug 21, 2023
1 parent 5cb60e3 commit c52ffb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/target/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4718,6 +4718,10 @@ unsigned int riscv_count_harts(struct target *target)
*/
static bool gdb_regno_cacheable(enum gdb_regno regno, bool is_write)
{
/* Writes to register zero are rare and should always result in 0 */
if (regno == GDB_REGNO_ZERO)
return false;

/* GPRs, FPRs, vector registers are just normal data stores. */
if (regno <= GDB_REGNO_XPR31 ||
(regno >= GDB_REGNO_FPR0 && regno <= GDB_REGNO_FPR31) ||
Expand Down

0 comments on commit c52ffb9

Please sign in to comment.