Commit 92649494 authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: optimize fixed code handling for the most common case

The majority of the time we are returning to user space, it is not in the
fixed atomic code region.  So rather than branch to a function where we
check the PC and return, do the check inline and branch only when needed.

Also, tweak some of the fixed code handling based on assumptions we are
aware of but cannot be expressed in C.
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent dac98174
...@@ -282,24 +282,18 @@ void finish_atomic_sections (struct pt_regs *regs) ...@@ -282,24 +282,18 @@ void finish_atomic_sections (struct pt_regs *regs)
{ {
int __user *up0 = (int __user *)regs->p0; int __user *up0 = (int __user *)regs->p0;
if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END)
return;
switch (regs->pc) { switch (regs->pc) {
case ATOMIC_XCHG32 + 2: case ATOMIC_XCHG32 + 2:
put_user(regs->r1, up0); put_user(regs->r1, up0);
regs->pc += 2; regs->pc = ATOMIC_XCHG32 + 4;
break; break;
case ATOMIC_CAS32 + 2: case ATOMIC_CAS32 + 2:
case ATOMIC_CAS32 + 4: case ATOMIC_CAS32 + 4:
if (regs->r0 == regs->r1) if (regs->r0 == regs->r1)
put_user(regs->r2, up0);
regs->pc = ATOMIC_CAS32 + 8;
break;
case ATOMIC_CAS32 + 6: case ATOMIC_CAS32 + 6:
put_user(regs->r2, up0); put_user(regs->r2, up0);
regs->pc += 2; regs->pc = ATOMIC_CAS32 + 8;
break; break;
case ATOMIC_ADD32 + 2: case ATOMIC_ADD32 + 2:
......
...@@ -1025,6 +1025,12 @@ ENTRY(_schedule_and_signal_from_int) ...@@ -1025,6 +1025,12 @@ ENTRY(_schedule_and_signal_from_int)
#endif #endif
sti r0; sti r0;
/* finish the userspace "atomic" functions for it */
r1 = FIXED_CODE_END;
r2 = [sp + PT_PC];
cc = r1 <= r2;
if cc jump .Lresume_userspace (bp);
r0 = sp; r0 = sp;
sp += -12; sp += -12;
call _finish_atomic_sections; call _finish_atomic_sections;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment