···398398}399399400400#ifdef CONFIG_TRAD_SIGNALS401401-int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,401401+static int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,402402 int signr, sigset_t *set)403403{404404 struct sigframe __user *frame;···443443}444444#endif445445446446-int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,446446+static int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,447447 int signr, sigset_t *set, siginfo_t *info)448448{449449 struct rt_sigframe __user *frame;···501501 return -EFAULT;502502}503503504504+struct mips_abi mips_abi = {505505+#ifdef CONFIG_TRAD_SIGNALS506506+ .setup_frame = setup_frame,507507+#endif508508+ .setup_rt_frame = setup_rt_frame,509509+ .restart = __NR_restart_syscall510510+};511511+504512static int handle_signal(unsigned long sig, siginfo_t *info,505513 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs)506514{···547539 return ret;548540}549541550550-void do_signal(struct pt_regs *regs)542542+static void do_signal(struct pt_regs *regs)551543{552544 struct k_sigaction ka;553545 sigset_t *oldset;···597589 regs->cp0_epc -= 8;598590 }599591 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {600600- regs->regs[2] = __NR_restart_syscall;592592+ regs->regs[2] = current->thread.abi->restart;601593 regs->regs[7] = regs->regs[26];602594 regs->cp0_epc -= 4;603595 }···623615{624616 /* deal with pending signal delivery */625617 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))626626- current->thread.abi->do_signal(regs);618618+ do_signal(regs);627619}
+11-107
arch/mips/kernel/signal32.c
···104104 */105105#define __NR_O32_sigreturn 4119106106#define __NR_O32_rt_sigreturn 4193107107-#define __NR_O32_restart_syscall 4253107107+#define __NR_O32_restart_syscall 4253108108109109/* 32-bit compatibility types */110110···598598 force_sig(SIGSEGV, current);599599}600600601601-int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,601601+static int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,602602 int signr, sigset_t *set)603603{604604 struct sigframe32 __user *frame;···644644 return -EFAULT;645645}646646647647-int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,647647+static int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,648648 int signr, sigset_t *set, siginfo_t *info)649649{650650 struct rt_sigframe32 __user *frame;···704704 return -EFAULT;705705}706706707707-static inline int handle_signal(unsigned long sig, siginfo_t *info,708708- struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs)709709-{710710- int ret;711711-712712- switch (regs->regs[0]) {713713- case ERESTART_RESTARTBLOCK:714714- case ERESTARTNOHAND:715715- regs->regs[2] = EINTR;716716- break;717717- case ERESTARTSYS:718718- if (!(ka->sa.sa_flags & SA_RESTART)) {719719- regs->regs[2] = EINTR;720720- break;721721- }722722- /* fallthrough */723723- case ERESTARTNOINTR: /* Userland will reload $v0. */724724- regs->regs[7] = regs->regs[26];725725- regs->cp0_epc -= 8;726726- }727727-728728- regs->regs[0] = 0; /* Don't deal with this again. */729729-730730- if (ka->sa.sa_flags & SA_SIGINFO)731731- ret = current->thread.abi->setup_rt_frame(ka, regs, sig, oldset, info);732732- else733733- ret = current->thread.abi->setup_frame(ka, regs, sig, oldset);734734-735735- spin_lock_irq(¤t->sighand->siglock);736736- sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);737737- if (!(ka->sa.sa_flags & SA_NODEFER))738738- sigaddset(¤t->blocked,sig);739739- recalc_sigpending();740740- spin_unlock_irq(¤t->sighand->siglock);741741-742742- return ret;743743-}744744-745745-void do_signal32(struct pt_regs *regs)746746-{747747- struct k_sigaction ka;748748- sigset_t *oldset;749749- siginfo_t info;750750- int signr;751751-752752- /*753753- * We want the common case to go fast, which is why we may in certain754754- * cases get here from kernel mode. Just return without doing anything755755- * if so.756756- */757757- if (!user_mode(regs))758758- return;759759-760760- if (test_thread_flag(TIF_RESTORE_SIGMASK))761761- oldset = ¤t->saved_sigmask;762762- else763763- oldset = ¤t->blocked;764764-765765- signr = get_signal_to_deliver(&info, &ka, regs, NULL);766766- if (signr > 0) {767767- /* Whee! Actually deliver the signal. */768768- if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {769769- /*770770- * A signal was successfully delivered; the saved771771- * sigmask will have been stored in the signal frame,772772- * and will be restored by sigreturn, so we can simply773773- * clear the TIF_RESTORE_SIGMASK flag.774774- */775775- if (test_thread_flag(TIF_RESTORE_SIGMASK))776776- clear_thread_flag(TIF_RESTORE_SIGMASK);777777- }778778-779779- return;780780- }781781-782782- /*783783- * Who's code doesn't conform to the restartable syscall convention784784- * dies here!!! The li instruction, a single machine instruction,785785- * must directly be followed by the syscall instruction.786786- */787787- if (regs->regs[0]) {788788- if (regs->regs[2] == ERESTARTNOHAND ||789789- regs->regs[2] == ERESTARTSYS ||790790- regs->regs[2] == ERESTARTNOINTR) {791791- regs->regs[7] = regs->regs[26];792792- regs->cp0_epc -= 8;793793- }794794- if (regs->regs[2] == ERESTART_RESTARTBLOCK) {795795- regs->regs[2] = __NR_O32_restart_syscall;796796- regs->regs[7] = regs->regs[26];797797- regs->cp0_epc -= 4;798798- }799799- regs->regs[0] = 0; /* Don't deal with this again. */800800- }801801-802802- /*803803- * If there's no signal to deliver, we just put the saved sigmask804804- * back805805- */806806- if (test_thread_flag(TIF_RESTORE_SIGMASK)) {807807- clear_thread_flag(TIF_RESTORE_SIGMASK);808808- sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL);809809- }810810-}707707+/*708708+ * o32 compatibility on 64-bit kernels, without DSP ASE709709+ */710710+struct mips_abi mips_abi_32 = {711711+ .setup_frame = setup_frame_32,712712+ .setup_rt_frame = setup_rt_frame_32,713713+ .restart = __NR_O32_restart_syscall714714+};811715812716asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,813717 struct sigaction32 __user *oact,