18 #include <linux/kernel.h>
20 #include <linux/sched.h>
23 #include <linux/bitops.h>
24 #include <linux/errno.h>
25 #include <linux/ptrace.h>
27 #include <linux/signal.h>
29 #include <linux/audit.h>
30 #include <linux/seccomp.h>
32 #include <linux/elf.h>
35 #include <asm/uaccess.h>
36 #include <asm/pgtable.h>
37 #include <asm/processor.h>
38 #include <asm/mmu_context.h>
39 #include <asm/syscalls.h>
41 #include <asm/traps.h>
43 #define CREATE_TRACE_POINTS
48 #define SR_MASK (0xffff8cfd)
62 stack = (
unsigned char *)(task->
thread.uregs);
64 return (*((
int *)stack));
67 static inline unsigned long
91 tmp = ((
long *)task->
thread.xstate)[addr /
sizeof(
unsigned long)];
101 unsigned char *
stack;
103 stack = (
unsigned char *)(task->
thread.uregs);
105 *(
unsigned long *) stack = data;
110 put_fpu_long(
struct task_struct *task,
unsigned long addr,
unsigned long data)
126 ((
long *)task->
thread.xstate)[addr /
sizeof(
unsigned long)] = data;
150 unsigned int pos,
unsigned int count,
151 void *kbuf,
void __user *ubuf)
157 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
159 0, 3 *
sizeof(
unsigned long long));
163 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
166 63 *
sizeof(
unsigned long long));
169 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
172 8 *
sizeof(
unsigned long long));
175 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
183 unsigned int pos,
unsigned int count,
184 const void *kbuf,
const void __user *ubuf)
190 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
192 0, 3 *
sizeof(
unsigned long long));
195 if (!ret && count > 0)
196 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
199 63 *
sizeof(
unsigned long long));
202 if (!ret && count > 0)
203 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
206 8 *
sizeof(
unsigned long long));
209 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
218 unsigned int pos,
unsigned int count,
219 void *kbuf,
void __user *ubuf)
227 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
228 &target->
thread.xstate->hardfpu, 0, -1);
233 unsigned int pos,
unsigned int count,
234 const void *kbuf,
const void __user *ubuf)
244 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
245 &target->
thread.xstate->hardfpu, 0, -1);
354 .size =
sizeof(
long long),
355 .
align =
sizeof(
long long),
366 .
align =
sizeof(
long long),
377 .regsets = sh_regsets,
383 return &user_sh64_native_view;
387 unsigned long addr,
unsigned long data)
390 unsigned long __user *datap = (
unsigned long __user *) data;
398 if ((addr & 3) || addr < 0)
401 if (addr <
sizeof(
struct pt_regs))
402 tmp = get_stack_long(child, addr);
410 tmp = get_fpu_long(child, index);
426 if ((addr & 3) || addr < 0)
429 if (addr <
sizeof(
struct pt_regs)) {
439 long cursr = get_stack_long(child, addr);
443 ret = put_stack_long(child, addr, data);
452 ret = put_fpu_long(child, index, data);
457 return copy_regset_to_user(child, &user_sh64_native_view,
462 return copy_regset_from_user(child, &user_sh64_native_view,
468 return copy_regset_to_user(child, &user_sh64_native_view,
473 return copy_regset_from_user(child, &user_sh64_native_view,
487 unsigned long addr,
unsigned long data)
489 #define WPC_DBRMODE 0x0d104008
490 static unsigned long first_call;
500 printk(
"DBRMODE set to 0 to permit native debugging\n");
507 static inline int audit_arch(
void)
514 #ifdef CONFIG_CPU_LITTLE_ENDIAN
525 secure_computing_strict(regs->
regs[9]);
528 tracehook_report_syscall_entry(regs))
537 trace_sys_enter(regs, regs->
regs[9]);
539 audit_syscall_entry(audit_arch(), regs->
regs[1],
543 return ret ?: regs->
regs[9];
550 audit_syscall_exit(regs);
553 trace_sys_exit(regs, regs->
regs[9]);
557 tracehook_report_syscall_exit(regs, step);