Skip to content

Commit

Permalink
[Blackfin] arch: a rather old performance improvement for the signal …
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Signed-off-by: Bryan Wu <[email protected]>
  • Loading branch information
bernds authored and Bryan Wu committed Apr 23, 2008
1 parent 5af29f5 commit 697a9d6
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions arch/blackfin/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <asm/cacheflush.h>
#include <asm/ucontext.h>
#include <asm/fixed_code.h>

#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))

Expand All @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 697a9d6

Please sign in to comment.