diff options
author | Stuart Menefy <stuart.menefy@st.com> | 2006-11-20 21:16:57 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-12-05 20:45:38 -0500 |
commit | f0bc814cfbc212683c882e58b3d1afec6b3e3aa3 (patch) | |
tree | 8ad669003716a3c22fb43e9c2066dcc5e5e0ad2d | |
parent | 53644087a607040a56d883df612b588814a56f11 (diff) |
sh: gcc4 support.
This fixes up the kernel for gcc4. The existing exception handlers
needed some wrapping for pt_regs access, acessing the registers
via a RELOC_HIDE() pointer.
The strcpy() issues popped up here too, so add -ffreestanding and
kill off the symbol export.
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4/fpu.c | 18 | ||||
-rw-r--r-- | arch/sh/kernel/irq.c | 5 | ||||
-rw-r--r-- | arch/sh/kernel/process.c | 32 | ||||
-rw-r--r-- | arch/sh/kernel/sh_ksyms.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/signal.c | 26 | ||||
-rw-r--r-- | arch/sh/kernel/sys_sh.c | 5 | ||||
-rw-r--r-- | arch/sh/kernel/traps.c | 52 |
8 files changed, 78 insertions, 64 deletions
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 6b3af5ce66a2..7f4516c3f83d 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -43,7 +43,7 @@ cflags-$(CONFIG_CPU_SH4A) := -m4a $(call cc-option,-m4a-nofpu,) | |||
43 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb | 43 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb |
44 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml | 44 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml |
45 | 45 | ||
46 | cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) | 46 | cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) -ffreestanding |
47 | 47 | ||
48 | cflags-$(CONFIG_SH_DSP) += -Wa,-dsp | 48 | cflags-$(CONFIG_SH_DSP) += -Wa,-dsp |
49 | cflags-$(CONFIG_SH_KGDB) += -g | 49 | cflags-$(CONFIG_SH_KGDB) += -g |
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c index f486c07e10e2..378b488237c9 100644 --- a/arch/sh/kernel/cpu/sh4/fpu.c +++ b/arch/sh/kernel/cpu/sh4/fpu.c | |||
@@ -296,16 +296,17 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
296 | } | 296 | } |
297 | 297 | ||
298 | asmlinkage void | 298 | asmlinkage void |
299 | do_fpu_error(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, | 299 | do_fpu_error(unsigned long r4, unsigned long r5, unsigned long r6, |
300 | struct pt_regs regs) | 300 | unsigned long r7, struct pt_regs __regs) |
301 | { | 301 | { |
302 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
302 | struct task_struct *tsk = current; | 303 | struct task_struct *tsk = current; |
303 | 304 | ||
304 | if (ieee_fpe_handler (®s)) | 305 | if (ieee_fpe_handler(regs)) |
305 | return; | 306 | return; |
306 | 307 | ||
307 | regs.pc += 2; | 308 | regs->pc += 2; |
308 | save_fpu(tsk, ®s); | 309 | save_fpu(tsk, regs); |
309 | tsk->thread.trap_no = 11; | 310 | tsk->thread.trap_no = 11; |
310 | tsk->thread.error_code = 0; | 311 | tsk->thread.error_code = 0; |
311 | force_sig(SIGFPE, tsk); | 312 | force_sig(SIGFPE, tsk); |
@@ -313,12 +314,13 @@ do_fpu_error(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long | |||
313 | 314 | ||
314 | asmlinkage void | 315 | asmlinkage void |
315 | do_fpu_state_restore(unsigned long r4, unsigned long r5, unsigned long r6, | 316 | do_fpu_state_restore(unsigned long r4, unsigned long r5, unsigned long r6, |
316 | unsigned long r7, struct pt_regs regs) | 317 | unsigned long r7, struct pt_regs __regs) |
317 | { | 318 | { |
319 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
318 | struct task_struct *tsk = current; | 320 | struct task_struct *tsk = current; |
319 | 321 | ||
320 | grab_fpu(®s); | 322 | grab_fpu(regs); |
321 | if (!user_mode(®s)) { | 323 | if (!user_mode(regs)) { |
322 | printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); | 324 | printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); |
323 | return; | 325 | return; |
324 | } | 326 | } |
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index 944128ce9706..edf4d2d21336 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c | |||
@@ -84,9 +84,10 @@ static union irq_ctx *softirq_ctx[NR_CPUS]; | |||
84 | 84 | ||
85 | asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, | 85 | asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, |
86 | unsigned long r6, unsigned long r7, | 86 | unsigned long r6, unsigned long r7, |
87 | struct pt_regs regs) | 87 | struct pt_regs __regs) |
88 | { | 88 | { |
89 | struct pt_regs *old_regs = set_irq_regs(®s); | 89 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
90 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
90 | int irq; | 91 | int irq; |
91 | #ifdef CONFIG_4KSTACKS | 92 | #ifdef CONFIG_4KSTACKS |
92 | union irq_ctx *curctx, *irqctx; | 93 | union irq_ctx *curctx, *irqctx; |
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index a52b13ac6b7f..f3e2631be144 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -385,10 +385,11 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne | |||
385 | 385 | ||
386 | asmlinkage int sys_fork(unsigned long r4, unsigned long r5, | 386 | asmlinkage int sys_fork(unsigned long r4, unsigned long r5, |
387 | unsigned long r6, unsigned long r7, | 387 | unsigned long r6, unsigned long r7, |
388 | struct pt_regs regs) | 388 | struct pt_regs __regs) |
389 | { | 389 | { |
390 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
390 | #ifdef CONFIG_MMU | 391 | #ifdef CONFIG_MMU |
391 | return do_fork(SIGCHLD, regs.regs[15], ®s, 0, NULL, NULL); | 392 | return do_fork(SIGCHLD, regs->regs[15], regs, 0, NULL, NULL); |
392 | #else | 393 | #else |
393 | /* fork almost works, enough to trick you into looking elsewhere :-( */ | 394 | /* fork almost works, enough to trick you into looking elsewhere :-( */ |
394 | return -EINVAL; | 395 | return -EINVAL; |
@@ -398,11 +399,12 @@ asmlinkage int sys_fork(unsigned long r4, unsigned long r5, | |||
398 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | 399 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, |
399 | unsigned long parent_tidptr, | 400 | unsigned long parent_tidptr, |
400 | unsigned long child_tidptr, | 401 | unsigned long child_tidptr, |
401 | struct pt_regs regs) | 402 | struct pt_regs __regs) |
402 | { | 403 | { |
404 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
403 | if (!newsp) | 405 | if (!newsp) |
404 | newsp = regs.regs[15]; | 406 | newsp = regs->regs[15]; |
405 | return do_fork(clone_flags, newsp, ®s, 0, | 407 | return do_fork(clone_flags, newsp, regs, 0, |
406 | (int __user *)parent_tidptr, (int __user *)child_tidptr); | 408 | (int __user *)parent_tidptr, (int __user *)child_tidptr); |
407 | } | 409 | } |
408 | 410 | ||
@@ -418,9 +420,10 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
418 | */ | 420 | */ |
419 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, | 421 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, |
420 | unsigned long r6, unsigned long r7, | 422 | unsigned long r6, unsigned long r7, |
421 | struct pt_regs regs) | 423 | struct pt_regs __regs) |
422 | { | 424 | { |
423 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.regs[15], ®s, | 425 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
426 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->regs[15], regs, | ||
424 | 0, NULL, NULL); | 427 | 0, NULL, NULL); |
425 | } | 428 | } |
426 | 429 | ||
@@ -429,8 +432,9 @@ asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, | |||
429 | */ | 432 | */ |
430 | asmlinkage int sys_execve(char *ufilename, char **uargv, | 433 | asmlinkage int sys_execve(char *ufilename, char **uargv, |
431 | char **uenvp, unsigned long r7, | 434 | char **uenvp, unsigned long r7, |
432 | struct pt_regs regs) | 435 | struct pt_regs __regs) |
433 | { | 436 | { |
437 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
434 | int error; | 438 | int error; |
435 | char *filename; | 439 | char *filename; |
436 | 440 | ||
@@ -442,7 +446,7 @@ asmlinkage int sys_execve(char *ufilename, char **uargv, | |||
442 | error = do_execve(filename, | 446 | error = do_execve(filename, |
443 | (char __user * __user *)uargv, | 447 | (char __user * __user *)uargv, |
444 | (char __user * __user *)uenvp, | 448 | (char __user * __user *)uenvp, |
445 | ®s); | 449 | regs); |
446 | if (error == 0) { | 450 | if (error == 0) { |
447 | task_lock(current); | 451 | task_lock(current); |
448 | current->ptrace &= ~PT_DTRACE; | 452 | current->ptrace &= ~PT_DTRACE; |
@@ -472,9 +476,7 @@ unsigned long get_wchan(struct task_struct *p) | |||
472 | return pc; | 476 | return pc; |
473 | } | 477 | } |
474 | 478 | ||
475 | asmlinkage void break_point_trap(unsigned long r4, unsigned long r5, | 479 | asmlinkage void break_point_trap(void) |
476 | unsigned long r6, unsigned long r7, | ||
477 | struct pt_regs regs) | ||
478 | { | 480 | { |
479 | /* Clear tracing. */ | 481 | /* Clear tracing. */ |
480 | #if defined(CONFIG_CPU_SH4A) | 482 | #if defined(CONFIG_CPU_SH4A) |
@@ -492,8 +494,10 @@ asmlinkage void break_point_trap(unsigned long r4, unsigned long r5, | |||
492 | 494 | ||
493 | asmlinkage void break_point_trap_software(unsigned long r4, unsigned long r5, | 495 | asmlinkage void break_point_trap_software(unsigned long r4, unsigned long r5, |
494 | unsigned long r6, unsigned long r7, | 496 | unsigned long r6, unsigned long r7, |
495 | struct pt_regs regs) | 497 | struct pt_regs __regs) |
496 | { | 498 | { |
497 | regs.pc -= 2; | 499 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
500 | |||
501 | regs->pc -= 2; | ||
498 | force_sig(SIGTRAP, current); | 502 | force_sig(SIGTRAP, current); |
499 | } | 503 | } |
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c index 8a2fd19dc9eb..c706f3bfd897 100644 --- a/arch/sh/kernel/sh_ksyms.c +++ b/arch/sh/kernel/sh_ksyms.c | |||
@@ -73,8 +73,6 @@ DECLARE_EXPORT(__lshrdi3); | |||
73 | DECLARE_EXPORT(__movstr); | 73 | DECLARE_EXPORT(__movstr); |
74 | DECLARE_EXPORT(__movstrSI16); | 74 | DECLARE_EXPORT(__movstrSI16); |
75 | 75 | ||
76 | EXPORT_SYMBOL(strcpy); | ||
77 | |||
78 | #ifdef CONFIG_CPU_SH4 | 76 | #ifdef CONFIG_CPU_SH4 |
79 | DECLARE_EXPORT(__movstr_i4_even); | 77 | DECLARE_EXPORT(__movstr_i4_even); |
80 | DECLARE_EXPORT(__movstr_i4_odd); | 78 | DECLARE_EXPORT(__movstr_i4_odd); |
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c index 764886b4bcf1..50d7c4993bef 100644 --- a/arch/sh/kernel/signal.c +++ b/arch/sh/kernel/signal.c | |||
@@ -37,7 +37,7 @@ | |||
37 | asmlinkage int | 37 | asmlinkage int |
38 | sys_sigsuspend(old_sigset_t mask, | 38 | sys_sigsuspend(old_sigset_t mask, |
39 | unsigned long r5, unsigned long r6, unsigned long r7, | 39 | unsigned long r5, unsigned long r6, unsigned long r7, |
40 | struct pt_regs regs) | 40 | struct pt_regs __regs) |
41 | { | 41 | { |
42 | mask &= _BLOCKABLE; | 42 | mask &= _BLOCKABLE; |
43 | spin_lock_irq(¤t->sighand->siglock); | 43 | spin_lock_irq(¤t->sighand->siglock); |
@@ -52,7 +52,7 @@ sys_sigsuspend(old_sigset_t mask, | |||
52 | return -ERESTARTNOHAND; | 52 | return -ERESTARTNOHAND; |
53 | } | 53 | } |
54 | 54 | ||
55 | asmlinkage int | 55 | asmlinkage int |
56 | sys_sigaction(int sig, const struct old_sigaction __user *act, | 56 | sys_sigaction(int sig, const struct old_sigaction __user *act, |
57 | struct old_sigaction __user *oact) | 57 | struct old_sigaction __user *oact) |
58 | { | 58 | { |
@@ -87,9 +87,11 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
87 | asmlinkage int | 87 | asmlinkage int |
88 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 88 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
89 | unsigned long r6, unsigned long r7, | 89 | unsigned long r6, unsigned long r7, |
90 | struct pt_regs regs) | 90 | struct pt_regs __regs) |
91 | { | 91 | { |
92 | return do_sigaltstack(uss, uoss, regs.regs[15]); | 92 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
93 | |||
94 | return do_sigaltstack(uss, uoss, regs->regs[15]); | ||
93 | } | 95 | } |
94 | 96 | ||
95 | 97 | ||
@@ -198,9 +200,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p | |||
198 | 200 | ||
199 | asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, | 201 | asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, |
200 | unsigned long r6, unsigned long r7, | 202 | unsigned long r6, unsigned long r7, |
201 | struct pt_regs regs) | 203 | struct pt_regs __regs) |
202 | { | 204 | { |
203 | struct sigframe __user *frame = (struct sigframe __user *)regs.regs[15]; | 205 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
206 | struct sigframe __user *frame = (struct sigframe __user *)regs->regs[15]; | ||
204 | sigset_t set; | 207 | sigset_t set; |
205 | int r0; | 208 | int r0; |
206 | 209 | ||
@@ -220,7 +223,7 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, | |||
220 | recalc_sigpending(); | 223 | recalc_sigpending(); |
221 | spin_unlock_irq(¤t->sighand->siglock); | 224 | spin_unlock_irq(¤t->sighand->siglock); |
222 | 225 | ||
223 | if (restore_sigcontext(®s, &frame->sc, &r0)) | 226 | if (restore_sigcontext(regs, &frame->sc, &r0)) |
224 | goto badframe; | 227 | goto badframe; |
225 | return r0; | 228 | return r0; |
226 | 229 | ||
@@ -231,9 +234,10 @@ badframe: | |||
231 | 234 | ||
232 | asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, | 235 | asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, |
233 | unsigned long r6, unsigned long r7, | 236 | unsigned long r6, unsigned long r7, |
234 | struct pt_regs regs) | 237 | struct pt_regs __regs) |
235 | { | 238 | { |
236 | struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.regs[15]; | 239 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
240 | struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15]; | ||
237 | sigset_t set; | 241 | sigset_t set; |
238 | stack_t st; | 242 | stack_t st; |
239 | int r0; | 243 | int r0; |
@@ -250,14 +254,14 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, | |||
250 | recalc_sigpending(); | 254 | recalc_sigpending(); |
251 | spin_unlock_irq(¤t->sighand->siglock); | 255 | spin_unlock_irq(¤t->sighand->siglock); |
252 | 256 | ||
253 | if (restore_sigcontext(®s, &frame->uc.uc_mcontext, &r0)) | 257 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) |
254 | goto badframe; | 258 | goto badframe; |
255 | 259 | ||
256 | if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) | 260 | if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) |
257 | goto badframe; | 261 | goto badframe; |
258 | /* It is more difficult to avoid calling this function than to | 262 | /* It is more difficult to avoid calling this function than to |
259 | call it and ignore errors. */ | 263 | call it and ignore errors. */ |
260 | do_sigaltstack(&st, NULL, regs.regs[15]); | 264 | do_sigaltstack(&st, NULL, regs->regs[15]); |
261 | 265 | ||
262 | return r0; | 266 | return r0; |
263 | 267 | ||
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 07f2b5718938..5083b6ed4b39 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c | |||
@@ -33,14 +33,15 @@ | |||
33 | */ | 33 | */ |
34 | asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, | 34 | asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, |
35 | unsigned long r6, unsigned long r7, | 35 | unsigned long r6, unsigned long r7, |
36 | struct pt_regs regs) | 36 | struct pt_regs __regs) |
37 | { | 37 | { |
38 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
38 | int fd[2]; | 39 | int fd[2]; |
39 | int error; | 40 | int error; |
40 | 41 | ||
41 | error = do_pipe(fd); | 42 | error = do_pipe(fd); |
42 | if (!error) { | 43 | if (!error) { |
43 | regs.regs[1] = fd[1]; | 44 | regs->regs[1] = fd[1]; |
44 | return fd[0]; | 45 | return fd[0]; |
45 | } | 46 | } |
46 | return error; | 47 | return error; |
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index f558748d7543..b52037bc1255 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c | |||
@@ -23,8 +23,8 @@ | |||
23 | 23 | ||
24 | #ifdef CONFIG_SH_KGDB | 24 | #ifdef CONFIG_SH_KGDB |
25 | #include <asm/kgdb.h> | 25 | #include <asm/kgdb.h> |
26 | #define CHK_REMOTE_DEBUG(regs) \ | 26 | #define CHK_REMOTE_DEBUG(regs) \ |
27 | { \ | 27 | { \ |
28 | if (kgdb_debug_hook && !user_mode(regs))\ | 28 | if (kgdb_debug_hook && !user_mode(regs))\ |
29 | (*kgdb_debug_hook)(regs); \ | 29 | (*kgdb_debug_hook)(regs); \ |
30 | } | 30 | } |
@@ -501,7 +501,7 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs) | |||
501 | /* | 501 | /* |
502 | * Handle various address error exceptions | 502 | * Handle various address error exceptions |
503 | */ | 503 | */ |
504 | asmlinkage void do_address_error(struct pt_regs *regs, | 504 | asmlinkage void do_address_error(struct pt_regs *regs, |
505 | unsigned long writeaccess, | 505 | unsigned long writeaccess, |
506 | unsigned long address) | 506 | unsigned long address) |
507 | { | 507 | { |
@@ -588,7 +588,7 @@ int is_dsp_inst(struct pt_regs *regs) | |||
588 | { | 588 | { |
589 | unsigned short inst; | 589 | unsigned short inst; |
590 | 590 | ||
591 | /* | 591 | /* |
592 | * Safe guard if DSP mode is already enabled or we're lacking | 592 | * Safe guard if DSP mode is already enabled or we're lacking |
593 | * the DSP altogether. | 593 | * the DSP altogether. |
594 | */ | 594 | */ |
@@ -612,8 +612,9 @@ int is_dsp_inst(struct pt_regs *regs) | |||
612 | #ifdef CONFIG_CPU_SH2A | 612 | #ifdef CONFIG_CPU_SH2A |
613 | asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, | 613 | asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, |
614 | unsigned long r6, unsigned long r7, | 614 | unsigned long r6, unsigned long r7, |
615 | struct pt_regs regs) | 615 | struct pt_regs __regs) |
616 | { | 616 | { |
617 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
617 | siginfo_t info; | 618 | siginfo_t info; |
618 | 619 | ||
619 | current->thread.trap_no = r4; | 620 | current->thread.trap_no = r4; |
@@ -635,12 +636,13 @@ asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, | |||
635 | /* arch/sh/kernel/cpu/sh4/fpu.c */ | 636 | /* arch/sh/kernel/cpu/sh4/fpu.c */ |
636 | extern int do_fpu_inst(unsigned short, struct pt_regs *); | 637 | extern int do_fpu_inst(unsigned short, struct pt_regs *); |
637 | extern asmlinkage void do_fpu_state_restore(unsigned long r4, unsigned long r5, | 638 | extern asmlinkage void do_fpu_state_restore(unsigned long r4, unsigned long r5, |
638 | unsigned long r6, unsigned long r7, struct pt_regs regs); | 639 | unsigned long r6, unsigned long r7, struct pt_regs __regs); |
639 | 640 | ||
640 | asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, | 641 | asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, |
641 | unsigned long r6, unsigned long r7, | 642 | unsigned long r6, unsigned long r7, |
642 | struct pt_regs regs) | 643 | struct pt_regs __regs) |
643 | { | 644 | { |
645 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
644 | unsigned long error_code; | 646 | unsigned long error_code; |
645 | struct task_struct *tsk = current; | 647 | struct task_struct *tsk = current; |
646 | 648 | ||
@@ -648,11 +650,11 @@ asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, | |||
648 | unsigned short inst = 0; | 650 | unsigned short inst = 0; |
649 | int err; | 651 | int err; |
650 | 652 | ||
651 | get_user(inst, (unsigned short*)regs.pc); | 653 | get_user(inst, (unsigned short*)regs->pc); |
652 | 654 | ||
653 | err = do_fpu_inst(inst, ®s); | 655 | err = do_fpu_inst(inst, regs); |
654 | if (!err) { | 656 | if (!err) { |
655 | regs.pc += 2; | 657 | regs->pc += 2; |
656 | return; | 658 | return; |
657 | } | 659 | } |
658 | /* not a FPU inst. */ | 660 | /* not a FPU inst. */ |
@@ -660,9 +662,9 @@ asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, | |||
660 | 662 | ||
661 | #ifdef CONFIG_SH_DSP | 663 | #ifdef CONFIG_SH_DSP |
662 | /* Check if it's a DSP instruction */ | 664 | /* Check if it's a DSP instruction */ |
663 | if (is_dsp_inst(®s)) { | 665 | if (is_dsp_inst(regs)) { |
664 | /* Enable DSP mode, and restart instruction. */ | 666 | /* Enable DSP mode, and restart instruction. */ |
665 | regs.sr |= SR_DSP; | 667 | regs->sr |= SR_DSP; |
666 | return; | 668 | return; |
667 | } | 669 | } |
668 | #endif | 670 | #endif |
@@ -672,9 +674,9 @@ asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, | |||
672 | local_irq_enable(); | 674 | local_irq_enable(); |
673 | tsk->thread.error_code = error_code; | 675 | tsk->thread.error_code = error_code; |
674 | tsk->thread.trap_no = TRAP_RESERVED_INST; | 676 | tsk->thread.trap_no = TRAP_RESERVED_INST; |
675 | CHK_REMOTE_DEBUG(®s); | 677 | CHK_REMOTE_DEBUG(regs); |
676 | force_sig(SIGILL, tsk); | 678 | force_sig(SIGILL, tsk); |
677 | die_if_no_fixup("reserved instruction", ®s, error_code); | 679 | die_if_no_fixup("reserved instruction", regs, error_code); |
678 | } | 680 | } |
679 | 681 | ||
680 | #ifdef CONFIG_SH_FPU_EMU | 682 | #ifdef CONFIG_SH_FPU_EMU |
@@ -722,17 +724,18 @@ static int emulate_branch(unsigned short inst, struct pt_regs* regs) | |||
722 | 724 | ||
723 | asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, | 725 | asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, |
724 | unsigned long r6, unsigned long r7, | 726 | unsigned long r6, unsigned long r7, |
725 | struct pt_regs regs) | 727 | struct pt_regs __regs) |
726 | { | 728 | { |
729 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
727 | unsigned long error_code; | 730 | unsigned long error_code; |
728 | struct task_struct *tsk = current; | 731 | struct task_struct *tsk = current; |
729 | #ifdef CONFIG_SH_FPU_EMU | 732 | #ifdef CONFIG_SH_FPU_EMU |
730 | unsigned short inst = 0; | 733 | unsigned short inst = 0; |
731 | 734 | ||
732 | get_user(inst, (unsigned short *)regs.pc + 1); | 735 | get_user(inst, (unsigned short *)regs->pc + 1); |
733 | if (!do_fpu_inst(inst, ®s)) { | 736 | if (!do_fpu_inst(inst, regs)) { |
734 | get_user(inst, (unsigned short *)regs.pc); | 737 | get_user(inst, (unsigned short *)regs->pc); |
735 | if (!emulate_branch(inst, ®s)) | 738 | if (!emulate_branch(inst, regs)) |
736 | return; | 739 | return; |
737 | /* fault in branch.*/ | 740 | /* fault in branch.*/ |
738 | } | 741 | } |
@@ -744,19 +747,20 @@ asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, | |||
744 | local_irq_enable(); | 747 | local_irq_enable(); |
745 | tsk->thread.error_code = error_code; | 748 | tsk->thread.error_code = error_code; |
746 | tsk->thread.trap_no = TRAP_RESERVED_INST; | 749 | tsk->thread.trap_no = TRAP_RESERVED_INST; |
747 | CHK_REMOTE_DEBUG(®s); | 750 | CHK_REMOTE_DEBUG(regs); |
748 | force_sig(SIGILL, tsk); | 751 | force_sig(SIGILL, tsk); |
749 | die_if_no_fixup("illegal slot instruction", ®s, error_code); | 752 | die_if_no_fixup("illegal slot instruction", regs, error_code); |
750 | } | 753 | } |
751 | 754 | ||
752 | asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, | 755 | asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, |
753 | unsigned long r6, unsigned long r7, | 756 | unsigned long r6, unsigned long r7, |
754 | struct pt_regs regs) | 757 | struct pt_regs __regs) |
755 | { | 758 | { |
759 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | ||
756 | long ex; | 760 | long ex; |
757 | 761 | ||
758 | lookup_exception_vector(ex); | 762 | lookup_exception_vector(ex); |
759 | die_if_kernel("exception", ®s, ex); | 763 | die_if_kernel("exception", regs, ex); |
760 | } | 764 | } |
761 | 765 | ||
762 | #if defined(CONFIG_SH_STANDARD_BIOS) | 766 | #if defined(CONFIG_SH_STANDARD_BIOS) |
@@ -809,7 +813,7 @@ void *set_exception_table_vec(unsigned int vec, void *handler) | |||
809 | 813 | ||
810 | extern asmlinkage void address_error_handler(unsigned long r4, unsigned long r5, | 814 | extern asmlinkage void address_error_handler(unsigned long r4, unsigned long r5, |
811 | unsigned long r6, unsigned long r7, | 815 | unsigned long r6, unsigned long r7, |
812 | struct pt_regs regs); | 816 | struct pt_regs __regs); |
813 | 817 | ||
814 | void __init trap_init(void) | 818 | void __init trap_init(void) |
815 | { | 819 | { |