Skip to content

Commit

Permalink
[NFC] target/riscv: refactor init_registers()
Browse files Browse the repository at this point in the history
The logic in `init_registers()` was quite convoluted.
Initialization of each `struct reg` field is separated into function
`gdb_regno_<field_name>()`.
IMHO, this makes it much easier to reason about the code.

Change-Id: Id7faa1464ce026cc5025585d0a6a95a01fb39cee
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
  • Loading branch information
en-sc committed Mar 7, 2024
1 parent ca7d882 commit e936d33
Show file tree
Hide file tree
Showing 3 changed files with 529 additions and 379 deletions.
5 changes: 4 additions & 1 deletion src/target/riscv/gdb_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ enum gdb_regno {
GDB_REGNO_FT11,
GDB_REGNO_FPR31 = GDB_REGNO_FT11,
GDB_REGNO_CSR0 = 65,
GDB_REGNO_FCSR = CSR_FCSR + GDB_REGNO_CSR0,
GDB_REGNO_FFLAGS = CSR_FFLAGS + GDB_REGNO_CSR0,
GDB_REGNO_FRM = CSR_FRM + GDB_REGNO_CSR0,
GDB_REGNO_VSTART = CSR_VSTART + GDB_REGNO_CSR0,
GDB_REGNO_VXSAT = CSR_VXSAT + GDB_REGNO_CSR0,
GDB_REGNO_VXRM = CSR_VXRM + GDB_REGNO_CSR0,
Expand Down Expand Up @@ -120,6 +123,6 @@ enum gdb_regno {
GDB_REGNO_COUNT
};

const char *gdb_regno_name(struct target *target, enum gdb_regno regno);
const char *gdb_regno_name(const struct target *target, enum gdb_regno regno);

#endif
Loading

0 comments on commit e936d33

Please sign in to comment.