8 #include <linux/kernel.h>
9 #include <linux/sched.h>
12 #include <linux/elf.h>
13 #include <linux/errno.h>
14 #include <linux/ptrace.h>
17 #include <linux/signal.h>
22 #include <asm/pgtable.h>
23 #include <asm/processor.h>
24 #include <asm/asm-offsets.h>
27 #include <asm/cacheflush.h>
29 #include <asm/mmu_context.h>
41 unsigned long __user *datap)
51 tmp = task->
mm->start_code;
54 tmp = task->
mm->end_code;
57 tmp = task->
mm->start_data;
63 if (regno <
sizeof(*regs)) {
65 tmp = *(
long *)(reg_ptr + regno);
77 put_reg(
struct task_struct *task,
unsigned long regno,
unsigned long data)
100 if ((data & ~1) != 0x6)
101 pr_warning(
"ptrace: ignore syscfg write of %#lx\n", data);
104 if (regno <
sizeof(*regs)) {
105 void *reg_offset =
regs;
106 *(
long *)(reg_offset + regno) =
data;
124 if (start + len < start)
128 if (vma && start >= vma->
vm_start && start + len <= vma->vm_end)
131 for (sraml = child->
mm->context.sram_list; sraml; sraml = sraml->
next)
132 if (start >= (
unsigned long)sraml->
addr
133 && start + len < (
unsigned long)sraml->
addr + sraml->
length)
139 #ifdef CONFIG_APP_STACK_L1
140 if (child->
mm->context.l1_stack_save)
154 unsigned int pos,
unsigned int count,
155 void *kbuf,
void __user *ubuf)
163 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
164 regs, 0,
sizeof(*regs));
168 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
177 unsigned int pos,
unsigned int count,
178 const void *kbuf,
const void __user *ubuf)
184 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
193 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
207 .n =
sizeof(
struct pt_regs) / sizeof(long),
208 .size =
sizeof(
long),
209 .
align =
sizeof(
long),
218 .regsets = bfin_regsets,
224 return &user_bfin_native_view;
244 unsigned long addr,
unsigned long data)
247 unsigned long __user *datap = (
unsigned long __user *)data;
248 void *
paddr = (
void *)addr;
257 unsigned long tmp = 0;
258 int copied = 0, to_copy =
sizeof(
tmp);
261 pr_debug(
"ptrace: PEEKTEXT at addr 0x%08lx + %i\n", addr, to_copy);
264 pr_debug(
"ptrace: user address is valid\n");
280 memcpy(&tmp, paddr, to_copy);
298 pr_debug(
"ptrace: copied size %d [0x%08lx]\n", copied, tmp);
299 if (copied == to_copy)
306 pr_debug(
"ptrace: PTRACE_PEEKDATA\n");
310 int copied = 0, to_copy =
sizeof(
data);
313 pr_debug(
"ptrace: POKETEXT at addr 0x%08lx + %i bytes %lx\n",
314 addr, to_copy, data);
317 pr_debug(
"ptrace: user address is valid\n");
338 pr_debug(
"ptrace: copied size %d\n", copied);
339 if (copied == to_copy)
346 #ifdef CONFIG_BINFMT_ELF_FDPIC
357 ret = get_reg(child, addr, datap);
359 pr_debug(
"ptrace: PEEKUSR reg %li with %#lx = %i\n", addr, data, ret);
363 ret = put_reg(child, addr, data);
364 pr_debug(
"ptrace: POKEUSR reg %li with %li = %i\n", addr, data, ret);
368 pr_debug(
"ptrace: PTRACE_GETREGS\n");
369 return copy_regset_to_user(child, &user_bfin_native_view,
375 pr_debug(
"ptrace: PTRACE_SETREGS\n");
376 return copy_regset_from_user(child, &user_bfin_native_view,
395 ret = tracehook_report_syscall_entry(regs);
406 tracehook_report_syscall_exit(regs, step);