10 #include <linux/errno.h>
11 #include <linux/kernel.h>
13 #include <linux/ptrace.h>
15 #include <linux/sched.h>
16 #include <linux/signal.h>
18 #include <linux/stddef.h>
19 #include <linux/tty.h>
20 #include <linux/binfmts.h>
22 #include <linux/wait.h>
24 #include <asm/intrinsics.h>
25 #include <asm/uaccess.h>
27 #include <asm/sigcontext.h>
32 #define STACK_ALIGN 16
35 # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t))
36 # define GET_SIGSET(k,u) __copy_from_user((k)->sig, (u)->sig, sizeof(sigset_t))
38 # define PUT_SIGSET(k,u) __put_user((k)->sig[0], &(u)->sig[0])
39 # define GET_SIGSET(k,u) __get_user((k)->sig[0], &(u)->sig[0])
77 scr->
pt.cr_ifs = cfm | (1
UL << 63);
78 scr->
pt.ar_rsc = rsc | (3 << 2);
81 scr->
pt.cr_iip = ip & ~0x3
UL;
138 err |=
__put_user(from->si_flags, &to->si_flags);
141 err |=
__put_user(from->si_addr, &to->si_addr);
146 err |=
__put_user(from->si_overrun, &to->si_overrun);
156 err |=
__put_user(from->si_utime, &to->si_utime);
157 err |=
__put_user(from->si_stime, &to->si_stime);
158 err |=
__put_user(from->si_status, &to->si_status);
177 sc = &((
struct sigframe __user *) (scr->
pt.r12 + 16))->sc;
185 retval = (
long) &ia64_leave_kernel;
194 retval = (
long) &ia64_strace_leave_kernel;
204 if (restore_sigcontext(sc, scr))
208 printk(
"SIG return (%s:%d): sp=%lx ip=%lx\n",
222 si.si_pid = task_pid_vnr(
current);
238 unsigned long flags = 0,
ifs,
cfm, nat;
241 ifs = scr->
pt.cr_ifs;
243 if (on_sig_stack((
unsigned long) sc))
245 if ((
ifs & (1
UL << 63)) == 0)
248 cfm =
ifs & ((1
UL << 38) - 1);
261 err |=
__put_user(scr->
pt.cr_ipsr & IA64_PSR_UM, &sc->sc_um);
275 if (!(flags & IA64_SC_FLAG_IN_SYSCALL)) {
291 rbs_on_sig_stack (
unsigned long bsp)
297 force_sigsegv_info (
int sig,
void __user *
addr)
314 spin_unlock_irqrestore(&
current->sighand->siglock, flags);
319 si.si_pid = task_pid_vnr(
current);
330 extern char __kernel_sigtramp[];
331 unsigned long tramp_addr, new_rbs = 0, new_sp;
335 new_sp = scr->
pt.r12;
336 tramp_addr = (
unsigned long) __kernel_sigtramp;
338 int onstack = sas_ss_flags(new_sp);
348 if (!rbs_on_sig_stack(scr->
pt.ar_bspstore))
352 unsigned long check_sp;
359 check_sp = (new_sp -
sizeof(*frame)) & -
STACK_ALIGN;
360 if (!
likely(on_sig_stack(check_sp)))
361 return force_sigsegv_info(sig, (
void __user *)
368 return force_sigsegv_info(sig, frame);
381 err |=
__put_user(sas_ss_flags(scr->
pt.r12), &frame->
sc.sc_stack.ss_flags);
382 err |= setup_sigcontext(&frame->
sc,
set, scr);
385 return force_sigsegv_info(sig, frame);
387 scr->
pt.r12 = (
unsigned long) frame - 16;
389 scr->
pt.cr_iip = tramp_addr;
400 scr->
pt.cr_ifs = (1
UL << 63);
409 printk(
"SIG deliver (%s:%d): sig=%d sp=%lx ip=%lx handler=%p\n",
419 if (!setup_frame(sig, ka, info, sigmask_to_save(), scr))
453 if ((
long) scr->
pt.r10 != -1)
489 if (handle_signal(signr, &ka, &info, scr))
512 restore_saved_sigmask();