12 #include <linux/kernel.h>
13 #include <linux/sched.h>
15 #include <linux/errno.h>
16 #include <linux/ptrace.h>
20 #include <linux/signal.h>
22 #include <linux/elf.h>
25 #include <asm/pgtable.h>
26 #include <asm/uaccess.h>
27 #include <asm/cacheflush.h>
48 unsigned int pos,
unsigned int count,
49 void *kbuf,
void __user *ubuf)
52 unsigned long __user *reg_window;
53 unsigned long *
k = kbuf;
64 for (; count > 0 && pos < 16; count--)
65 *k++ = regs->
u_regs[pos++];
69 for (; count > 0 && pos < 32; count--) {
70 if (
get_user(*k++, ®_window[pos++]))
74 for (; count > 0 && pos < 16; count--) {
81 for (; count > 0 && pos < 32; count--) {
82 if (
get_user(reg, ®_window[pos++]) ||
118 count *=
sizeof(
reg);
120 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
121 38 *
sizeof(reg), -1);
126 unsigned int pos,
unsigned int count,
127 const void *kbuf,
const void __user *ubuf)
130 unsigned long __user *reg_window;
131 const unsigned long *k = kbuf;
132 const unsigned long __user *u = ubuf;
139 count /=
sizeof(
reg);
142 for (; count > 0 && pos < 16; count--)
143 regs->
u_regs[pos++] = *k++;
147 for (; count > 0 && pos < 32; count--) {
148 if (
put_user(*k++, ®_window[pos++]))
152 for (; count > 0 && pos < 16; count--) {
160 for (; count > 0 && pos < 32; count--) {
202 count *=
sizeof(
reg);
204 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
205 38 *
sizeof(reg), -1);
208 static int fpregs32_get(
struct task_struct *target,
210 unsigned int pos,
unsigned int count,
211 void *kbuf,
void __user *ubuf)
213 const unsigned long *fpregs = target->
thread.float_regs;
218 save_and_clear_fpu();
221 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
223 0, 32 *
sizeof(
u32));
226 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
230 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
238 val = (1 << 8) | (8 << 16);
239 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
246 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
247 35 *
sizeof(
u32), -1);
252 static int fpregs32_set(
struct task_struct *target,
254 unsigned int pos,
unsigned int count,
255 const void *kbuf,
const void __user *ubuf)
257 unsigned long *fpregs = target->
thread.float_regs;
262 save_and_clear_fpu();
264 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
266 0, 32 *
sizeof(
u32));
268 user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
271 if (!ret && count > 0) {
272 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
279 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
280 34 *
sizeof(
u32), -1);
284 static const struct user_regset sparc32_regsets[] = {
312 .get = fpregs32_get, .set = fpregs32_set
317 .name =
"sparc", .e_machine =
EM_SPARC,
318 .regsets = sparc32_regsets, .
n =
ARRAY_SIZE(sparc32_regsets)
323 return &user_sparc32_view;
327 unsigned long regs[32];
339 unsigned long addr,
unsigned long data)
349 addr2p = (
void __user *) addr2;
350 pregs = (
struct pt_regs __user *) addr;
351 fps = (
struct fps __user *) addr;
381 ret = copy_regset_to_user(child, view,
REGSET_FP,
386 ret = copy_regset_to_user(child, view,
REGSET_FP,
402 ret = copy_regset_from_user(child, view,
REGSET_FP,
407 ret = copy_regset_from_user(child, view,
REGSET_FP,
450 tracehook_report_syscall_exit(regs, 0);
452 ret = tracehook_report_syscall_entry(regs);