.. | .. |
---|
21 | 21 | |
---|
22 | 22 | static int genregs_get(struct task_struct *target, |
---|
23 | 23 | const struct user_regset *regset, |
---|
24 | | - unsigned int pos, unsigned int count, |
---|
25 | | - void *kbuf, void __user *ubuf) |
---|
| 24 | + struct membuf to) |
---|
26 | 25 | { |
---|
27 | 26 | const struct pt_regs *regs = task_pt_regs(target); |
---|
28 | 27 | const struct switch_stack *sw = (struct switch_stack *)regs - 1; |
---|
29 | | - int ret = 0; |
---|
30 | 28 | |
---|
31 | | -#define REG_O_ZERO_RANGE(START, END) \ |
---|
32 | | - if (!ret) \ |
---|
33 | | - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \ |
---|
34 | | - START * 4, (END * 4) + 4); |
---|
35 | | - |
---|
36 | | -#define REG_O_ONE(PTR, LOC) \ |
---|
37 | | - if (!ret) \ |
---|
38 | | - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \ |
---|
39 | | - LOC * 4, (LOC * 4) + 4); |
---|
40 | | - |
---|
41 | | -#define REG_O_RANGE(PTR, START, END) \ |
---|
42 | | - if (!ret) \ |
---|
43 | | - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \ |
---|
44 | | - START * 4, (END * 4) + 4); |
---|
45 | | - |
---|
46 | | - REG_O_ZERO_RANGE(PTR_R0, PTR_R0); |
---|
47 | | - REG_O_RANGE(®s->r1, PTR_R1, PTR_R7); |
---|
48 | | - REG_O_RANGE(®s->r8, PTR_R8, PTR_R15); |
---|
49 | | - REG_O_RANGE(sw, PTR_R16, PTR_R23); |
---|
50 | | - REG_O_ZERO_RANGE(PTR_R24, PTR_R25); /* et and bt */ |
---|
51 | | - REG_O_ONE(®s->gp, PTR_GP); |
---|
52 | | - REG_O_ONE(®s->sp, PTR_SP); |
---|
53 | | - REG_O_ONE(®s->fp, PTR_FP); |
---|
54 | | - REG_O_ONE(®s->ea, PTR_EA); |
---|
55 | | - REG_O_ZERO_RANGE(PTR_BA, PTR_BA); |
---|
56 | | - REG_O_ONE(®s->ra, PTR_RA); |
---|
57 | | - REG_O_ONE(®s->ea, PTR_PC); /* use ea for PC */ |
---|
58 | | - if (!ret) |
---|
59 | | - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, |
---|
60 | | - PTR_STATUS * 4, -1); |
---|
61 | | - |
---|
62 | | - return ret; |
---|
| 29 | + membuf_zero(&to, 4); // R0 |
---|
| 30 | + membuf_write(&to, ®s->r1, 7 * 4); // R1..R7 |
---|
| 31 | + membuf_write(&to, ®s->r8, 8 * 4); // R8..R15 |
---|
| 32 | + membuf_write(&to, sw, 8 * 4); // R16..R23 |
---|
| 33 | + membuf_zero(&to, 2 * 4); /* et and bt */ |
---|
| 34 | + membuf_store(&to, regs->gp); |
---|
| 35 | + membuf_store(&to, regs->sp); |
---|
| 36 | + membuf_store(&to, regs->fp); |
---|
| 37 | + membuf_store(&to, regs->ea); |
---|
| 38 | + membuf_zero(&to, 4); // PTR_BA |
---|
| 39 | + membuf_store(&to, regs->ra); |
---|
| 40 | + membuf_store(&to, regs->ea); /* use ea for PC */ |
---|
| 41 | + return membuf_zero(&to, (NUM_PTRACE_REG - PTR_PC) * 4); |
---|
63 | 42 | } |
---|
64 | 43 | |
---|
65 | 44 | /* |
---|
.. | .. |
---|
121 | 100 | .n = NUM_PTRACE_REG, |
---|
122 | 101 | .size = sizeof(unsigned long), |
---|
123 | 102 | .align = sizeof(unsigned long), |
---|
124 | | - .get = genregs_get, |
---|
| 103 | + .regset_get = genregs_get, |
---|
125 | 104 | .set = genregs_set, |
---|
126 | 105 | } |
---|
127 | 106 | }; |
---|