5 #include <linux/kernel.h>
6 #include <linux/sched.h>
9 #include <linux/errno.h>
10 #include <linux/ptrace.h>
12 #include <linux/signal.h>
15 #include <asm/uaccess.h>
17 #include <asm/pgtable.h>
18 #include <asm/processor.h>
25 #define CCS_MASK 0x00087c00
27 #define SBIT_USER (1 << (S_CCS_BITNR + CCS_SHIFT))
29 static int put_debugreg(
long pid,
unsigned int regno,
long data);
30 static long get_debugreg(
long pid,
unsigned int regno);
51 ret = get_pseudo_pc(task);
53 ret = get_debugreg(task->
pid, regno);
69 else if (regno ==
PT_PPC) {
71 if (data != get_pseudo_pc(task))
73 }
else if (regno <=
PT_MAX)
74 return put_debugreg(task->
pid, regno, data);
127 unsigned long addr,
unsigned long data)
130 unsigned int regno = addr >> 2;
131 unsigned long __user *datap = (
unsigned long __user *)data;
148 tmp = *(
unsigned long*)addr;
152 if (copied !=
sizeof(tmp))
165 if ((addr & 3) || regno >
PT_MAX)
182 if ((addr & 3) || regno >
PT_MAX)
192 if (
put_reg(child, regno, data))
202 for (i = 0; i <=
PT_MAX; i++) {
222 for (i = 0; i <=
PT_MAX; i++) {
283 if (copied !=
sizeof(opcode))
286 switch ((opcode & 0x0f00) >> 8) {
298 if ((opcode & 0xff) == 0xff)
304 panic(
"ERROR: Couldn't find size of opcode 0x%lx at 0x%lx\n",
311 static unsigned long get_pseudo_pc(
struct task_struct *child)
334 static long bp_owner = 0;
345 for (bp = 0; bp < 6; bp++) {
348 put_debugreg(pid,
PT_BP + 3 + (bp * 2), 0);
349 put_debugreg(pid,
PT_BP + 4 + (bp * 2), 0);
352 tmp = get_debugreg(pid,
PT_BP_CTRL) & ~(3 << (2 + (bp * 4)));
359 static int put_debugreg(
long pid,
unsigned int regno,
long data)
362 register int old_srs;
364 #ifdef CONFIG_ETRAX_KGDB
367 return (data == 0) ? ret : -1;
373 else if (bp_owner != pid) {
376 return (data == 0) ? ret : -1;
384 switch (regno -
PT_BP) {
431 static long get_debugreg(
long pid,
unsigned int regno)
433 register int old_srs;
436 if (pid != bp_owner) {
445 switch (regno -
PT_BP) {