diff options
Diffstat (limited to 'arch/h8300')
-rw-r--r-- | arch/h8300/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/h8300/include/asm/unistd.h | 3 | ||||
-rw-r--r-- | arch/h8300/kernel/ptrace.c | 82 | ||||
-rw-r--r-- | arch/h8300/kernel/sys_h8300.c | 138 | ||||
-rw-r--r-- | arch/h8300/kernel/syscalls.S | 4 | ||||
-rw-r--r-- | arch/h8300/platform/h8300h/ptrace_h8300h.c | 6 | ||||
-rw-r--r-- | arch/h8300/platform/h8s/ptrace_h8s.c | 4 |
7 files changed, 19 insertions, 220 deletions
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h index c2e05e4b512..d866c0efba8 100644 --- a/arch/h8300/include/asm/ptrace.h +++ b/arch/h8300/include/asm/ptrace.h | |||
@@ -55,6 +55,8 @@ struct pt_regs { | |||
55 | /* Find the stack offset for a register, relative to thread.esp0. */ | 55 | /* Find the stack offset for a register, relative to thread.esp0. */ |
56 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) | 56 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) |
57 | 57 | ||
58 | #define arch_has_single_step() (1) | ||
59 | |||
58 | #define user_mode(regs) (!((regs)->ccr & PS_S)) | 60 | #define user_mode(regs) (!((regs)->ccr & PS_S)) |
59 | #define instruction_pointer(regs) ((regs)->pc) | 61 | #define instruction_pointer(regs) ((regs)->pc) |
60 | #define profile_pc(regs) instruction_pointer(regs) | 62 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h index 99f3c3561ec..50f2c5a3659 100644 --- a/arch/h8300/include/asm/unistd.h +++ b/arch/h8300/include/asm/unistd.h | |||
@@ -336,6 +336,7 @@ | |||
336 | #define __ARCH_WANT_STAT64 | 336 | #define __ARCH_WANT_STAT64 |
337 | #define __ARCH_WANT_SYS_ALARM | 337 | #define __ARCH_WANT_SYS_ALARM |
338 | #define __ARCH_WANT_SYS_GETHOSTNAME | 338 | #define __ARCH_WANT_SYS_GETHOSTNAME |
339 | #define __ARCH_WANT_SYS_IPC | ||
339 | #define __ARCH_WANT_SYS_PAUSE | 340 | #define __ARCH_WANT_SYS_PAUSE |
340 | #define __ARCH_WANT_SYS_SGETMASK | 341 | #define __ARCH_WANT_SYS_SGETMASK |
341 | #define __ARCH_WANT_SYS_SIGNAL | 342 | #define __ARCH_WANT_SYS_SIGNAL |
@@ -348,6 +349,8 @@ | |||
348 | #define __ARCH_WANT_SYS_LLSEEK | 349 | #define __ARCH_WANT_SYS_LLSEEK |
349 | #define __ARCH_WANT_SYS_NICE | 350 | #define __ARCH_WANT_SYS_NICE |
350 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 351 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
352 | #define __ARCH_WANT_SYS_OLD_MMAP | ||
353 | #define __ARCH_WANT_SYS_OLD_SELECT | ||
351 | #define __ARCH_WANT_SYS_OLDUMOUNT | 354 | #define __ARCH_WANT_SYS_OLDUMOUNT |
352 | #define __ARCH_WANT_SYS_SIGPENDING | 355 | #define __ARCH_WANT_SYS_SIGPENDING |
353 | #define __ARCH_WANT_SYS_SIGPROCMASK | 356 | #define __ARCH_WANT_SYS_SIGPROCMASK |
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 */ |
35 | extern long h8300_get_reg(struct task_struct *task, int regno); | 35 | extern long h8300_get_reg(struct task_struct *task, int regno); |
36 | extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data); | 36 | extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data); |
37 | extern void h8300_disable_trace(struct task_struct *child); | 37 | |
38 | extern void h8300_enable_trace(struct task_struct *child); | 38 | |
39 | void 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 | ||
45 | inline | ||
46 | static 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 | |||
53 | void ptrace_disable(struct task_struct *child) | 48 | void ptrace_disable(struct task_struct *child) |
54 | { | 49 | { |
55 | h8300_disable_trace(child); | 50 | user_disable_single_step(child); |
56 | } | 51 | } |
57 | 52 | ||
58 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 53 | long 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; |
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c index b5969db0ca1..f9b3f44da69 100644 --- a/arch/h8300/kernel/sys_h8300.c +++ b/arch/h8300/kernel/sys_h8300.c | |||
@@ -26,144 +26,6 @@ | |||
26 | #include <asm/traps.h> | 26 | #include <asm/traps.h> |
27 | #include <asm/unistd.h> | 27 | #include <asm/unistd.h> |
28 | 28 | ||
29 | /* | ||
30 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
31 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | ||
32 | * handle more than 4 system call parameters, so these system calls | ||
33 | * used a memory block for parameter passing.. | ||
34 | */ | ||
35 | |||
36 | struct mmap_arg_struct { | ||
37 | unsigned long addr; | ||
38 | unsigned long len; | ||
39 | unsigned long prot; | ||
40 | unsigned long flags; | ||
41 | unsigned long fd; | ||
42 | unsigned long offset; | ||
43 | }; | ||
44 | |||
45 | asmlinkage int old_mmap(struct mmap_arg_struct *arg) | ||
46 | { | ||
47 | struct mmap_arg_struct a; | ||
48 | int error = -EFAULT; | ||
49 | |||
50 | if (copy_from_user(&a, arg, sizeof(a))) | ||
51 | goto out; | ||
52 | |||
53 | error = -EINVAL; | ||
54 | if (a.offset & ~PAGE_MASK) | ||
55 | goto out; | ||
56 | |||
57 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | ||
58 | a.offset >> PAGE_SHIFT); | ||
59 | out: | ||
60 | return error; | ||
61 | } | ||
62 | |||
63 | struct sel_arg_struct { | ||
64 | unsigned long n; | ||
65 | fd_set *inp, *outp, *exp; | ||
66 | struct timeval *tvp; | ||
67 | }; | ||
68 | |||
69 | asmlinkage int old_select(struct sel_arg_struct *arg) | ||
70 | { | ||
71 | struct sel_arg_struct a; | ||
72 | |||
73 | if (copy_from_user(&a, arg, sizeof(a))) | ||
74 | return -EFAULT; | ||
75 | /* sys_select() does the appropriate kernel locking */ | ||
76 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | ||
81 | * | ||
82 | * This is really horribly ugly. | ||
83 | */ | ||
84 | asmlinkage int sys_ipc (uint call, int first, int second, | ||
85 | int third, void *ptr, long fifth) | ||
86 | { | ||
87 | int version, ret; | ||
88 | |||
89 | version = call >> 16; /* hack for backward compatibility */ | ||
90 | call &= 0xffff; | ||
91 | |||
92 | if (call <= SEMCTL) | ||
93 | switch (call) { | ||
94 | case SEMOP: | ||
95 | return sys_semop (first, (struct sembuf *)ptr, second); | ||
96 | case SEMGET: | ||
97 | return sys_semget (first, second, third); | ||
98 | case SEMCTL: { | ||
99 | union semun fourth; | ||
100 | if (!ptr) | ||
101 | return -EINVAL; | ||
102 | if (get_user(fourth.__pad, (void **) ptr)) | ||
103 | return -EFAULT; | ||
104 | return sys_semctl (first, second, third, fourth); | ||
105 | } | ||
106 | default: | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | if (call <= MSGCTL) | ||
110 | switch (call) { | ||
111 | case MSGSND: | ||
112 | return sys_msgsnd (first, (struct msgbuf *) ptr, | ||
113 | second, third); | ||
114 | case MSGRCV: | ||
115 | switch (version) { | ||
116 | case 0: { | ||
117 | struct ipc_kludge tmp; | ||
118 | if (!ptr) | ||
119 | return -EINVAL; | ||
120 | if (copy_from_user (&tmp, | ||
121 | (struct ipc_kludge *)ptr, | ||
122 | sizeof (tmp))) | ||
123 | return -EFAULT; | ||
124 | return sys_msgrcv (first, tmp.msgp, second, | ||
125 | tmp.msgtyp, third); | ||
126 | } | ||
127 | default: | ||
128 | return sys_msgrcv (first, | ||
129 | (struct msgbuf *) ptr, | ||
130 | second, fifth, third); | ||
131 | } | ||
132 | case MSGGET: | ||
133 | return sys_msgget ((key_t) first, second); | ||
134 | case MSGCTL: | ||
135 | return sys_msgctl (first, second, | ||
136 | (struct msqid_ds *) ptr); | ||
137 | default: | ||
138 | return -EINVAL; | ||
139 | } | ||
140 | if (call <= SHMCTL) | ||
141 | switch (call) { | ||
142 | case SHMAT: | ||
143 | switch (version) { | ||
144 | default: { | ||
145 | ulong raddr; | ||
146 | ret = do_shmat (first, (char *) ptr, | ||
147 | second, &raddr); | ||
148 | if (ret) | ||
149 | return ret; | ||
150 | return put_user (raddr, (ulong *) third); | ||
151 | } | ||
152 | } | ||
153 | case SHMDT: | ||
154 | return sys_shmdt ((char *)ptr); | ||
155 | case SHMGET: | ||
156 | return sys_shmget (first, second, third); | ||
157 | case SHMCTL: | ||
158 | return sys_shmctl (first, second, | ||
159 | (struct shmid_ds *) ptr); | ||
160 | default: | ||
161 | return -EINVAL; | ||
162 | } | ||
163 | |||
164 | return -EINVAL; | ||
165 | } | ||
166 | |||
167 | /* sys_cacheflush -- no support. */ | 29 | /* sys_cacheflush -- no support. */ |
168 | asmlinkage int | 30 | asmlinkage int |
169 | sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) | 31 | sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) |
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S index 2d69881eda6..faefaff7d43 100644 --- a/arch/h8300/kernel/syscalls.S +++ b/arch/h8300/kernel/syscalls.S | |||
@@ -96,7 +96,7 @@ SYMBOL_NAME_LABEL(sys_call_table) | |||
96 | .long SYMBOL_NAME(sys_settimeofday) | 96 | .long SYMBOL_NAME(sys_settimeofday) |
97 | .long SYMBOL_NAME(sys_getgroups16) /* 80 */ | 97 | .long SYMBOL_NAME(sys_getgroups16) /* 80 */ |
98 | .long SYMBOL_NAME(sys_setgroups16) | 98 | .long SYMBOL_NAME(sys_setgroups16) |
99 | .long SYMBOL_NAME(old_select) | 99 | .long SYMBOL_NAME(sys_old_select) |
100 | .long SYMBOL_NAME(sys_symlink) | 100 | .long SYMBOL_NAME(sys_symlink) |
101 | .long SYMBOL_NAME(sys_lstat) | 101 | .long SYMBOL_NAME(sys_lstat) |
102 | .long SYMBOL_NAME(sys_readlink) /* 85 */ | 102 | .long SYMBOL_NAME(sys_readlink) /* 85 */ |
@@ -104,7 +104,7 @@ SYMBOL_NAME_LABEL(sys_call_table) | |||
104 | .long SYMBOL_NAME(sys_swapon) | 104 | .long SYMBOL_NAME(sys_swapon) |
105 | .long SYMBOL_NAME(sys_reboot) | 105 | .long SYMBOL_NAME(sys_reboot) |
106 | .long SYMBOL_NAME(sys_old_readdir) | 106 | .long SYMBOL_NAME(sys_old_readdir) |
107 | .long SYMBOL_NAME(old_mmap) /* 90 */ | 107 | .long SYMBOL_NAME(sys_old_mmap) /* 90 */ |
108 | .long SYMBOL_NAME(sys_munmap) | 108 | .long SYMBOL_NAME(sys_munmap) |
109 | .long SYMBOL_NAME(sys_truncate) | 109 | .long SYMBOL_NAME(sys_truncate) |
110 | .long SYMBOL_NAME(sys_ftruncate) | 110 | .long SYMBOL_NAME(sys_ftruncate) |
diff --git a/arch/h8300/platform/h8300h/ptrace_h8300h.c b/arch/h8300/platform/h8300h/ptrace_h8300h.c index 746b1ae672a..4f1ed027963 100644 --- a/arch/h8300/platform/h8300h/ptrace_h8300h.c +++ b/arch/h8300/platform/h8300h/ptrace_h8300h.c | |||
@@ -60,7 +60,7 @@ int h8300_put_reg(struct task_struct *task, int regno, unsigned long data) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | /* disable singlestep */ | 62 | /* disable singlestep */ |
63 | void h8300_disable_trace(struct task_struct *child) | 63 | void user_disable_single_step(struct task_struct *child) |
64 | { | 64 | { |
65 | if((long)child->thread.breakinfo.addr != -1L) { | 65 | if((long)child->thread.breakinfo.addr != -1L) { |
66 | *child->thread.breakinfo.addr = child->thread.breakinfo.inst; | 66 | *child->thread.breakinfo.addr = child->thread.breakinfo.inst; |
@@ -264,7 +264,7 @@ static unsigned short *getnextpc(struct task_struct *child, unsigned short *pc) | |||
264 | 264 | ||
265 | /* Set breakpoint(s) to simulate a single step from the current PC. */ | 265 | /* Set breakpoint(s) to simulate a single step from the current PC. */ |
266 | 266 | ||
267 | void h8300_enable_trace(struct task_struct *child) | 267 | void user_enable_single_step(struct task_struct *child) |
268 | { | 268 | { |
269 | unsigned short *nextpc; | 269 | unsigned short *nextpc; |
270 | nextpc = getnextpc(child,(unsigned short *)h8300_get_reg(child, PT_PC)); | 270 | nextpc = getnextpc(child,(unsigned short *)h8300_get_reg(child, PT_PC)); |
@@ -276,7 +276,7 @@ void h8300_enable_trace(struct task_struct *child) | |||
276 | asmlinkage void trace_trap(unsigned long bp) | 276 | asmlinkage void trace_trap(unsigned long bp) |
277 | { | 277 | { |
278 | if ((unsigned long)current->thread.breakinfo.addr == bp) { | 278 | if ((unsigned long)current->thread.breakinfo.addr == bp) { |
279 | h8300_disable_trace(current); | 279 | user_disable_single_step(current); |
280 | force_sig(SIGTRAP,current); | 280 | force_sig(SIGTRAP,current); |
281 | } else | 281 | } else |
282 | force_sig(SIGILL,current); | 282 | force_sig(SIGILL,current); |
diff --git a/arch/h8300/platform/h8s/ptrace_h8s.c b/arch/h8300/platform/h8s/ptrace_h8s.c index e8cd46f9255..c058ab1a849 100644 --- a/arch/h8300/platform/h8s/ptrace_h8s.c +++ b/arch/h8300/platform/h8s/ptrace_h8s.c | |||
@@ -65,13 +65,13 @@ int h8300_put_reg(struct task_struct *task, int regno, unsigned long data) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | /* disable singlestep */ | 67 | /* disable singlestep */ |
68 | void h8300_disable_trace(struct task_struct *child) | 68 | void user_disable_single_step(struct task_struct *child) |
69 | { | 69 | { |
70 | *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) &= ~EXR_TRACE; | 70 | *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) &= ~EXR_TRACE; |
71 | } | 71 | } |
72 | 72 | ||
73 | /* enable singlestep */ | 73 | /* enable singlestep */ |
74 | void h8300_enable_trace(struct task_struct *child) | 74 | void user_enable_single_step(struct task_struct *child) |
75 | { | 75 | { |
76 | *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) |= EXR_TRACE; | 76 | *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) |= EXR_TRACE; |
77 | } | 77 | } |