Add fake atomic 64 ops for those who don't have them.

XXX: used to be arm, now it is also i386.
This commit is contained in:
christos 2014-04-22 15:02:38 +00:00
parent 3622a5285b
commit c8ad22d607
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 2013/09/11 23:04:10 joerg Exp $
# $NetBSD: Makefile,v 1.9 2014/04/22 15:02:38 christos Exp $
.include "${.CURDIR}/../../dist/uts/common/Makefile.files"
.include "../../Makefile.zfs"
@ -21,10 +21,7 @@ CPPFLAGS+= -std=c99
#CPPFLAGS+=-Wall -Wno-unknown-pragmas
# Local stuff
SRCS= kernel.c kernel2.c
.if ${MACHINE_ARCH} == "arm"
SRCS+= atomic.c
.endif
SRCS= kernel.c kernel2.c atomic.c
# Sun stuff
SRCS+= ${ZFS_COMMON_OBJS:C/.o$/.c/}

View File

@ -1,7 +1,10 @@
#include <inttypes.h>
#include <sys/types.h>
#include <sys/atomic.h>
#ifndef __HAVE_ATOMIC64_OPS
/* XXX: Not so atomic, could use mutexes but not worth it */
uint64_t
atomic_cas_64(volatile uint64_t *ptr, uint64_t old, uint64_t new) {
@ -30,3 +33,5 @@ uint64_t
atomic_add_64_nv(volatile uint64_t *ptr, int64_t delta) {
return *ptr += delta;
}
#endif