14 #include <linux/sched.h>
15 #include <linux/kernel.h>
16 #include <linux/signal.h>
17 #include <linux/errno.h>
18 #include <linux/wait.h>
19 #include <linux/ptrace.h>
23 #include <linux/tty.h>
24 #include <linux/binfmts.h>
25 #include <linux/bitops.h>
27 #include <asm/uaccess.h>
28 #include <asm/ptrace.h>
29 #include <asm/pgtable.h>
32 #include <asm/siginfo.h>
34 #include <asm/switch_to.h>
35 #include <asm/cacheflush.h>
47 unsigned long pc, npc, tstate;
53 if (get_thread_wsaved() ||
54 (((
unsigned long)ucp) & (
sizeof(
unsigned long)-1)) ||
60 if (
err || ((pc | npc) & 3))
74 if (test_thread_flag(TIF_32BIT)) {
119 (
sizeof(
unsigned int) * 32));
122 ((
unsigned long __user *)&(ucp->
uc_mcontext.mc_fpregs.mcfpu_fregs))+16,
123 (
sizeof(
unsigned int) * 32));
144 unsigned long fp, i7;
149 if (get_thread_wsaved() ||
clear_user(ucp,
sizeof(*ucp)))
159 grp = &
mcp->mc_gregs;
162 if (test_thread_flag(TIF_32BIT)) {
163 regs->tpc = (regs->tnpc & 0xffffffff);
164 regs->tnpc = (regs->tnpc + 4) & 0xffffffff;
166 regs->tpc = regs->tnpc;
212 (
sizeof(
unsigned int) * 32));
215 ((
unsigned long __user *)&(
mcp->mc_fpregs.mcfpu_fregs))+16, fpregs+16,
216 (
sizeof(
unsigned int) * 32));
242 siginitset(&blocked,
set);
248 return _sigpause_common(
set);
253 return _sigpause_common(
set);
259 unsigned long tpc, tnpc, tstate;
273 if (((
unsigned long) sf) & 3)
278 if (test_thread_flag(TIF_32BIT)) {
282 err |= ((tpc | tnpc) & 3);
294 if (!err && fpu_save)
302 if (!err && rwin_save) {
311 pt_regs_clear_syscall(regs);
320 static int invalid_frame_pointer(
void __user *
fp)
322 if (((
unsigned long) fp) & 15)
335 if (on_sig_stack(sp) && !
likely(on_sig_stack(sp - framesize)))
336 return (
void __user *) -1
L;
340 if (sas_ss_flags(sp) == 0)
354 return (
void __user *)
sp;
362 int wsaved,
err, sf_size;
367 save_and_clear_fpu();
369 wsaved = get_thread_wsaved();
379 if (invalid_frame_pointer (sf))
400 set_thread_wsaved(0);
416 sizeof(
struct reg_window));
418 struct reg_window *
rp;
444 regs->tpc = (
unsigned long) ka->
sa.sa_handler;
445 regs->tnpc = (regs->tpc + 4);
446 if (test_thread_flag(TIF_32BIT)) {
447 regs->tpc &= 0xffffffff;
448 regs->tnpc &= 0xffffffff;
463 static inline void handle_signal(
unsigned long signr,
struct k_sigaction *ka,
469 err = setup_rt_frame(ka, regs, signr, oldset,
477 static inline void syscall_restart(
unsigned long orig_i0,
struct pt_regs *regs,
483 no_system_call_restart:
489 goto no_system_call_restart;
506 sigset_t *oldset = sigmask_to_save();
528 if (pt_regs_is_syscall(regs) &&
533 if (test_thread_flag(TIF_32BIT)) {
543 if (pt_regs_is_syscall(regs) &&
551 syscall_restart(orig_i0, regs, &ka.
sa);
552 handle_signal(signr, &ka, &info, oldset, regs);
555 if (restart_syscall &&
563 pt_regs_clear_syscall(regs);
565 if (restart_syscall &&
570 pt_regs_clear_syscall(regs);
576 restore_saved_sigmask();
585 tracehook_notify_resume(regs);