/*
- * Copyright (C) 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: atomic.h,v 1.6.128.1 2009/10/14 04:04:48 marka Exp $ */
+/* $Id: atomic.h,v 1.6.128.2 2009/10/14 23:46:42 tbox Exp $ */
#ifndef ISC_ATOMIC_H
#define ISC_ATOMIC_H 1
int ret;
#ifdef __GNUC__
- asm("ics");
+ asm("ics");
#else
- __isync();
+ __isync();
#endif
ret = fetch_and_add((atomic_p)p, (int)val);
#ifdef __GNUC__
- asm("ics");
+ asm("ics");
#else
- __isync();
+ __isync();
#endif
return (ret);
static int
#endif
isc_atomic_cmpxchg(atomic_p p, int old, int new) {
- int orig = old;
+ int orig = old;
#ifdef __GNUC__
- asm("ics");
+ asm("ics");
#else
- __isync();
+ __isync();
#endif
- if (compare_and_swap(p, &orig, new))
+ if (compare_and_swap(p, &orig, new))
orig = old;
#ifdef __GNUC__
- asm("ics");
+ asm("ics");
#else
- __isync();
+ __isync();
#endif
- return (orig);
+ return (orig);
}
#elif defined(ISC_PLATFORM_USEGCCASM) || defined(ISC_PLATFORM_USEMACASM)
#ifdef ISC_PLATFORM_USEMACASM
"1:"
"lwarx r6, 0, %1\n"
- "mr %0, r6\n"
+ "mr %0, r6\n"
"add r6, r6, %2\n"
"stwcx. r6, 0, %1\n"
"bne- 1b"
#else
"1:"
"lwarx 6, 0, %1\n"
- "mr %0, 6\n"
+ "mr %0, 6\n"
"add 6, 6, %2\n"
"stwcx. 6, 0, %1\n"
"bne- 1b"