Skip to content

Commit 3399d90

Browse files
author
Al Viro
committed
sh: convert to ->regset_get()
NB: there's a direct call of fpregs_get() left in dump_fpu(). To be taken out once we convert ELF_FDPIC to use of regset. Signed-off-by: Al Viro <[email protected]>
1 parent 759de58 commit 3399d90

File tree

2 files changed

+12
-41
lines changed

2 files changed

+12
-41
lines changed

arch/sh/kernel/process_32.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
103103

104104
fpvalid = !!tsk_used_math(tsk);
105105
if (fpvalid)
106-
fpvalid = !fpregs_get(tsk, NULL, 0,
107-
sizeof(struct user_fpu_struct),
108-
fpu, NULL);
106+
fpvalid = !fpregs_get(tsk, NULL,
107+
(struct membuf){fpu, sizeof(*fpu)});
109108
#endif
110109

111110
return fpvalid;

arch/sh/kernel/ptrace_32.c

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,11 @@ void ptrace_disable(struct task_struct *child)
134134

135135
static int genregs_get(struct task_struct *target,
136136
const struct user_regset *regset,
137-
unsigned int pos, unsigned int count,
138-
void *kbuf, void __user *ubuf)
137+
struct membuf to)
139138
{
140139
const struct pt_regs *regs = task_pt_regs(target);
141-
int ret;
142140

143-
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
144-
regs->regs,
145-
0, 16 * sizeof(unsigned long));
146-
if (!ret)
147-
/* PC, PR, SR, GBR, MACH, MACL, TRA */
148-
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
149-
&regs->pc,
150-
offsetof(struct pt_regs, pc),
151-
sizeof(struct pt_regs));
152-
if (!ret)
153-
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
154-
sizeof(struct pt_regs), -1);
155-
156-
return ret;
141+
return membuf_write(&to, regs, sizeof(struct pt_regs));
157142
}
158143

159144
static int genregs_set(struct task_struct *target,
@@ -182,21 +167,16 @@ static int genregs_set(struct task_struct *target,
182167
#ifdef CONFIG_SH_FPU
183168
int fpregs_get(struct task_struct *target,
184169
const struct user_regset *regset,
185-
unsigned int pos, unsigned int count,
186-
void *kbuf, void __user *ubuf)
170+
struct membuf to)
187171
{
188172
int ret;
189173

190174
ret = init_fpu(target);
191175
if (ret)
192176
return ret;
193177

194-
if ((boot_cpu_data.flags & CPU_HAS_FPU))
195-
return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
196-
&target->thread.xstate->hardfpu, 0, -1);
197-
198-
return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
199-
&target->thread.xstate->softfpu, 0, -1);
178+
return membuf_write(&to, target->thread.xstate,
179+
sizeof(struct user_fpu_struct));
200180
}
201181

202182
static int fpregs_set(struct task_struct *target,
@@ -230,20 +210,12 @@ static int fpregs_active(struct task_struct *target,
230210
#ifdef CONFIG_SH_DSP
231211
static int dspregs_get(struct task_struct *target,
232212
const struct user_regset *regset,
233-
unsigned int pos, unsigned int count,
234-
void *kbuf, void __user *ubuf)
213+
struct membuf to)
235214
{
236215
const struct pt_dspregs *regs =
237216
(struct pt_dspregs *)&target->thread.dsp_status.dsp_regs;
238-
int ret;
239217

240-
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs,
241-
0, sizeof(struct pt_dspregs));
242-
if (!ret)
243-
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
244-
sizeof(struct pt_dspregs), -1);
245-
246-
return ret;
218+
return membuf_write(&to, regs, sizeof(struct pt_dspregs));
247219
}
248220

249221
static int dspregs_set(struct task_struct *target,
@@ -324,7 +296,7 @@ static const struct user_regset sh_regsets[] = {
324296
.n = ELF_NGREG,
325297
.size = sizeof(long),
326298
.align = sizeof(long),
327-
.get = genregs_get,
299+
.regset_get = genregs_get,
328300
.set = genregs_set,
329301
},
330302

@@ -334,7 +306,7 @@ static const struct user_regset sh_regsets[] = {
334306
.n = sizeof(struct user_fpu_struct) / sizeof(long),
335307
.size = sizeof(long),
336308
.align = sizeof(long),
337-
.get = fpregs_get,
309+
.regset_get = fpregs_get,
338310
.set = fpregs_set,
339311
.active = fpregs_active,
340312
},
@@ -345,7 +317,7 @@ static const struct user_regset sh_regsets[] = {
345317
.n = sizeof(struct pt_dspregs) / sizeof(long),
346318
.size = sizeof(long),
347319
.align = sizeof(long),
348-
.get = dspregs_get,
320+
.regset_get = dspregs_get,
349321
.set = dspregs_set,
350322
.active = dspregs_active,
351323
},

0 commit comments

Comments
 (0)