Commit 24153c03 authored by Douglas Anderson's avatar Douglas Anderson Committed by Will Deacon

arm64/debug: Fix registers on sleeping tasks

This is the equivalent of commit 001bf455 ("ARM: 8428/1: kgdb: Fix
registers on sleeping tasks") but for arm64.  Nuff said.

...well, perhaps I could also add that task_pt_regs are userspace
registers and that's not what kgdb is supposed to be reporting.  We're
supposed to be reporting kernel registers.
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 1212f7a1
...@@ -138,14 +138,25 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) ...@@ -138,14 +138,25 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
void void
sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task)
{ {
struct pt_regs *thread_regs; struct cpu_context *cpu_context = &task->thread.cpu_context;
/* Initialize to zero */ /* Initialize to zero */
memset((char *)gdb_regs, 0, NUMREGBYTES); memset((char *)gdb_regs, 0, NUMREGBYTES);
thread_regs = task_pt_regs(task);
memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES); gdb_regs[19] = cpu_context->x19;
/* Special case for PSTATE (check comments in asm/kgdb.h for details) */ gdb_regs[20] = cpu_context->x20;
dbg_get_reg(33, gdb_regs + GP_REG_BYTES, thread_regs); gdb_regs[21] = cpu_context->x21;
gdb_regs[22] = cpu_context->x22;
gdb_regs[23] = cpu_context->x23;
gdb_regs[24] = cpu_context->x24;
gdb_regs[25] = cpu_context->x25;
gdb_regs[26] = cpu_context->x26;
gdb_regs[27] = cpu_context->x27;
gdb_regs[28] = cpu_context->x28;
gdb_regs[29] = cpu_context->fp;
gdb_regs[31] = cpu_context->sp;
gdb_regs[32] = cpu_context->pc;
} }
void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment