From: Bernd Schmidt Date: Wed, 23 Apr 2008 18:51:36 +0000 (+0800) Subject: [Blackfin] arch: a rather old performance improvement for the signal handling code X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=697a9d65aa799940da1c9145944c6b9bd0f442c5;p=linux-2.6 [Blackfin] arch: a rather old performance improvement for the signal handling code This is a rather old performance improvement for the signal handling code, which was originally only committed on the 2007R1 branch as a workaround for what we suspected to be a hardware bug. There's no point in constructing a sigreturn stub on the stack and flushing caches; we can just make signal handlers return to a known location in the fixed code area. Signed-off-by: Bernd Schmidt Signed-off-by: Bryan Wu --- diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 71cfcd28b3..d1fa24401d 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c @@ -38,6 +38,7 @@ #include #include +#include #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) @@ -50,6 +51,8 @@ struct rt_sigframe { int sig; struct siginfo *pinfo; void *puc; + /* This is no longer needed by the kernel, but unfortunately userspace + * code expects it to be there. */ char retcode[8]; struct siginfo info; struct ucontext uc; @@ -159,11 +162,6 @@ static inline int rt_setup_sigcontext(struct sigcontext *sc, struct pt_regs *reg return err; } -static inline void push_cache(unsigned long vaddr, unsigned int len) -{ - flush_icache_range(vaddr, vaddr + len); -} - static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) { @@ -209,19 +207,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, err |= rt_setup_sigcontext(&frame->uc.uc_mcontext, regs); err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); - /* Set up to return from userspace. */ - err |= __put_user(0x28, &(frame->retcode[0])); - err |= __put_user(0xe1, &(frame->retcode[1])); - err |= __put_user(0xad, &(frame->retcode[2])); - err |= __put_user(0x00, &(frame->retcode[3])); - err |= __put_user(0xa0, &(frame->retcode[4])); - err |= __put_user(0x00, &(frame->retcode[5])); - if (err) goto give_sigsegv; - push_cache((unsigned long)&frame->retcode, sizeof(frame->retcode)); - /* Set up registers for signal handler */ wrusp((unsigned long)frame); if (get_personality & FDPIC_FUNCPTRS) { @@ -231,7 +219,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, __get_user(regs->p3, &funcptr->GOT); } else regs->pc = (unsigned long)ka->sa.sa_handler; - regs->rets = (unsigned long)(frame->retcode); + regs->rets = SIGRETURN_STUB; regs->r0 = frame->sig; regs->r1 = (unsigned long)(&frame->info);