aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/h8300/kernel/ptrace.c')
-rw-r--r--arch/h8300/kernel/ptrace.c82
1 files changed, 7 insertions, 75 deletions
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
index d32bbf02fc4..df114122ebd 100644
--- a/arch/h8300/kernel/ptrace.c
+++ b/arch/h8300/kernel/ptrace.c
@@ -34,25 +34,20 @@
34/* cpu depend functions */ 34/* cpu depend functions */
35extern long h8300_get_reg(struct task_struct *task, int regno); 35extern long h8300_get_reg(struct task_struct *task, int regno);
36extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data); 36extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data);
37extern void h8300_disable_trace(struct task_struct *child); 37
38extern void h8300_enable_trace(struct task_struct *child); 38
39void user_disable_single_step(struct task_struct *child)
40{
41}
39 42
40/* 43/*
41 * does not yet catch signals sent when the child dies. 44 * does not yet catch signals sent when the child dies.
42 * in exit.c or in signal.c. 45 * in exit.c or in signal.c.
43 */ 46 */
44 47
45inline
46static int read_long(struct task_struct * tsk, unsigned long addr,
47 unsigned long * result)
48{
49 *result = *(unsigned long *)addr;
50 return 0;
51}
52
53void ptrace_disable(struct task_struct *child) 48void ptrace_disable(struct task_struct *child)
54{ 49{
55 h8300_disable_trace(child); 50 user_disable_single_step(child);
56} 51}
57 52
58long arch_ptrace(struct task_struct *child, long request, long addr, long data) 53long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -60,17 +55,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
60 int ret; 55 int ret;
61 56
62 switch (request) { 57 switch (request) {
63 case PTRACE_PEEKTEXT: /* read word at location addr. */
64 case PTRACE_PEEKDATA: {
65 unsigned long tmp;
66
67 ret = read_long(child, addr, &tmp);
68 if (ret < 0)
69 break ;
70 ret = put_user(tmp, (unsigned long *) data);
71 break ;
72 }
73
74 /* read the word at location addr in the USER area. */ 58 /* read the word at location addr in the USER area. */
75 case PTRACE_PEEKUSR: { 59 case PTRACE_PEEKUSR: {
76 unsigned long tmp = 0; 60 unsigned long tmp = 0;
@@ -109,11 +93,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
109 } 93 }
110 94
111 /* when I and D space are separate, this will have to be fixed. */ 95 /* when I and D space are separate, this will have to be fixed. */
112 case PTRACE_POKETEXT: /* write the word at location addr. */
113 case PTRACE_POKEDATA:
114 ret = generic_ptrace_pokedata(child, addr, data);
115 break;
116
117 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 96 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
118 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 97 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
119 ret = -EIO; 98 ret = -EIO;
@@ -131,53 +110,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
131 } 110 }
132 ret = -EIO; 111 ret = -EIO;
133 break ; 112 break ;
134 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
135 case PTRACE_CONT: { /* restart after signal. */
136 ret = -EIO;
137 if (!valid_signal(data))
138 break ;
139 if (request == PTRACE_SYSCALL)
140 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
141 else
142 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
143 child->exit_code = data;
144 wake_up_process(child);
145 /* make sure the single step bit is not set. */
146 h8300_disable_trace(child);
147 ret = 0;
148 }
149
150/*
151 * make the child exit. Best I can do is send it a sigkill.
152 * perhaps it should be put in the status that it wants to
153 * exit.
154 */
155 case PTRACE_KILL: {
156
157 ret = 0;
158 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
159 break;
160 child->exit_code = SIGKILL;
161 h8300_disable_trace(child);
162 wake_up_process(child);
163 break;
164 }
165
166 case PTRACE_SINGLESTEP: { /* set the trap flag. */
167 ret = -EIO;
168 if (!valid_signal(data))
169 break;
170 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
171 child->exit_code = data;
172 h8300_enable_trace(child);
173 wake_up_process(child);
174 ret = 0;
175 break;
176 }
177
178 case PTRACE_DETACH: /* detach a process that was attached. */
179 ret = ptrace_detach(child, data);
180 break;
181 113
182 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 114 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
183 int i; 115 int i;
@@ -210,7 +142,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
210 } 142 }
211 143
212 default: 144 default:
213 ret = -EIO; 145 ret = ptrace_request(child, request, addr, data);
214 break; 146 break;
215 } 147 }
216 return ret; 148 return ret;