The g and G packets
respectively read and write all registers, and are handled by the
functions rsp_read_all_regs ()
and
rsp_write_all_regs ()
.
The register data is provided in a reply packet as a stream of
hexadecimal digits for each register in GDB register order. For
the OpenRISC 1000 this is the 32 GPRs followed by the Previous Program
Counter, Next Program Counter and Supervision Register
SPRs. Each register is presented in target endian order, using
the convenience function reg2hex ()
.
The register data follows the G as a stream of
hexadecimal digits for each register in GDB register order. For
the OpenRISC 1000 this is the 32 GPRs followed by the Previous Program
Counter, Next Program Counter and Supervision Register
SPRs. Each register is supplied in target endian order and
decoded using the utility function
hex2reg ()
.
The corresponding values are set in the Or1ksim data
structures. For the GPRs this is in the
cpu_state.regs
array. For the Previous Program
Counter and Supervision Register it is the relevant entry in the
cpu_state.sprs
array. The Next Program Counter
is set using the set_npc ()
convenience
function (see Section 4.6.5), which ensures
associated variables, controlling the delay pipeline are also
updated appropriately.