diff options
author | 2012-08-30 20:57:00 +0000 | |
---|---|---|
committer | 2012-08-30 20:57:00 +0000 | |
commit | 2815e36e59e268d49d0b47f1f5bac95f6fab5536 (patch) | |
tree | f41555fd3e6d6932c77adacd93d787e46ef2b61b | |
parent | Slightly tweak the way we set up the code patch sections such that we can (diff) | |
download | wireguard-openbsd-2815e36e59e268d49d0b47f1f5bac95f6fab5536.tar.xz wireguard-openbsd-2815e36e59e268d49d0b47f1f5bac95f6fab5536.zip |
On SPARC64 VI/VII CPUs, use the sleep instruction while spinning to force a
thread switch in the hope the other thread can do some useful work.
-rw-r--r-- | sys/arch/sparc64/sparc64/lock_machdep.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/lock_machdep.c b/sys/arch/sparc64/sparc64/lock_machdep.c index 7577eda10c1..08b07682b3e 100644 --- a/sys/arch/sparc64/sparc64/lock_machdep.c +++ b/sys/arch/sparc64/sparc64/lock_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lock_machdep.c,v 1.1 2007/11/27 23:29:57 kettenis Exp $ */ +/* $OpenBSD: lock_machdep.c,v 1.2 2012/08/30 20:57:00 kettenis Exp $ */ /* * Copyright (c) 2007 Artur Grabowski <art@openbsd.org> @@ -43,7 +43,19 @@ __mp_lock_init(struct __mp_lock *lock) extern int __mp_lock_spinout; #endif -#define SPINLOCK_SPIN_HOOK /**/ +static __inline void +__mp_lock_spin_hook(void) +{ + __asm __volatile( + "999: nop \n" + " .section .sun4u_mtp_patch, \"ax\" \n" + " .word 999b \n" + " .word 0x81b01060 ! sleep \n" + " .previous \n" + : : : "memory"); +} + +#define SPINLOCK_SPIN_HOOK __mp_lock_spin_hook() static __inline void __mp_lock_spin(struct __mp_lock *mpl) |