in kernel/ptrace.c [36:70]
static int genregs_get(struct task_struct *target,
const struct user_regset *regset,
struct membuf to)
{
struct pt_regs *regs = task_pt_regs(target);
/* The general idea here is that the copyout must happen in
* exactly the same order in which the userspace expects these
* regs. Now, the sequence in userspace does not match the
* sequence in the kernel, so everything past the 32 gprs
* happens one at a time.
*/
membuf_write(&to, ®s->r00, 32*sizeof(unsigned long));
/* Must be exactly same sequence as struct user_regs_struct */
membuf_store(&to, regs->sa0);
membuf_store(&to, regs->lc0);
membuf_store(&to, regs->sa1);
membuf_store(&to, regs->lc1);
membuf_store(&to, regs->m0);
membuf_store(&to, regs->m1);
membuf_store(&to, regs->usr);
membuf_store(&to, regs->preds);
membuf_store(&to, regs->gp);
membuf_store(&to, regs->ugp);
membuf_store(&to, pt_elr(regs)); // pc
membuf_store(&to, (unsigned long)pt_cause(regs)); // cause
membuf_store(&to, pt_badva(regs)); // badva
#if CONFIG_HEXAGON_ARCH_VERSION >=4
membuf_store(&to, regs->cs0);
membuf_store(&to, regs->cs1);
return membuf_zero(&to, sizeof(unsigned long));
#else
return membuf_zero(&to, 3 * sizeof(unsigned long));
#endif
}