Loading arch/sh/include/asm/syscall_64.h +75 −1 Original line number Diff line number Diff line #ifndef __ASM_SH_SYSCALL_64_H #define __ASM_SH_SYSCALL_64_H #include <asm-generic/syscall.h> #include <linux/kernel.h> #include <linux/sched.h> #include <asm/ptrace.h> /* The system call number is given by the user in R9 */ static inline long syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L; } static inline void syscall_rollback(struct task_struct *task, struct pt_regs *regs) { /* * XXX: This needs some thought. On SH we don't * save away the original R9 value anywhere. */ } static inline bool syscall_has_error(struct pt_regs *regs) { return (regs->sr & 0x1) ? true : false; } static inline void syscall_set_error(struct pt_regs *regs) { regs->sr |= 0x1; } static inline void syscall_clear_error(struct pt_regs *regs) { regs->sr &= ~0x1; } static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { return syscall_has_error(regs) ? regs->regs[9] : 0; } static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { return regs->regs[9]; } static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { if (error) { syscall_set_error(regs); regs->regs[9] = -error; } else { syscall_clear_error(regs); regs->regs[9] = val; } } static inline void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, unsigned int i, unsigned int n, unsigned long *args) { BUG_ON(i + n > 6); memcpy(args, ®s->reg[2 + i], n * sizeof(args[0])); } static inline void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, unsigned int i, unsigned int n, const unsigned long *args) { BUG_ON(i + n > 6); memcpy(®s->reg[2 + i], args, n * sizeof(args[0])); } #endif /* __ASM_SH_SYSCALL_64_H */ arch/sh/kernel/signal_32.c +0 −1 Original line number Diff line number Diff line Loading @@ -533,7 +533,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, { int ret; /* Set up the stack frame */ if (ka->sa.sa_flags & SA_SIGINFO) ret = setup_rt_frame(sig, ka, info, oldset, regs); Loading arch/sh/kernel/signal_64.c +33 −30 Original line number Diff line number Diff line Loading @@ -47,6 +47,34 @@ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs); static inline void handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) { /* If we're not from a syscall, bail out */ if (regs->syscall_nr < 0) return; /* check for system call restart.. */ switch (regs->regs[REG_RET]) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: no_system_call_restart: regs->regs[REG_RET] = -EINTR; regs->sr |= 1; break; case -ERESTARTSYS: if (!(sa->sa_flags & SA_RESTART)) goto no_system_call_restart; /* fallthrough */ case -ERESTARTNOINTR: /* Decode syscall # */ regs->regs[REG_RET] = regs->syscall_nr; regs->pc -= 4; break; } } /* * Note that 'init' is a special process: it doesn't get signals it doesn't * want to handle. Thus you cannot kill init even with a SIGKILL even by Loading Loading @@ -81,6 +109,9 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) signr = get_signal_to_deliver(&info, &ka, regs, 0); if (signr > 0) { if (regs->sr & 1) handle_syscall_restart(regs, &ka.sa); /* Whee! Actually deliver the signal. */ if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { /* Loading Loading @@ -128,7 +159,6 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) /* * Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r3, unsigned long r4, unsigned long r5, Loading Loading @@ -234,20 +264,16 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, return do_sigaltstack(uss, uoss, REF_REG_SP); } /* * Do a signal return; undo the signal stack. */ struct sigframe { struct sigframe { struct sigcontext sc; unsigned long extramask[_NSIG_WORDS-1]; long long retcode[2]; }; struct rt_sigframe { struct rt_sigframe { struct siginfo __user *pinfo; void *puc; struct siginfo info; Loading Loading @@ -449,7 +475,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3, /* * Set up a signal frame. */ static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask) Loading Loading @@ -714,34 +739,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, /* * OK, we're invoking a handler */ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs) { int ret; /* Are we from a system call? */ if (regs->syscall_nr >= 0) { /* If so, check system call restarting.. */ switch (regs->regs[REG_RET]) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: no_system_call_restart: regs->regs[REG_RET] = -EINTR; break; case -ERESTARTSYS: if (!(ka->sa.sa_flags & SA_RESTART)) goto no_system_call_restart; /* fallthrough */ case -ERESTARTNOINTR: /* Decode syscall # */ regs->regs[REG_RET] = regs->syscall_nr; regs->pc -= 4; } } /* Set up the stack frame */ if (ka->sa.sa_flags & SA_SIGINFO) ret = setup_rt_frame(sig, ka, info, oldset, regs); Loading Loading
arch/sh/include/asm/syscall_64.h +75 −1 Original line number Diff line number Diff line #ifndef __ASM_SH_SYSCALL_64_H #define __ASM_SH_SYSCALL_64_H #include <asm-generic/syscall.h> #include <linux/kernel.h> #include <linux/sched.h> #include <asm/ptrace.h> /* The system call number is given by the user in R9 */ static inline long syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L; } static inline void syscall_rollback(struct task_struct *task, struct pt_regs *regs) { /* * XXX: This needs some thought. On SH we don't * save away the original R9 value anywhere. */ } static inline bool syscall_has_error(struct pt_regs *regs) { return (regs->sr & 0x1) ? true : false; } static inline void syscall_set_error(struct pt_regs *regs) { regs->sr |= 0x1; } static inline void syscall_clear_error(struct pt_regs *regs) { regs->sr &= ~0x1; } static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { return syscall_has_error(regs) ? regs->regs[9] : 0; } static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { return regs->regs[9]; } static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { if (error) { syscall_set_error(regs); regs->regs[9] = -error; } else { syscall_clear_error(regs); regs->regs[9] = val; } } static inline void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, unsigned int i, unsigned int n, unsigned long *args) { BUG_ON(i + n > 6); memcpy(args, ®s->reg[2 + i], n * sizeof(args[0])); } static inline void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, unsigned int i, unsigned int n, const unsigned long *args) { BUG_ON(i + n > 6); memcpy(®s->reg[2 + i], args, n * sizeof(args[0])); } #endif /* __ASM_SH_SYSCALL_64_H */
arch/sh/kernel/signal_32.c +0 −1 Original line number Diff line number Diff line Loading @@ -533,7 +533,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, { int ret; /* Set up the stack frame */ if (ka->sa.sa_flags & SA_SIGINFO) ret = setup_rt_frame(sig, ka, info, oldset, regs); Loading
arch/sh/kernel/signal_64.c +33 −30 Original line number Diff line number Diff line Loading @@ -47,6 +47,34 @@ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs); static inline void handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) { /* If we're not from a syscall, bail out */ if (regs->syscall_nr < 0) return; /* check for system call restart.. */ switch (regs->regs[REG_RET]) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: no_system_call_restart: regs->regs[REG_RET] = -EINTR; regs->sr |= 1; break; case -ERESTARTSYS: if (!(sa->sa_flags & SA_RESTART)) goto no_system_call_restart; /* fallthrough */ case -ERESTARTNOINTR: /* Decode syscall # */ regs->regs[REG_RET] = regs->syscall_nr; regs->pc -= 4; break; } } /* * Note that 'init' is a special process: it doesn't get signals it doesn't * want to handle. Thus you cannot kill init even with a SIGKILL even by Loading Loading @@ -81,6 +109,9 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) signr = get_signal_to_deliver(&info, &ka, regs, 0); if (signr > 0) { if (regs->sr & 1) handle_syscall_restart(regs, &ka.sa); /* Whee! Actually deliver the signal. */ if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { /* Loading Loading @@ -128,7 +159,6 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) /* * Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r3, unsigned long r4, unsigned long r5, Loading Loading @@ -234,20 +264,16 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, return do_sigaltstack(uss, uoss, REF_REG_SP); } /* * Do a signal return; undo the signal stack. */ struct sigframe { struct sigframe { struct sigcontext sc; unsigned long extramask[_NSIG_WORDS-1]; long long retcode[2]; }; struct rt_sigframe { struct rt_sigframe { struct siginfo __user *pinfo; void *puc; struct siginfo info; Loading Loading @@ -449,7 +475,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3, /* * Set up a signal frame. */ static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask) Loading Loading @@ -714,34 +739,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, /* * OK, we're invoking a handler */ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs) { int ret; /* Are we from a system call? */ if (regs->syscall_nr >= 0) { /* If so, check system call restarting.. */ switch (regs->regs[REG_RET]) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: no_system_call_restart: regs->regs[REG_RET] = -EINTR; break; case -ERESTARTSYS: if (!(ka->sa.sa_flags & SA_RESTART)) goto no_system_call_restart; /* fallthrough */ case -ERESTARTNOINTR: /* Decode syscall # */ regs->regs[REG_RET] = regs->syscall_nr; regs->pc -= 4; } } /* Set up the stack frame */ if (ka->sa.sa_flags & SA_SIGINFO) ret = setup_rt_frame(sig, ka, info, oldset, regs); Loading