diff options
Diffstat (limited to 'sys/arch/mips64/include/atomic.h')
-rw-r--r-- | sys/arch/mips64/include/atomic.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/arch/mips64/include/atomic.h b/sys/arch/mips64/include/atomic.h index ea4a2a7f121..7731a67baaa 100644 --- a/sys/arch/mips64/include/atomic.h +++ b/sys/arch/mips64/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.5 2009/11/27 00:08:27 syuu Exp $ */ +/* $OpenBSD: atomic.h,v 1.6 2009/12/28 06:55:27 syuu Exp $ */ /* Public Domain */ @@ -7,6 +7,24 @@ #if defined(_KERNEL) +/* wait until the bits to set are clear, and set them */ +static __inline void +atomic_wait_and_setbits_int(__volatile unsigned int *uip, unsigned int v) +{ + unsigned int tmp0, tmp1; + + __asm__ __volatile__ ( + "1: ll %0, 0(%2)\n" + " and %1, %0, %3\n" + " bnez %1, 1b\n" + " or %0, %3, %0\n" + " sc %0, 0(%2)\n" + " beqz %0, 1b\n" + " nop\n" : + "=&r"(tmp0), "=&r"(tmp1) : + "r"(uip), "r"(v) : "memory"); +} + static __inline void atomic_setbits_int(__volatile unsigned int *uip, unsigned int v) { |