Commit 6bda7688 authored by Al Viro's avatar Al Viro

nios2: switch to ->regset_get()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8320514c
...@@ -21,45 +21,24 @@ ...@@ -21,45 +21,24 @@
static int genregs_get(struct task_struct *target, static int genregs_get(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
unsigned int pos, unsigned int count, struct membuf to)
void *kbuf, void __user *ubuf)
{ {
const struct pt_regs *regs = task_pt_regs(target); const struct pt_regs *regs = task_pt_regs(target);
const struct switch_stack *sw = (struct switch_stack *)regs - 1; const struct switch_stack *sw = (struct switch_stack *)regs - 1;
int ret = 0;
#define REG_O_ZERO_RANGE(START, END) \
if (!ret) \
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \
START * 4, (END * 4) + 4);
#define REG_O_ONE(PTR, LOC) \
if (!ret) \
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \
LOC * 4, (LOC * 4) + 4);
#define REG_O_RANGE(PTR, START, END) \ membuf_zero(&to, 4); // R0
if (!ret) \ membuf_write(&to, &regs->r1, 7 * 4); // R1..R7
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \ membuf_write(&to, &regs->r8, 8 * 4); // R8..R15
START * 4, (END * 4) + 4); membuf_write(&to, sw, 8 * 4); // R16..R23
membuf_zero(&to, 2 * 4); /* et and bt */
REG_O_ZERO_RANGE(PTR_R0, PTR_R0); membuf_store(&to, regs->gp);
REG_O_RANGE(&regs->r1, PTR_R1, PTR_R7); membuf_store(&to, regs->sp);
REG_O_RANGE(&regs->r8, PTR_R8, PTR_R15); membuf_store(&to, regs->fp);
REG_O_RANGE(sw, PTR_R16, PTR_R23); membuf_store(&to, regs->ea);
REG_O_ZERO_RANGE(PTR_R24, PTR_R25); /* et and bt */ membuf_zero(&to, 4); // PTR_BA
REG_O_ONE(&regs->gp, PTR_GP); membuf_store(&to, regs->ra);
REG_O_ONE(&regs->sp, PTR_SP); membuf_store(&to, regs->ea); /* use ea for PC */
REG_O_ONE(&regs->fp, PTR_FP); return membuf_zero(&to, (NUM_PTRACE_REG - PTR_PC) * 4);
REG_O_ONE(&regs->ea, PTR_EA);
REG_O_ZERO_RANGE(PTR_BA, PTR_BA);
REG_O_ONE(&regs->ra, PTR_RA);
REG_O_ONE(&regs->ea, PTR_PC); /* use ea for PC */
if (!ret)
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
PTR_STATUS * 4, -1);
return ret;
} }
/* /*
...@@ -121,7 +100,7 @@ static const struct user_regset nios2_regsets[] = { ...@@ -121,7 +100,7 @@ static const struct user_regset nios2_regsets[] = {
.n = NUM_PTRACE_REG, .n = NUM_PTRACE_REG,
.size = sizeof(unsigned long), .size = sizeof(unsigned long),
.align = sizeof(unsigned long), .align = sizeof(unsigned long),
.get = genregs_get, .regset_get = genregs_get,
.set = genregs_set, .set = genregs_set,
} }
}; };
......
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