kgdb,kdb: individual register set and and get API

The kdb shell specification includes the ability to get and set
architecture specific registers by name.

For the time being individual register get and set will be implemented
on a per architecture basis.  If an architecture defines
DBG_MAX_REG_NUM > 0 then kdb and the gdbstub will use the capability
for individually getting and setting architecture specific registers.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
This commit is contained in:
Jason Wessel 2010-08-05 09:22:20 -05:00
parent 84a0bd5b28
commit 534af10823
3 changed files with 159 additions and 12 deletions

View file

@ -328,6 +328,32 @@ static int kgdb_ebin2mem(char *buf, char *mem, int count)
return probe_kernel_write(mem, c, size);
}
#if DBG_MAX_REG_NUM > 0
void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
{
int i;
int idx = 0;
char *ptr = (char *)gdb_regs;
for (i = 0; i < DBG_MAX_REG_NUM; i++) {
dbg_get_reg(i, ptr + idx, regs);
idx += dbg_reg_def[i].size;
}
}
void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
{
int i;
int idx = 0;
char *ptr = (char *)gdb_regs;
for (i = 0; i < DBG_MAX_REG_NUM; i++) {
dbg_set_reg(i, ptr + idx, regs);
idx += dbg_reg_def[i].size;
}
}
#endif /* DBG_MAX_REG_NUM > 0 */
/* Write memory due to an 'M' or 'X' packet. */
static int write_mem_msg(int binary)
{