- provide 32 bit versions of the sparc v9 atomic ops.

- use them on sparc64 32 bit kernels.

fixes issues on 32 bit sparc64 kernels that were using sparc v8 ops.
tested by rjs@.
This commit is contained in:
mrg 2007-12-22 23:19:40 +00:00
parent 1247e31569
commit 97e461c633
10 changed files with 115 additions and 55 deletions

View File

@ -1,6 +1,16 @@
# $NetBSD: Makefile.inc,v 1.3 2007/11/29 15:29:46 ad Exp $
# $NetBSD: Makefile.inc,v 1.4 2007/12/22 23:19:40 mrg Exp $
.if defined(LIB) && (${LIB} == "kern")
.include <bsd.own.mk>
.if ${MACHINE} == "sparc64"
SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic
.PATH: ${SPARC64DIR}
.include "${SPARC64DIR}/Makefile.inc"
.else
. if defined(LIB) && (${LIB} == "kern")
SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
@ -8,4 +18,6 @@ SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
atomic_or_32_nv_cas.c atomic_swap_32_cas.c \
atomic_cas.S membar_ops.S
. endif
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_op_asm.h,v 1.2 2007/11/29 02:01:22 ad Exp $ */
/* $NetBSD: atomic_op_asm.h,v 1.3 2007/12/22 23:19:40 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -43,12 +43,30 @@
#if defined(_KERNEL)
#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
#ifdef __sparc64__
#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
#else
#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
#endif
#else /* _KERNEL */
#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
#ifdef __sparc64__
#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64)
#else
#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32)
#endif
#endif /* _KERNEL */
#ifdef __sparc64__
#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
#else
#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
#endif
#endif /* _ATOMIC_OP_ASM_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_add.S,v 1.2 2007/11/28 17:29:31 ad Exp $ */
/* $NetBSD: atomic_add.S,v 1.3 2007/12/22 23:19:40 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -68,14 +68,16 @@ ENTRY_NOPROFILE(_atomic_add_64)
retl
add %o1, %o2, %o0
ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64)
STRONG_ALIAS(_atomic_add_long,_atomic_add_64)
ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64)
STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64)
ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64)
STRONG_ALIAS(_atomic_add_64_nv,_atomic_add_64)
ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64)
STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64)
ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64)
STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64)
ATOMIC_OP_ALIAS_SIZE(atomic_add_long,_atomic_add)
STRONG_ALIAS_SIZE(_atomic_add_long,_atomic_add)
ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr,_atomic_add)
STRONG_ALIAS_SIZE(_atomic_add_ptr,_atomic_add)
ATOMIC_OP_ALIAS_SIZE(atomic_add_long_nv,_atomic_add)
STRONG_ALIAS_SIZE(_atomic_add_long_nv,_atomic_add)
ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr_nv,_atomic_add)
STRONG_ALIAS_SIZE(_atomic_add_ptr_nv,_atomic_add)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_and.S,v 1.2 2007/11/28 17:29:32 ad Exp $ */
/* $NetBSD: atomic_and.S,v 1.3 2007/12/22 23:19:40 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -68,10 +68,12 @@ ENTRY_NOPROFILE(_atomic_and_64)
retl
and %o1, %o2, %o0
ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64)
STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64)
ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64)
STRONG_ALIAS(_atomic_and_64_nv,_atomic_and_64)
ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64)
STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64)
ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong,_atomic_and)
STRONG_ALIAS_SIZE(_atomic_and_ulong,_atomic_and)
ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong_nv,_atomic_and)
STRONG_ALIAS_SIZE(_atomic_and_ulong_nv,_atomic_and)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_cas.S,v 1.2 2007/11/28 17:29:32 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.3 2007/12/22 23:19:40 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -53,7 +53,8 @@ ENTRY_NOPROFILE(_atomic_cas_64)
retl
mov %o2, %o0
ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_dec.S,v 1.3 2007/11/30 17:11:48 ad Exp $ */
/* $NetBSD: atomic_dec.S,v 1.4 2007/12/22 23:19:41 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -68,14 +68,16 @@ ENTRY_NOPROFILE(_atomic_dec_64)
retl
add %o2, -1, %o0
ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64)
ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64)
ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64)
ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_64_nv,_atomic_dec_64)
ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64)
ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64)
ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong,_atomic_dec)
STRONG_ALIAS_SIZE(_atomic_dec_ulong,_atomic_dec)
ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr,_atomic_dec)
STRONG_ALIAS_SIZE(_atomic_dec_ptr,_atomic_dec)
ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong_nv,_atomic_dec)
STRONG_ALIAS_SIZE(_atomic_dec_ulong_nv,_atomic_dec)
ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr_nv,_atomic_dec)
STRONG_ALIAS_SIZE(_atomic_dec_ptr_nv,_atomic_dec)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_inc.S,v 1.2 2007/11/28 17:29:32 ad Exp $ */
/* $NetBSD: atomic_inc.S,v 1.3 2007/12/22 23:19:41 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -68,14 +68,16 @@ ENTRY_NOPROFILE(_atomic_inc_64)
retl
add %o2, 1, %o0
ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64)
ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64)
ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64)
ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_64_nv,_atomic_inc_64)
ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64)
ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64)
ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong,_atomic_inc)
STRONG_ALIAS_SIZE(_atomic_inc_ulong,_atomic_inc)
ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr,_atomic_inc)
STRONG_ALIAS_SIZE(_atomic_inc_ptr,_atomic_inc)
ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong_nv,_atomic_inc)
STRONG_ALIAS_SIZE(_atomic_inc_ulong_nv,_atomic_inc)
ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr_nv,_atomic_inc)
STRONG_ALIAS_SIZE(_atomic_inc_ptr_nv,_atomic_inc)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_op_asm.h,v 1.2 2007/11/28 17:29:32 ad Exp $ */
/* $NetBSD: atomic_op_asm.h,v 1.3 2007/12/22 23:19:41 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -43,12 +43,30 @@
#if defined(_KERNEL)
#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
#ifdef __sparc64__
#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
#else
#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
#endif
#else /* _KERNEL */
#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
#ifdef __sparc64__
#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64)
#else
#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32)
#endif
#endif /* _KERNEL */
#ifdef __sparc64__
#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
#else
#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
#endif
#endif /* _ATOMIC_OP_ASM_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_or.S,v 1.2 2007/11/28 17:29:33 ad Exp $ */
/* $NetBSD: atomic_or.S,v 1.3 2007/12/22 23:19:41 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -68,10 +68,12 @@ ENTRY_NOPROFILE(_atomic_or_64)
retl
or %o1, %o2, %o0
ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64)
STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64)
ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64)
STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64)
ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64)
STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64)
ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong,_atomic_or)
STRONG_ALIAS(_atomic_or_ulong,_atomic_or)
ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong_nv,_atomic_or)
STRONG_ALIAS_SIZE(_atomic_or_ulong_nv,_atomic_or)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_swap.S,v 1.2 2007/11/28 17:29:33 ad Exp $ */
/* $NetBSD: atomic_swap.S,v 1.3 2007/12/22 23:19:41 mrg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -63,7 +63,8 @@ ENTRY_NOPROFILE(_atomic_swap_64)
retl
mov %o3, %o0
ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64)
ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64)
STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64)
ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64)
STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64)
ATOMIC_OP_ALIAS_SIZE(atomic_swap_ulong,_atomic_swap)
STRONG_ALIAS_SIZE(_atomic_swap_ulong,_atomic_swap)
ATOMIC_OP_ALIAS_SIZE(atomic_swap_ptr,_atomic_swap)
STRONG_ALIAS_SIZE(_atomic_swap_ptr,_atomic_swap)