1) Gate immediately and save a branch.
2) Fix off by one error in checking entry number.
3) Use sr7 instead of sr3 in error return path as sr3 might not
contain correct value.
4) Enable locking on UP systems to prevent incorrect operation of
the cas_action critical region on page faults.
Tested on several systems, including UP c3750 with 2.6.33.2 kernel.
Signed-off-by: John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
- /* ADDRESS 0xb0 to 0xb4, lws uses 1 insns for entry */
+ /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */
/* Light-weight-syscall entry must always be located at 0xb0 */
/* WARNING: Keep this number updated with table size changes */
#define __NR_lws_entries (2)
lws_entry:
/* Light-weight-syscall entry must always be located at 0xb0 */
/* WARNING: Keep this number updated with table size changes */
#define __NR_lws_entries (2)
lws_entry:
- /* Unconditional branch to lws_start, located on the
- same gateway page */
- b,n lws_start
+ gate lws_start, %r0 /* increase privilege */
+ depi 3, 31, 2, %r31 /* Ensure we return into user mode. */
- /* Fill from 0xb4 to 0xe0 */
- .rept 11
+ /* Fill from 0xb8 to 0xe0 */
+ .rept 10
*********************************************************/
lws_start:
*********************************************************/
lws_start:
- /* Gate and ensure we return to userspace */
- gate .+8, %r0
- depi 3, 31, 2, %r31 /* Ensure we return to userspace */
#ifdef CONFIG_64BIT
/* FIXME: If we are a 64-bit kernel just
#ifdef CONFIG_64BIT
/* FIXME: If we are a 64-bit kernel just
#endif
/* Is the lws entry number valid? */
#endif
/* Is the lws entry number valid? */
- comiclr,>>= __NR_lws_entries, %r20, %r0
+ comiclr,>> __NR_lws_entries, %r20, %r0
b,n lws_exit_nosys
/* WARNING: Trashing sr2 and sr3 */
b,n lws_exit_nosys
/* WARNING: Trashing sr2 and sr3 */
/* now reset the lowest bit of sp if it was set */
xor %r30,%r1,%r30
#endif
/* now reset the lowest bit of sp if it was set */
xor %r30,%r1,%r30
#endif
#endif
lws_compare_and_swap:
#endif
lws_compare_and_swap:
/* Load start of lock table */
ldil L%lws_lock_start, %r20
ldo R%lws_lock_start(%r20), %r28
/* Load start of lock table */
ldil L%lws_lock_start, %r20
ldo R%lws_lock_start(%r20), %r28
ldo 2(%r0), %r28 /* 2nd case */
b lws_exit /* Contended... */
ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
ldo 2(%r0), %r28 /* 2nd case */
b lws_exit /* Contended... */
ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
-#endif
-/* CONFIG_SMP */
1: ldw 0(%sr3,%r26), %r28
sub,<> %r28, %r25, %r0
2: stw %r24, 0(%sr3,%r26)
1: ldw 0(%sr3,%r26), %r28
sub,<> %r28, %r25, %r0
2: stw %r24, 0(%sr3,%r26)
/* Free lock */
stw %r20, 0(%sr2,%r20)
/* Free lock */
stw %r20, 0(%sr2,%r20)
/* Clear thread register indicator */
stw %r0, 4(%sr2,%r20)
/* Clear thread register indicator */
stw %r0, 4(%sr2,%r20)
#endif
/* Return to userspace, set no error */
b lws_exit
#endif
/* Return to userspace, set no error */
b lws_exit
3:
/* Error occured on load or store */
3:
/* Error occured on load or store */
/* Free lock */
stw %r20, 0(%sr2,%r20)
/* Free lock */
stw %r20, 0(%sr2,%r20)
#endif
b lws_exit
ldo -EFAULT(%r0),%r21 /* set errno */
#endif
b lws_exit
ldo -EFAULT(%r0),%r21 /* set errno */
END(sys_call_table64)
#endif
END(sys_call_table64)
#endif
/*
All light-weight-syscall atomic operations
will use this set of locks
/*
All light-weight-syscall atomic operations
will use this set of locks
.endr
END(lws_lock_start)
.previous
.endr
END(lws_lock_start)
.previous
-#endif
-/* CONFIG_SMP for lws_lock_start */