opensolaris_atomic.c (183154) | opensolaris_atomic.c (185029) |
---|---|
1/*- 2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c 183154 2008-09-18 19:57:06Z imp $"); | 28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c 185029 2008-11-17 20:49:29Z pjd $"); |
29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/atomic.h> 34 35#ifdef _KERNEL 36#include <sys/kernel.h> --- 19 unchanged lines hidden (view full) --- 56void 57atomic_add_64(volatile uint64_t *target, int64_t delta) 58{ 59 60 mtx_lock(&atomic_mtx); 61 *target += delta; 62 mtx_unlock(&atomic_mtx); 63} | 29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/atomic.h> 34 35#ifdef _KERNEL 36#include <sys/kernel.h> --- 19 unchanged lines hidden (view full) --- 56void 57atomic_add_64(volatile uint64_t *target, int64_t delta) 58{ 59 60 mtx_lock(&atomic_mtx); 61 *target += delta; 62 mtx_unlock(&atomic_mtx); 63} |
64 65void 66atomic_dec_64(volatile uint64_t *target) 67{ 68 69 mtx_lock(&atomic_mtx); 70 *target -= 1; 71 mtx_unlock(&atomic_mtx); 72} |
|
64#endif 65 66uint64_t 67atomic_add_64_nv(volatile uint64_t *target, int64_t delta) 68{ 69 uint64_t newval; 70 71 mtx_lock(&atomic_mtx); --- 63 unchanged lines hidden --- | 73#endif 74 75uint64_t 76atomic_add_64_nv(volatile uint64_t *target, int64_t delta) 77{ 78 uint64_t newval; 79 80 mtx_lock(&atomic_mtx); --- 63 unchanged lines hidden --- |