aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-06-12 03:53:47 -0400
committerArnd Bergmann <arnd@arndb.de>2009-06-12 05:32:58 -0400
commit5b02ee3d219f9e01b6e9146e25613822cfc2e5ce (patch)
tree7ce9126738c3cf4b37d67170d0e4b34818c057a9 /arch/mn10300
parent26a28fa4fea5b8c65713aa50c124f76a88c7924d (diff)
parent8ebf975608aaebd7feb33d77f07ba21a6380e086 (diff)
asm-generic: merge branch 'master' of torvalds/linux-2.6
Fixes a merge conflict against the x86 tree caused by a fix to atomic.h which I renamed to atomic_long.h. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/mn10300')
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/include/asm/elf.h3
-rw-r--r--arch/mn10300/include/asm/processor.h8
-rw-r--r--arch/mn10300/include/asm/ptrace.h8
-rw-r--r--arch/mn10300/kernel/entry.S13
-rw-r--r--arch/mn10300/kernel/ptrace.c454
-rw-r--r--arch/mn10300/kernel/signal.c9
-rw-r--r--arch/mn10300/mm/tlb-mn10300.S18
8 files changed, 257 insertions, 257 deletions
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 355926730e8d..89faacad5d17 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
8config MN10300 8config MN10300
9 def_bool y 9 def_bool y
10 select HAVE_OPROFILE 10 select HAVE_OPROFILE
11 select HAVE_ARCH_TRACEHOOK
11 12
12config AM33 13config AM33
13 def_bool y 14 def_bool y
diff --git a/arch/mn10300/include/asm/elf.h b/arch/mn10300/include/asm/elf.h
index bf09f8bb392e..49105462e6fc 100644
--- a/arch/mn10300/include/asm/elf.h
+++ b/arch/mn10300/include/asm/elf.h
@@ -34,7 +34,7 @@
34 */ 34 */
35typedef unsigned long elf_greg_t; 35typedef unsigned long elf_greg_t;
36 36
37#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 37#define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 1)
38typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 38typedef elf_greg_t elf_gregset_t[ELF_NGREG];
39 39
40#define ELF_NFPREG 32 40#define ELF_NFPREG 32
@@ -76,6 +76,7 @@ do { \
76} while (0) 76} while (0)
77 77
78#define USE_ELF_CORE_DUMP 78#define USE_ELF_CORE_DUMP
79#define CORE_DUMP_USE_REGSET
79#define ELF_EXEC_PAGESIZE 4096 80#define ELF_EXEC_PAGESIZE 4096
80 81
81/* 82/*
diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h
index 73239271873d..f7d4b0d285e8 100644
--- a/arch/mn10300/include/asm/processor.h
+++ b/arch/mn10300/include/asm/processor.h
@@ -143,13 +143,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
143 143
144unsigned long get_wchan(struct task_struct *p); 144unsigned long get_wchan(struct task_struct *p);
145 145
146#define task_pt_regs(task) \ 146#define task_pt_regs(task) ((task)->thread.uregs)
147({ \
148 struct pt_regs *__regs__; \
149 __regs__ = (struct pt_regs *) (KSTK_TOP(task_stack_page(task)) - 8); \
150 __regs__ - 1; \
151})
152
153#define KSTK_EIP(task) (task_pt_regs(task)->pc) 147#define KSTK_EIP(task) (task_pt_regs(task)->pc)
154#define KSTK_ESP(task) (task_pt_regs(task)->sp) 148#define KSTK_ESP(task) (task_pt_regs(task)->sp)
155 149
diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h
index 7b06cc623d8b..921942ed1b03 100644
--- a/arch/mn10300/include/asm/ptrace.h
+++ b/arch/mn10300/include/asm/ptrace.h
@@ -91,9 +91,17 @@ extern struct pt_regs *__frame; /* current frame pointer */
91#if defined(__KERNEL__) 91#if defined(__KERNEL__)
92 92
93#if !defined(__ASSEMBLY__) 93#if !defined(__ASSEMBLY__)
94struct task_struct;
95
94#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) 96#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL)
95#define instruction_pointer(regs) ((regs)->pc) 97#define instruction_pointer(regs) ((regs)->pc)
98#define user_stack_pointer(regs) ((regs)->sp)
96extern void show_regs(struct pt_regs *); 99extern void show_regs(struct pt_regs *);
100
101#define arch_has_single_step() (1)
102extern void user_enable_single_step(struct task_struct *);
103extern void user_disable_single_step(struct task_struct *);
104
97#endif /* !__ASSEMBLY */ 105#endif /* !__ASSEMBLY */
98 106
99#define profile_pc(regs) ((regs)->pc) 107#define profile_pc(regs) ((regs)->pc)
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 3dc3e462f92a..7408a27199f3 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -76,7 +76,7 @@ ENTRY(system_call)
76 cmp nr_syscalls,d0 76 cmp nr_syscalls,d0
77 bcc syscall_badsys 77 bcc syscall_badsys
78 btst _TIF_SYSCALL_TRACE,(TI_flags,a2) 78 btst _TIF_SYSCALL_TRACE,(TI_flags,a2)
79 bne syscall_trace_entry 79 bne syscall_entry_trace
80syscall_call: 80syscall_call:
81 add d0,d0,a1 81 add d0,d0,a1
82 add a1,a1 82 add a1,a1
@@ -104,11 +104,10 @@ restore_all:
104syscall_exit_work: 104syscall_exit_work:
105 btst _TIF_SYSCALL_TRACE,d2 105 btst _TIF_SYSCALL_TRACE,d2
106 beq work_pending 106 beq work_pending
107 __sti # could let do_syscall_trace() call 107 __sti # could let syscall_trace_exit() call
108 # schedule() instead 108 # schedule() instead
109 mov fp,d0 109 mov fp,d0
110 mov 1,d1 110 call syscall_trace_exit[],0 # do_syscall_trace(regs)
111 call do_syscall_trace[],0 # do_syscall_trace(regs,entryexit)
112 jmp resume_userspace 111 jmp resume_userspace
113 112
114 ALIGN 113 ALIGN
@@ -138,13 +137,11 @@ work_notifysig:
138 jmp resume_userspace 137 jmp resume_userspace
139 138
140 # perform syscall entry tracing 139 # perform syscall entry tracing
141syscall_trace_entry: 140syscall_entry_trace:
142 mov -ENOSYS,d0 141 mov -ENOSYS,d0
143 mov d0,(REG_D0,fp) 142 mov d0,(REG_D0,fp)
144 mov fp,d0 143 mov fp,d0
145 clr d1 144 call syscall_trace_entry[],0 # returns the syscall number to actually use
146 call do_syscall_trace[],0
147 mov (REG_ORIG_D0,fp),d0
148 mov (REG_D1,fp),d1 145 mov (REG_D1,fp),d1
149 cmp nr_syscalls,d0 146 cmp nr_syscalls,d0
150 bcs syscall_call 147 bcs syscall_call
diff --git a/arch/mn10300/kernel/ptrace.c b/arch/mn10300/kernel/ptrace.c
index d6d6cdc75c52..e143339ad28e 100644
--- a/arch/mn10300/kernel/ptrace.c
+++ b/arch/mn10300/kernel/ptrace.c
@@ -17,6 +17,9 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/ptrace.h> 18#include <linux/ptrace.h>
19#include <linux/user.h> 19#include <linux/user.h>
20#include <linux/regset.h>
21#include <linux/elf.h>
22#include <linux/tracehook.h>
20#include <asm/uaccess.h> 23#include <asm/uaccess.h>
21#include <asm/pgtable.h> 24#include <asm/pgtable.h>
22#include <asm/system.h> 25#include <asm/system.h>
@@ -64,12 +67,6 @@ static inline int get_stack_long(struct task_struct *task, int offset)
64 ((unsigned long) task->thread.uregs + offset); 67 ((unsigned long) task->thread.uregs + offset);
65} 68}
66 69
67/*
68 * this routine will put a word on the processes privileged stack.
69 * the offset is how far from the base addr as stored in the TSS.
70 * this routine assumes that all the privileged stacks are in our
71 * data space.
72 */
73static inline 70static inline
74int put_stack_long(struct task_struct *task, int offset, unsigned long data) 71int put_stack_long(struct task_struct *task, int offset, unsigned long data)
75{ 72{
@@ -80,94 +77,233 @@ int put_stack_long(struct task_struct *task, int offset, unsigned long data)
80 return 0; 77 return 0;
81} 78}
82 79
83static inline unsigned long get_fpregs(struct fpu_state_struct *buf, 80/*
84 struct task_struct *tsk) 81 * retrieve the contents of MN10300 userspace general registers
82 */
83static int genregs_get(struct task_struct *target,
84 const struct user_regset *regset,
85 unsigned int pos, unsigned int count,
86 void *kbuf, void __user *ubuf)
85{ 87{
86 return __copy_to_user(buf, &tsk->thread.fpu_state, 88 const struct pt_regs *regs = task_pt_regs(target);
87 sizeof(struct fpu_state_struct)); 89 int ret;
90
91 /* we need to skip regs->next */
92 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
93 regs, 0, PT_ORIG_D0 * sizeof(long));
94 if (ret < 0)
95 return ret;
96
97 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
98 &regs->orig_d0, PT_ORIG_D0 * sizeof(long),
99 NR_PTREGS * sizeof(long));
100 if (ret < 0)
101 return ret;
102
103 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
104 NR_PTREGS * sizeof(long), -1);
88} 105}
89 106
90static inline unsigned long set_fpregs(struct task_struct *tsk, 107/*
91 struct fpu_state_struct *buf) 108 * update the contents of the MN10300 userspace general registers
109 */
110static int genregs_set(struct task_struct *target,
111 const struct user_regset *regset,
112 unsigned int pos, unsigned int count,
113 const void *kbuf, const void __user *ubuf)
92{ 114{
93 return __copy_from_user(&tsk->thread.fpu_state, buf, 115 struct pt_regs *regs = task_pt_regs(target);
94 sizeof(struct fpu_state_struct)); 116 unsigned long tmp;
117 int ret;
118
119 /* we need to skip regs->next */
120 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
121 regs, 0, PT_ORIG_D0 * sizeof(long));
122 if (ret < 0)
123 return ret;
124
125 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
126 &regs->orig_d0, PT_ORIG_D0 * sizeof(long),
127 PT_EPSW * sizeof(long));
128 if (ret < 0)
129 return ret;
130
131 /* we need to mask off changes to EPSW */
132 tmp = regs->epsw;
133 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
134 &tmp, PT_EPSW * sizeof(long),
135 PT_PC * sizeof(long));
136 tmp &= EPSW_FLAG_V | EPSW_FLAG_C | EPSW_FLAG_N | EPSW_FLAG_Z;
137 tmp |= regs->epsw & ~(EPSW_FLAG_V | EPSW_FLAG_C | EPSW_FLAG_N |
138 EPSW_FLAG_Z);
139 regs->epsw = tmp;
140
141 if (ret < 0)
142 return ret;
143
144 /* and finally load the PC */
145 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
146 &regs->pc, PT_PC * sizeof(long),
147 NR_PTREGS * sizeof(long));
148
149 if (ret < 0)
150 return ret;
151
152 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
153 NR_PTREGS * sizeof(long), -1);
95} 154}
96 155
97static inline void fpsave_init(struct task_struct *task) 156/*
157 * retrieve the contents of MN10300 userspace FPU registers
158 */
159static int fpuregs_get(struct task_struct *target,
160 const struct user_regset *regset,
161 unsigned int pos, unsigned int count,
162 void *kbuf, void __user *ubuf)
98{ 163{
99 memset(&task->thread.fpu_state, 0, sizeof(struct fpu_state_struct)); 164 const struct fpu_state_struct *fpregs = &target->thread.fpu_state;
165 int ret;
166
167 unlazy_fpu(target);
168
169 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
170 fpregs, 0, sizeof(*fpregs));
171 if (ret < 0)
172 return ret;
173
174 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
175 sizeof(*fpregs), -1);
100} 176}
101 177
102/* 178/*
103 * make sure the single step bit is not set 179 * update the contents of the MN10300 userspace FPU registers
104 */ 180 */
105void ptrace_disable(struct task_struct *child) 181static int fpuregs_set(struct task_struct *target,
182 const struct user_regset *regset,
183 unsigned int pos, unsigned int count,
184 const void *kbuf, const void __user *ubuf)
185{
186 struct fpu_state_struct fpu_state = target->thread.fpu_state;
187 int ret;
188
189 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
190 &fpu_state, 0, sizeof(fpu_state));
191 if (ret < 0)
192 return ret;
193
194 fpu_kill_state(target);
195 target->thread.fpu_state = fpu_state;
196 set_using_fpu(target);
197
198 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
199 sizeof(fpu_state), -1);
200}
201
202/*
203 * determine if the FPU registers have actually been used
204 */
205static int fpuregs_active(struct task_struct *target,
206 const struct user_regset *regset)
207{
208 return is_using_fpu(target) ? regset->n : 0;
209}
210
211/*
212 * Define the register sets available on the MN10300 under Linux
213 */
214enum mn10300_regset {
215 REGSET_GENERAL,
216 REGSET_FPU,
217};
218
219static const struct user_regset mn10300_regsets[] = {
220 /*
221 * General register format is:
222 * A3, A2, D3, D2, MCVF, MCRL, MCRH, MDRQ
223 * E1, E0, E7...E2, SP, LAR, LIR, MDR
224 * A1, A0, D1, D0, ORIG_D0, EPSW, PC
225 */
226 [REGSET_GENERAL] = {
227 .core_note_type = NT_PRSTATUS,
228 .n = ELF_NGREG,
229 .size = sizeof(long),
230 .align = sizeof(long),
231 .get = genregs_get,
232 .set = genregs_set,
233 },
234 /*
235 * FPU register format is:
236 * FS0-31, FPCR
237 */
238 [REGSET_FPU] = {
239 .core_note_type = NT_PRFPREG,
240 .n = sizeof(struct fpu_state_struct) / sizeof(long),
241 .size = sizeof(long),
242 .align = sizeof(long),
243 .get = fpuregs_get,
244 .set = fpuregs_set,
245 .active = fpuregs_active,
246 },
247};
248
249static const struct user_regset_view user_mn10300_native_view = {
250 .name = "mn10300",
251 .e_machine = EM_MN10300,
252 .regsets = mn10300_regsets,
253 .n = ARRAY_SIZE(mn10300_regsets),
254};
255
256const struct user_regset_view *task_user_regset_view(struct task_struct *task)
257{
258 return &user_mn10300_native_view;
259}
260
261/*
262 * set the single-step bit
263 */
264void user_enable_single_step(struct task_struct *child)
106{ 265{
107#ifndef CONFIG_MN10300_USING_JTAG 266#ifndef CONFIG_MN10300_USING_JTAG
108 struct user *dummy = NULL; 267 struct user *dummy = NULL;
109 long tmp; 268 long tmp;
110 269
111 tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw); 270 tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw);
112 tmp &= ~EPSW_T; 271 tmp |= EPSW_T;
113 put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp); 272 put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp);
114#endif 273#endif
115} 274}
116 275
117/* 276/*
118 * set the single step bit 277 * make sure the single-step bit is not set
119 */ 278 */
120void ptrace_enable(struct task_struct *child) 279void user_disable_single_step(struct task_struct *child)
121{ 280{
122#ifndef CONFIG_MN10300_USING_JTAG 281#ifndef CONFIG_MN10300_USING_JTAG
123 struct user *dummy = NULL; 282 struct user *dummy = NULL;
124 long tmp; 283 long tmp;
125 284
126 tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw); 285 tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw);
127 tmp |= EPSW_T; 286 tmp &= ~EPSW_T;
128 put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp); 287 put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp);
129#endif 288#endif
130} 289}
131 290
291void ptrace_disable(struct task_struct *child)
292{
293 user_disable_single_step(child);
294}
295
132/* 296/*
133 * handle the arch-specific side of process tracing 297 * handle the arch-specific side of process tracing
134 */ 298 */
135long arch_ptrace(struct task_struct *child, long request, long addr, long data) 299long arch_ptrace(struct task_struct *child, long request, long addr, long data)
136{ 300{
137 struct fpu_state_struct fpu_state; 301 unsigned long tmp;
138 int i, ret; 302 int ret;
139 303
140 switch (request) { 304 switch (request) {
141 /* read the word at location addr. */
142 case PTRACE_PEEKTEXT: {
143 unsigned long tmp;
144 int copied;
145
146 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
147 ret = -EIO;
148 if (copied != sizeof(tmp))
149 break;
150 ret = put_user(tmp, (unsigned long *) data);
151 break;
152 }
153
154 /* read the word at location addr. */
155 case PTRACE_PEEKDATA: {
156 unsigned long tmp;
157 int copied;
158
159 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
160 ret = -EIO;
161 if (copied != sizeof(tmp))
162 break;
163 ret = put_user(tmp, (unsigned long *) data);
164 break;
165 }
166
167 /* read the word at location addr in the USER area. */ 305 /* read the word at location addr in the USER area. */
168 case PTRACE_PEEKUSR: { 306 case PTRACE_PEEKUSR:
169 unsigned long tmp;
170
171 ret = -EIO; 307 ret = -EIO;
172 if ((addr & 3) || addr < 0 || 308 if ((addr & 3) || addr < 0 ||
173 addr > sizeof(struct user) - 3) 309 addr > sizeof(struct user) - 3)
@@ -179,17 +315,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
179 ptrace_regid_to_frame[addr]); 315 ptrace_regid_to_frame[addr]);
180 ret = put_user(tmp, (unsigned long *) data); 316 ret = put_user(tmp, (unsigned long *) data);
181 break; 317 break;
182 }
183
184 /* write the word at location addr. */
185 case PTRACE_POKETEXT:
186 case PTRACE_POKEDATA:
187 if (access_process_vm(child, addr, &data, sizeof(data), 1) ==
188 sizeof(data))
189 ret = 0;
190 else
191 ret = -EIO;
192 break;
193 318
194 /* write the word at location addr in the USER area */ 319 /* write the word at location addr in the USER area */
195 case PTRACE_POKEUSR: 320 case PTRACE_POKEUSR:
@@ -204,132 +329,32 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
204 data); 329 data);
205 break; 330 break;
206 331
207 /* continue and stop at next (return from) syscall */ 332 case PTRACE_GETREGS: /* Get all integer regs from the child. */
208 case PTRACE_SYSCALL: 333 return copy_regset_to_user(child, &user_mn10300_native_view,
209 /* restart after signal. */ 334 REGSET_GENERAL,
210 case PTRACE_CONT: 335 0, NR_PTREGS * sizeof(long),
211 ret = -EIO; 336 (void __user *)data);
212 if ((unsigned long) data > _NSIG) 337
213 break; 338 case PTRACE_SETREGS: /* Set all integer regs in the child. */
214 if (request == PTRACE_SYSCALL) 339 return copy_regset_from_user(child, &user_mn10300_native_view,
215 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 340 REGSET_GENERAL,
216 else 341 0, NR_PTREGS * sizeof(long),
217 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 342 (const void __user *)data);
218 child->exit_code = data; 343
219 ptrace_disable(child); 344 case PTRACE_GETFPREGS: /* Get the child FPU state. */
220 wake_up_process(child); 345 return copy_regset_to_user(child, &user_mn10300_native_view,
221 ret = 0; 346 REGSET_FPU,
222 break; 347 0, sizeof(struct fpu_state_struct),
223 348 (void __user *)data);
224 /* 349
225 * make the child exit 350 case PTRACE_SETFPREGS: /* Set the child FPU state. */
226 * - the best I can do is send it a sigkill 351 return copy_regset_from_user(child, &user_mn10300_native_view,
227 * - perhaps it should be put in the status that it wants to 352 REGSET_FPU,
228 * exit 353 0, sizeof(struct fpu_state_struct),
229 */ 354 (const void __user *)data);
230 case PTRACE_KILL:
231 ret = 0;
232 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
233 break;
234 child->exit_code = SIGKILL;
235 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
236 ptrace_disable(child);
237 wake_up_process(child);
238 break;
239
240 case PTRACE_SINGLESTEP: /* set the trap flag. */
241#ifndef CONFIG_MN10300_USING_JTAG
242 ret = -EIO;
243 if ((unsigned long) data > _NSIG)
244 break;
245 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
246 ptrace_enable(child);
247 child->exit_code = data;
248 wake_up_process(child);
249 ret = 0;
250#else
251 ret = -EINVAL;
252#endif
253 break;
254
255 case PTRACE_DETACH: /* detach a process that was attached. */
256 ret = ptrace_detach(child, data);
257 break;
258
259 /* Get all gp regs from the child. */
260 case PTRACE_GETREGS: {
261 unsigned long tmp;
262
263 if (!access_ok(VERIFY_WRITE, (unsigned *) data, NR_PTREGS << 2)) {
264 ret = -EIO;
265 break;
266 }
267
268 for (i = 0; i < NR_PTREGS << 2; i += 4) {
269 tmp = get_stack_long(child, ptrace_regid_to_frame[i]);
270 __put_user(tmp, (unsigned long *) data);
271 data += sizeof(tmp);
272 }
273 ret = 0;
274 break;
275 }
276
277 case PTRACE_SETREGS: { /* Set all gp regs in the child. */
278 unsigned long tmp;
279
280 if (!access_ok(VERIFY_READ, (unsigned long *)data,
281 sizeof(struct pt_regs))) {
282 ret = -EIO;
283 break;
284 }
285
286 for (i = 0; i < NR_PTREGS << 2; i += 4) {
287 __get_user(tmp, (unsigned long *) data);
288 put_stack_long(child, ptrace_regid_to_frame[i], tmp);
289 data += sizeof(tmp);
290 }
291 ret = 0;
292 break;
293 }
294
295 case PTRACE_GETFPREGS: { /* Get the child FPU state. */
296 if (is_using_fpu(child)) {
297 unlazy_fpu(child);
298 fpu_state = child->thread.fpu_state;
299 } else {
300 memset(&fpu_state, 0, sizeof(fpu_state));
301 }
302
303 ret = -EIO;
304 if (copy_to_user((void *) data, &fpu_state,
305 sizeof(fpu_state)) == 0)
306 ret = 0;
307 break;
308 }
309
310 case PTRACE_SETFPREGS: { /* Set the child FPU state. */
311 ret = -EFAULT;
312 if (copy_from_user(&fpu_state, (const void *) data,
313 sizeof(fpu_state)) == 0) {
314 fpu_kill_state(child);
315 child->thread.fpu_state = fpu_state;
316 set_using_fpu(child);
317 ret = 0;
318 }
319 break;
320 }
321
322 case PTRACE_SETOPTIONS: {
323 if (data & PTRACE_O_TRACESYSGOOD)
324 child->ptrace |= PT_TRACESYSGOOD;
325 else
326 child->ptrace &= ~PT_TRACESYSGOOD;
327 ret = 0;
328 break;
329 }
330 355
331 default: 356 default:
332 ret = -EIO; 357 ret = ptrace_request(child, request, addr, data);
333 break; 358 break;
334 } 359 }
335 360
@@ -337,43 +362,26 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
337} 362}
338 363
339/* 364/*
340 * notification of system call entry/exit 365 * handle tracing of system call entry
341 * - triggered by current->work.syscall_trace 366 * - return the revised system call number or ULONG_MAX to cause ENOSYS
342 */ 367 */
343asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) 368asmlinkage unsigned long syscall_trace_entry(struct pt_regs *regs)
344{ 369{
345#if 0 370 if (tracehook_report_syscall_entry(regs))
346 /* just in case... */ 371 /* tracing decided this syscall should not happen, so
347 printk(KERN_DEBUG "[%d] syscall_%lu(%lx,%lx,%lx,%lx) = %lx\n", 372 * We'll return a bogus call number to get an ENOSYS
348 current->pid, 373 * error, but leave the original number in
349 regs->orig_d0, 374 * regs->orig_d0
350 regs->a0, 375 */
351 regs->d1, 376 return ULONG_MAX;
352 regs->a3,
353 regs->a2,
354 regs->d0);
355 return;
356#endif
357
358 if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
359 !test_thread_flag(TIF_SINGLESTEP))
360 return;
361 if (!(current->ptrace & PT_PTRACED))
362 return;
363 377
364 /* the 0x80 provides a way for the tracing parent to distinguish 378 return regs->orig_d0;
365 between a syscall stop and SIGTRAP delivery */ 379}
366 ptrace_notify(SIGTRAP |
367 ((current->ptrace & PT_TRACESYSGOOD) &&
368 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
369 380
370 /* 381/*
371 * this isn't the same as continuing with a signal, but it will do 382 * handle tracing of system call exit
372 * for normal use. strace only continues with a signal if the 383 */
373 * stopping signal is not SIGTRAP. -brl 384asmlinkage void syscall_trace_exit(struct pt_regs *regs)
374 */ 385{
375 if (current->exit_code) { 386 tracehook_report_syscall_exit(regs, 0);
376 send_sig(current->exit_code, current, 1);
377 current->exit_code = 0;
378 }
379} 387}
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index 841ca9955a18..9f7572a0f578 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -23,6 +23,7 @@
23#include <linux/tty.h> 23#include <linux/tty.h>
24#include <linux/personality.h> 24#include <linux/personality.h>
25#include <linux/suspend.h> 25#include <linux/suspend.h>
26#include <linux/tracehook.h>
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
27#include <asm/ucontext.h> 28#include <asm/ucontext.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -511,6 +512,9 @@ static void do_signal(struct pt_regs *regs)
511 * clear the TIF_RESTORE_SIGMASK flag */ 512 * clear the TIF_RESTORE_SIGMASK flag */
512 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 513 if (test_thread_flag(TIF_RESTORE_SIGMASK))
513 clear_thread_flag(TIF_RESTORE_SIGMASK); 514 clear_thread_flag(TIF_RESTORE_SIGMASK);
515
516 tracehook_signal_handler(signr, &info, &ka, regs,
517 test_thread_flag(TIF_SINGLESTEP));
514 } 518 }
515 519
516 return; 520 return;
@@ -561,4 +565,9 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
561 /* deal with pending signal delivery */ 565 /* deal with pending signal delivery */
562 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 566 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
563 do_signal(regs); 567 do_signal(regs);
568
569 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
570 clear_thread_flag(TIF_NOTIFY_RESUME);
571 tracehook_notify_resume(__frame);
572 }
564} 573}
diff --git a/arch/mn10300/mm/tlb-mn10300.S b/arch/mn10300/mm/tlb-mn10300.S
index 789208094e98..7095147dcb8b 100644
--- a/arch/mn10300/mm/tlb-mn10300.S
+++ b/arch/mn10300/mm/tlb-mn10300.S
@@ -165,24 +165,6 @@ ENTRY(itlb_aerror)
165ENTRY(dtlb_aerror) 165ENTRY(dtlb_aerror)
166 and ~EPSW_NMID,epsw 166 and ~EPSW_NMID,epsw
167 add -4,sp 167 add -4,sp
168 mov d1,(sp)
169
170 movhu (MMUFCR_DFC),d1 # is it the initial valid write
171 # to this page?
172 and MMUFCR_xFC_INITWR,d1
173 beq dtlb_pagefault # jump if not
174
175 mov (DPTEL),d1 # set the dirty bit
176 # (don't replace with BSET!)
177 or _PAGE_DIRTY,d1
178 mov d1,(DPTEL)
179 mov (sp),d1
180 add 4,sp
181 rti
182
183 ALIGN
184dtlb_pagefault:
185 mov (sp),d1
186 SAVE_ALL 168 SAVE_ALL
187 add -4,sp # need to pass three params 169 add -4,sp # need to pass three params
188 170