static void signal_handler (int sig) { int new_sig = map_signal (sig); /* Discard NONE or UNKNOWN */ if (new_sig < SIG_DUMMY) return; /* Store signal received */ signal_received[new_sig] = TRUE; sig_received = TRUE; }
static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { int err = 0; rt_sigframe __user *frame; frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe))) goto give_sigsegv; if (frame == (void __user *) -1UL) goto give_sigsegv; if (copy_siginfo_to_user(&frame->info, info)) goto give_sigsegv; /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(NULL, &frame->uc.uc_link); err |= __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(regs->gprs[15]), &frame->uc.uc_stack.ss_flags); err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); err |= save_sigregs(regs, &frame->uc.uc_mcontext); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); if (err) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = (unsigned long) ka->sa.sa_restorer | PSW_ADDR_AMODE; } else { regs->gprs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE; if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, (u16 __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (unsigned long) frame; regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (unsigned long) &frame->info; regs->gprs[4] = (unsigned long) &frame->uc; return 0; give_sigsegv: force_sigsegv(sig, current); return -EFAULT; }
static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { sigframe __user *frame; frame = get_sigframe(ka, regs, sizeof(sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe))) goto give_sigsegv; if (frame == (void __user *) -1UL) goto give_sigsegv; if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE)) goto give_sigsegv; if (save_sigregs(regs, &frame->sregs)) goto give_sigsegv; if (__put_user(&frame->sregs, &frame->sc.sregs)) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = (unsigned long) ka->sa.sa_restorer | PSW_ADDR_AMODE; } else { regs->gprs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE; if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, (u16 __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (unsigned long) frame; regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (unsigned long) &frame->sc; /* We forgot to include these in the sigcontext. To avoid breaking binary compatibility, they are passed as args. */ regs->gprs[4] = current->thread.trap_no; regs->gprs[5] = current->thread.prot_addr; /* Place signal number on stack to allow backtrace from handler. */ if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) goto give_sigsegv; return 0; give_sigsegv: force_sigsegv(sig, current); return -EFAULT; }
static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { int err = 0; rt_sigframe __user *frame; frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); if (frame == (void __user *) -1UL) goto give_sigsegv; if (copy_siginfo_to_user(&frame->info, info)) goto give_sigsegv; /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(NULL, &frame->uc.uc_link); err |= __save_altstack(&frame->uc.uc_stack, regs->gprs[15]); err |= save_sigregs(regs, &frame->uc.uc_mcontext); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); if (err) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = (unsigned long) ka->sa.sa_restorer | PSW_ADDR_AMODE; } else { regs->gprs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE; if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, (u16 __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (unsigned long) frame; /* Force default amode and default user address space control. */ regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | (PSW_USER_BITS & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (unsigned long) &frame->info; regs->gprs[4] = (unsigned long) &frame->uc; regs->gprs[5] = task_thread_info(current)->last_break; return 0; give_sigsegv: force_sigsegv(sig, current); return -EFAULT; }
static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { int err = 0; rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe))) goto give_sigsegv; if (copy_siginfo_to_user(&frame->info, info)) goto give_sigsegv; /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(0, &frame->uc.uc_link); err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(regs->gprs[15]), &frame->uc.uc_stack.ss_flags); err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); err |= save_sigregs(regs, &frame->uc.uc_mcontext); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); if (err) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = FIX_PSW(ka->sa.sa_restorer); } else { regs->gprs[14] = FIX_PSW(frame->retcode); err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, (u16 *)(frame->retcode)); } /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (addr_t)frame; regs->psw.addr = FIX_PSW(ka->sa.sa_handler); regs->psw.mask = _USER_PSW_MASK; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (addr_t)&frame->info; regs->gprs[4] = (addr_t)&frame->uc; return; give_sigsegv: if (sig == SIGSEGV) ka->sa.sa_handler = SIG_DFL; force_sig(SIGSEGV, current); }
void map_bc( char * file, uint32_t line, uint32_t v, char * ee_name, uint64_t * curr_ztz, uint64_t * curr_oto) { /* We have already made sure that the dimensions of the */ /* callee array is 0 (in `e_process_bit_constant(...)'). */ if (v == 0) { /* printf("MAP_ANCb %s %u %s *curr_ztz = %u\n", ee_name, 0, "yQztz", *curr_ztz); */ map_signal(file, line, ee_name, 0, "yQztz", *curr_ztz); (*curr_ztz)++; } else { /* printf("MAP_ANCb %s %u %s *curr_oto = %u\n", ee_name, 0, "yQoto", *curr_oto); */ map_signal(file, line, ee_name, 0, "yQoto", *curr_oto); (*curr_oto)++; } }
static void setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe))) goto give_sigsegv; if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE)) goto give_sigsegv; if (save_sigregs(regs, &frame->sregs)) goto give_sigsegv; if (__put_user(&frame->sregs, &frame->sc.sregs)) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = FIX_PSW(ka->sa.sa_restorer); } else { regs->gprs[14] = FIX_PSW(frame->retcode); if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, (u16 *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (addr_t)frame; regs->psw.addr = FIX_PSW(ka->sa.sa_handler); regs->psw.mask = _USER_PSW_MASK; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (addr_t)&frame->sc; /* We forgot to include these in the sigcontext. To avoid breaking binary compatibility, they are passed as args. */ regs->gprs[4] = current->thread.trap_no; regs->gprs[5] = current->thread.prot_addr; return; give_sigsegv: if (sig == SIGSEGV) ka->sa.sa_handler = SIG_DFL; force_sig(SIGSEGV, current); }
static int setup_frame32(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); if (frame == (void __user *) -1UL) goto give_sigsegv; if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32)) goto give_sigsegv; if (save_sigregs32(regs, &frame->sregs)) goto give_sigsegv; if (save_sigregs_gprs_high(regs, frame->gprs_high)) goto give_sigsegv; if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs)) goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { regs->gprs[14] = (__u64 __force) ka->sa.sa_restorer | PSW32_ADDR_AMODE; } else { regs->gprs[14] = (__u64 __force) frame->retcode | PSW32_ADDR_AMODE; if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, (u16 __force __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ regs->gprs[15] = (__force __u64) frame; /* Force 31 bit amode and default user address space control. */ regs->psw.mask = PSW_MASK_BA | (psw_user_bits & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (__force __u64) ka->sa.sa_handler; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (__force __u64) &frame->sc; /* We forgot to include these in the sigcontext. To avoid breaking binary compatibility, they are passed as args. */ if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP || sig == SIGFPE) { /* set extra registers only for synchronous signals */ regs->gprs[4] = regs->int_code & 127; regs->gprs[5] = regs->int_parm_long; regs->gprs[6] = task_thread_info(current)->last_break; } /* Place signal number on stack to allow backtrace from handler. */ if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) goto give_sigsegv; return 0; give_sigsegv: force_sigsegv(sig, current); return -EFAULT; }
static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { struct rt_sigframe __user *frame; unsigned long uc_flags, restorer; size_t frame_size; frame_size = sizeof(struct rt_sigframe) - sizeof(_sigregs_ext); /* * gprs_high are only present for a 31-bit task running on * a 64-bit kernel (see compat_signal.c) but the space for * gprs_high need to be allocated if vector registers are * included in the signal frame on a 31-bit system. */ uc_flags = 0; #ifdef CONFIG_64BIT if (MACHINE_HAS_VX) { frame_size += sizeof(_sigregs_ext); if (current->thread.vxrs) uc_flags |= UC_VXRS; } #endif frame = get_sigframe(&ksig->ka, regs, frame_size); if (frame == (void __user *) -1UL) return -EFAULT; /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t __user *) frame)) return -EFAULT; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ksig->ka.sa.sa_flags & SA_RESTORER) { restorer = (unsigned long) ksig->ka.sa.sa_restorer | PSW_ADDR_AMODE; } else { __u16 __user *svc = &frame->svc_insn; if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, svc)) return -EFAULT; restorer = (unsigned long) svc | PSW_ADDR_AMODE; } /* Create siginfo on the signal stack */ if (copy_siginfo_to_user(&frame->info, &ksig->info)) return -EFAULT; /* Store registers needed to create the signal frame */ store_sigregs(); /* Create ucontext on the signal stack. */ if (__put_user(uc_flags, &frame->uc.uc_flags) || __put_user(NULL, &frame->uc.uc_link) || __save_altstack(&frame->uc.uc_stack, regs->gprs[15]) || save_sigregs(regs, &frame->uc.uc_mcontext) || __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)) || save_sigregs_ext(regs, &frame->uc.uc_mcontext_ext)) return -EFAULT; /* Set up registers for signal handler */ regs->gprs[14] = restorer; regs->gprs[15] = (unsigned long) frame; /* Force default amode and default user address space control. */ regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | (PSW_USER_BITS & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (unsigned long) ksig->ka.sa.sa_handler | PSW_ADDR_AMODE; regs->gprs[2] = map_signal(ksig->sig); regs->gprs[3] = (unsigned long) &frame->info; regs->gprs[4] = (unsigned long) &frame->uc; regs->gprs[5] = task_thread_info(current)->last_break; return 0; }
static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { struct sigframe __user *frame; struct sigcontext sc; unsigned long restorer; size_t frame_size; /* * gprs_high are only present for a 31-bit task running on * a 64-bit kernel (see compat_signal.c) but the space for * gprs_high need to be allocated if vector registers are * included in the signal frame on a 31-bit system. */ frame_size = sizeof(*frame) - sizeof(frame->sregs_ext); if (MACHINE_HAS_VX) frame_size += sizeof(frame->sregs_ext); frame = get_sigframe(ka, regs, frame_size); if (frame == (void __user *) -1UL) return -EFAULT; /* Set up backchain. */ if (__put_user(regs->gprs[15], (addr_t __user *) frame)) return -EFAULT; /* Create struct sigcontext on the signal stack */ memcpy(&sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE); sc.sregs = (_sigregs __user __force *) &frame->sregs; if (__copy_to_user(&frame->sc, &sc, sizeof(frame->sc))) return -EFAULT; /* Store registers needed to create the signal frame */ store_sigregs(); /* Create _sigregs on the signal stack */ if (save_sigregs(regs, &frame->sregs)) return -EFAULT; /* Place signal number on stack to allow backtrace from handler. */ if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) return -EFAULT; /* Create _sigregs_ext on the signal stack */ if (save_sigregs_ext(regs, &frame->sregs_ext)) return -EFAULT; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa.sa_flags & SA_RESTORER) { restorer = (unsigned long) ka->sa.sa_restorer | PSW_ADDR_AMODE; } else { /* Signal frame without vector registers are short ! */ __u16 __user *svc = (void __user *) frame + frame_size - 2; if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, svc)) return -EFAULT; restorer = (unsigned long) svc | PSW_ADDR_AMODE; } /* Set up registers for signal handler */ regs->gprs[14] = restorer; regs->gprs[15] = (unsigned long) frame; /* Force default amode and default user address space control. */ regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | (PSW_USER_BITS & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (unsigned long) &frame->sc; /* We forgot to include these in the sigcontext. To avoid breaking binary compatibility, they are passed as args. */ if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP || sig == SIGFPE) { /* set extra registers only for synchronous signals */ regs->gprs[4] = regs->int_code & 127; regs->gprs[5] = regs->int_parm_long; regs->gprs[6] = task_thread_info(current)->last_break; } return 0; }
static int setup_rt_frame32(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { compat_sigset_t cset; rt_sigframe32 __user *frame; unsigned long restorer; size_t frame_size; u32 uc_flags; frame_size = sizeof(*frame) - sizeof(frame->uc.uc_mcontext_ext.__reserved); /* * gprs_high are always present for 31-bit compat tasks. * The space for vector registers is only allocated if * the machine supports it */ uc_flags = UC_GPRS_HIGH; if (MACHINE_HAS_VX) { if (current->thread.vxrs) uc_flags |= UC_VXRS; } else frame_size -= sizeof(frame->uc.uc_mcontext_ext.vxrs_low) + sizeof(frame->uc.uc_mcontext_ext.vxrs_high); frame = get_sigframe(&ksig->ka, regs, frame_size); if (frame == (void __user *) -1UL) return -EFAULT; /* Set up backchain. */ if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame)) return -EFAULT; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ksig->ka.sa.sa_flags & SA_RESTORER) { restorer = (unsigned long __force) ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE; } else { __u16 __user *svc = &frame->svc_insn; if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, svc)) return -EFAULT; restorer = (unsigned long __force) svc | PSW32_ADDR_AMODE; } /* Create siginfo on the signal stack */ if (copy_siginfo_to_user32(&frame->info, &ksig->info)) return -EFAULT; /* Store registers needed to create the signal frame */ store_sigregs(); /* Create ucontext on the signal stack. */ sigset_to_sigset32(set->sig, cset.sig); if (__put_user(uc_flags, &frame->uc.uc_flags) || __put_user(0, &frame->uc.uc_link) || __compat_save_altstack(&frame->uc.uc_stack, regs->gprs[15]) || save_sigregs32(regs, &frame->uc.uc_mcontext) || __copy_to_user(&frame->uc.uc_sigmask, &cset, sizeof(cset)) || save_sigregs_ext32(regs, &frame->uc.uc_mcontext_ext)) return -EFAULT; /* Set up registers for signal handler */ regs->gprs[14] = restorer; regs->gprs[15] = (__force __u64) frame; /* Force 31 bit amode and default user address space control. */ regs->psw.mask = PSW_MASK_BA | (PSW_USER_BITS & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (__u64 __force) ksig->ka.sa.sa_handler; regs->gprs[2] = map_signal(ksig->sig); regs->gprs[3] = (__force __u64) &frame->info; regs->gprs[4] = (__force __u64) &frame->uc; regs->gprs[5] = task_thread_info(current)->last_break; return 0; }
static int setup_frame32(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { int sig = ksig->sig; sigframe32 __user *frame; struct sigcontext32 sc; unsigned long restorer; size_t frame_size; /* * gprs_high are always present for 31-bit compat tasks. * The space for vector registers is only allocated if * the machine supports it */ frame_size = sizeof(*frame) - sizeof(frame->sregs_ext.__reserved); if (!MACHINE_HAS_VX) frame_size -= sizeof(frame->sregs_ext.vxrs_low) + sizeof(frame->sregs_ext.vxrs_high); frame = get_sigframe(&ksig->ka, regs, frame_size); if (frame == (void __user *) -1UL) return -EFAULT; /* Set up backchain. */ if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) return -EFAULT; /* Create struct sigcontext32 on the signal stack */ sigset_to_sigset32(set->sig, sc.oldmask); sc.sregs = (__u32)(unsigned long __force) &frame->sregs; if (__copy_to_user(&frame->sc, &sc, sizeof(frame->sc))) return -EFAULT; /* Store registers needed to create the signal frame */ store_sigregs(); /* Create _sigregs32 on the signal stack */ if (save_sigregs32(regs, &frame->sregs)) return -EFAULT; /* Place signal number on stack to allow backtrace from handler. */ if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) return -EFAULT; /* Create _sigregs_ext32 on the signal stack */ if (save_sigregs_ext32(regs, &frame->sregs_ext)) return -EFAULT; /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ksig->ka.sa.sa_flags & SA_RESTORER) { restorer = (unsigned long __force) ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE; } else { /* Signal frames without vectors registers are short ! */ __u16 __user *svc = (void *) frame + frame_size - 2; if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, svc)) return -EFAULT; restorer = (unsigned long __force) svc | PSW32_ADDR_AMODE; } /* Set up registers for signal handler */ regs->gprs[14] = restorer; regs->gprs[15] = (__force __u64) frame; /* Force 31 bit amode and default user address space control. */ regs->psw.mask = PSW_MASK_BA | (PSW_USER_BITS & PSW_MASK_ASC) | (regs->psw.mask & ~PSW_MASK_ASC); regs->psw.addr = (__force __u64) ksig->ka.sa.sa_handler; regs->gprs[2] = map_signal(sig); regs->gprs[3] = (__force __u64) &frame->sc; /* We forgot to include these in the sigcontext. To avoid breaking binary compatibility, they are passed as args. */ if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP || sig == SIGFPE) { /* set extra registers only for synchronous signals */ regs->gprs[4] = regs->int_code & 127; regs->gprs[5] = regs->int_parm_long; regs->gprs[6] = task_thread_info(current)->last_break; } return 0; }
void map_cs( char * file, uint32_t line, char * r_name, char * ee_name) { int64_t i = 0; int64_t j = 0; int64_t tail = 0; int64_t prod = 1; /* We have already made sure that the dimensions of the caller and the */ /* callee arrays are equal (in `e_process_compound_signal(...)'). */ while (i < yQni) { if (yQir[i] != 0) { if (yQil[i] < 0) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because the lower bound of index %u is negative.\n", (uint32_t) (i + 1) ); call_stack_fprint(stderr); clean_exit(-1); } if (yQih[i] >= yQim[i]) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because the upper bound of index %u exceeds" " the upper bound of index %u in the declaration `", (uint32_t) (i + 1), (uint32_t) (i + 1) ); print_stderr_caller_sig_name_and_subranges(r_name); fprintf(stderr, "'.\n"); call_stack_fprint(stderr); clean_exit(-1); } if (yQil[i] > yQih[i]) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because the subrange of index %u is empty.\n", (uint32_t) (i + 1) ); call_stack_fprint(stderr); clean_exit(-1); } if (yQih[i] - yQil[i] + ((int64_t)1) != yQiee[j]) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because the size of the range of index %u is different " "from the size of the range of the corresponding " "index %u of the callee signal `", (uint32_t) (i + 1), (uint32_t) (j + 1) ); print_stderr_callee_sig_name_and_subranges(ee_name); fprintf(stderr, "'.\n"); call_stack_fprint(stderr); clean_exit(-1); } j++; } else { yQih[i] = yQil[i]; if (yQil[i] < 0) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because index %u is negative.\n", (uint32_t) (i + 1) ); call_stack_fprint(stderr); clean_exit(-1); } if (yQih[i] >= yQim[i]) { fprintf(stderr, "Error.\n"); s_file_and_line_fprint(stderr, file, line); fprintf(stderr, " : Can not map compound signal `"); print_stderr_sig_name_and_subranges(r_name); fprintf(stderr, "' because index %u exceeds" " the upper bound of index %u in the declaration `", (uint32_t) (i + 1), (uint32_t) (i + 1) ); print_stderr_caller_sig_name_and_subranges(r_name); fprintf(stderr, "'.\n"); call_stack_fprint(stderr); clean_exit(-1); } } i++; } /* Compute initial `r_running_index' and set positional */ /* system counter to initial state. */ r_running_index = 0; for (i = 0; i < yQni; i++) { r_running_index = r_running_index * yQim[i] + yQil[i]; } ee_running_index = 0; /* Compute yQincr[...] */ /* `tail' is initialized to 0; `prod' is initialized to 1. */ for (i = yQni - 1; i >= 0; i--) { yQincr[i] = prod - tail; tail += prod * (yQih[i] - yQil[i]); prod *= yQim[i]; yQa[i] = yQil[i]; } while (1 != 0) { /* printf("Mapping multiindex of caller "); for (i = 0; i < yQni; i++) { printf("%d ", (int32_t) yQa[i]); } printf(" [[ %d ]] <-> %d", (int32_t) r_running_index, (int32_t) ee_running_index); */ map_signal(file, line, ee_name, ee_running_index, r_name, r_running_index); for (i = yQni - 1; i >= 0; i--) { if (++yQa[i] <= yQih[i]) break; else yQa[i] = yQil[i]; } /* printf(" Changing digit %d.\n", (int32_t) i); */ if (i < 0) break; r_running_index += yQincr[i]; ee_running_index++; } }
void map_1dba( char * file, uint32_t line, char * s, char * ee_name, uint64_t * curr_ztz, uint64_t * curr_oto, uint32_t ee_ind0range) { int64_t i = 0; int64_t j; char * pchar; /* We have already made sure that the dimensions of the */ /* callee array is 1 (in `e_process_1d_bit_array_constant(...)'). */ for (pchar = s, j = 0; (*pchar != '\0') && (j < ee_ind0range); pchar++, j++) { if (*pchar == '0') { /* printf("MAP_ANCs %s %u %s *curr_ztz = %u\n", ee_name, (uint32_t) i, "yQztz", *curr_ztz); */ map_signal(file, line, ee_name, i, "yQztz", *curr_ztz); (*curr_ztz)++; i++; } else if (*pchar == '1') { /* printf("MAP_ANCs %s %u %s *curr_oto = %u\n", ee_name, (uint32_t) i, "yQoto", *curr_oto); */ map_signal(file, line, ee_name, i, "yQoto", *curr_oto); (*curr_oto)++; i++; } else { fprintf(stderr, "Error.\n"); fprintf(stderr, "An internal BBRL error occurred: " "a bit string contains characters other " "then '0' and '1'.\n"); call_stack_fprint(stderr); clean_exit(-2); } } pchar--; while (j < ee_ind0range) { if (*pchar == '0') { /* printf("MAP_ANCe %s %u %s *curr_ztz = %u\n", ee_name, (uint32_t) i, "yQztz", *curr_ztz); */ map_signal(file, line, ee_name, i, "yQztz", *curr_ztz); (*curr_ztz)++; i++; } else if (*pchar == '1') { /* printf("MAP_ANCe %s %u %s *curr_oto = %u\n", ee_name, (uint32_t) i, "yQoto", *curr_oto); */ map_signal(file, line, ee_name, i, "yQoto", *curr_oto); (*curr_oto)++; i++; } else { fprintf(stderr, "Error.\n"); fprintf(stderr, "An internal BBRL error occurred: " "a bit string contains characters other " "then '0' and '1'.\n"); call_stack_fprint(stderr); clean_exit(-2); } j++; } }