Sun Mar 23 00:12:46 2008 UTC ()
sync with HEAD


(matt)
diff -r1.6.16.1 -r1.6.16.2 src/common/lib/libc/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/atomic_cas.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/membar_ops.S
diff -r1.2 -r1.2.18.1 src/common/lib/libc/arch/alpha/gen/byte_swap_2.S
diff -r1.2 -r1.2.18.1 src/common/lib/libc/arch/alpha/gen/byte_swap_4.S
diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/arm/atomic/Makefile.inc
diff -r1.1.4.2 -r1.1.4.3 src/common/lib/libc/arch/hppa/atomic/Makefile.inc
diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/i386/atomic/Makefile.inc
diff -r1.7.2.2 -r1.7.2.3 src/common/lib/libc/arch/i386/atomic/atomic.S
diff -r0 -r1.1.2.2 src/common/lib/libc/arch/ia64/atomic/Makefile.inc
diff -r0 -r1.1.2.2 src/common/lib/libc/arch/ia64/atomic/atomic.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/m68k/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S
diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_and.S
diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_or.S
diff -r1.4.4.2 -r1.4.4.3 src/common/lib/libc/arch/mips/atomic/Makefile.inc
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/gen/byte_swap_2.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/gen/byte_swap_4.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/bcmp.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/bcopy.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/bzero.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/ffs.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/memchr.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/memcmp.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/memcpy.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/memmove.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/memset.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strcat.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strchr.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strcmp.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strcpy.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strlen.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strncmp.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strncpy.S
diff -r1.1 -r0 src/common/lib/libc/arch/ns32k/string/strrchr.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_add.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_and.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_cas.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_dec.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_inc.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_or.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_swap.S
diff -r0 -r1.1.2.2 src/common/lib/libc/arch/powerpc/string/bcopy.S
diff -r0 -r1.2.2.2 src/common/lib/libc/arch/powerpc/string/memcmp.S
diff -r0 -r1.2.2.2 src/common/lib/libc/arch/powerpc/string/memcpy.S
diff -r0 -r1.2.2.2 src/common/lib/libc/arch/powerpc/string/memmove.S
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc64/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc64/atomic/atomic_cas.S
diff -r1.1.4.2 -r1.1.4.3 src/common/lib/libc/arch/sh3/atomic/Makefile.inc
diff -r1.1 -r1.1.18.1 src/common/lib/libc/arch/sh3/string/memset.S
diff -r1.4.2.2 -r1.4.2.3 src/common/lib/libc/arch/sparc/atomic/Makefile.inc
diff -r1.4.4.2 -r1.4.4.3 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S
diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/sparc64/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/sparc64/atomic/membar_ops.S
diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_cas.S
diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h
diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_or.S
diff -r0 -r1.3.4.2 src/common/lib/libc/arch/vax/atomic/Makefile.inc
diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/x86_64/atomic/Makefile.inc
diff -r1.7.4.2 -r1.7.4.3 src/common/lib/libc/arch/x86_64/atomic/atomic.S
diff -r0 -r1.2.4.2 src/common/lib/libc/atomic/atomic_init_cas.c
diff -r0 -r1.3.4.2 src/common/lib/libc/atomic/atomic_init_testset.c
diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/atomic/atomic_ops.3
diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/atomic/membar_ops.3
diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap16.c
diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap32.c
diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap64.c
diff -r1.3 -r1.3.4.1 src/common/lib/libc/hash/rmd160/rmd160.c
diff -r1.2 -r1.2.16.1 src/common/lib/libc/hash/sha1/sha1.c
diff -r1.6 -r1.6.4.1 src/common/lib/libc/hash/sha2/sha2.c
diff -r1.1 -r1.1.18.1 src/common/lib/libc/inet/inet_addr.c
diff -r1.2 -r1.2.18.1 src/common/lib/libc/md/md4c.c
diff -r1.2 -r1.2.18.1 src/common/lib/libc/md/md5c.c
diff -r1.2 -r1.2.4.1 src/common/lib/libc/string/memchr.c
diff -r1.2 -r1.2.4.1 src/common/lib/libc/string/strchr.c
diff -r1.3 -r1.3.4.1 src/common/lib/libc/string/strrchr.c
diff -r1.5.2.1 -r1.5.2.2 src/common/lib/libprop/prop_array.3
diff -r1.3 -r1.3.2.1 src/common/lib/libprop/prop_bool.3
diff -r1.3 -r1.3.2.1 src/common/lib/libprop/prop_ingest.3
diff -r1.2 -r1.2.4.1 src/common/lib/libprop/prop_copyin_ioctl.9
diff -r1.4 -r1.4.2.1 src/common/lib/libprop/prop_data.3
diff -r1.4 -r1.4.2.1 src/common/lib/libprop/prop_string.3
diff -r1.8.2.1 -r1.8.2.2 src/common/lib/libprop/prop_data.c
diff -r1.8.2.2 -r1.8.2.3 src/common/lib/libprop/prop_dictionary.3
diff -r1.19.2.1 -r1.19.2.2 src/common/lib/libprop/prop_dictionary.c
diff -r1.7 -r1.7.2.1 src/common/lib/libprop/prop_number.3
diff -r1.15.2.1 -r1.15.2.2 src/common/lib/libprop/prop_object.c
diff -r1.3 -r1.3.4.1 src/common/lib/libprop/prop_send_ioctl.3

cvs diff -r1.6.16.1 -r1.6.16.2 src/common/lib/libc/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/Makefile.inc 2008/01/09 01:20:46 1.6.16.1
+++ src/common/lib/libc/Makefile.inc 2008/03/23 00:12:40 1.6.16.2
@@ -1,34 +1,34 @@ @@ -1,34 +1,34 @@
1# $NetBSD: Makefile.inc,v 1.6.16.1 2008/01/09 01:20:46 matt Exp $ 1# Makefile.inc,v 1.6.16.1 2008/01/09 01:20:46 matt Exp
2 2
3COMMON_DIR:=${.PARSEDIR} 3COMMON_DIR:=${.PARSEDIR}
4COMMON_CODEDIRS=atomic gen gmon inet md net quad stdlib string 4COMMON_CODEDIRS=atomic gen gmon inet md net quad stdlib string
5COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/rmd160 5COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/rmd160
6 6
7.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \ 7.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \
8 exists(${KERNDIR}/arch/${LIBKERN_ARCH}) 8 exists(${KERNDIR}/arch/${LIBKERN_ARCH})
9COMMON_ARCHSUBDIR= ${LIBKERN_ARCH} 9COMMON_ARCHSUBDIR= ${LIBKERN_ARCH}
10.elif exists(${COMMON_DIR}/arch/${MACHINE_ARCH}) 10.elif exists(${COMMON_DIR}/arch/${MACHINE_ARCH})
11COMMON_ARCHSUBDIR= ${MACHINE_ARCH} 11COMMON_ARCHSUBDIR= ${MACHINE_ARCH}
12.elif exists(${COMMON_DIR}/arch/${MACHINE_CPU}) 12.elif exists(${COMMON_DIR}/arch/${MACHINE_CPU})
13COMMON_ARCHSUBDIR= ${MACHINE_CPU} 13COMMON_ARCHSUBDIR= ${MACHINE_CPU}
14.endif 14.endif
15 15
16COMMON_ARCHDIR=${COMMON_DIR}/arch/${COMMON_ARCHSUBDIR} 16COMMON_ARCHDIR=${COMMON_DIR}/arch/${COMMON_ARCHSUBDIR}
17 17
18.for i in ${COMMON_CODEDIRS} 18.for i in ${COMMON_CODEDIRS}
19.if exists(${COMMON_DIR}/$i) 19.if exists(${COMMON_DIR}/$i)
20.PATH.c: ${COMMON_DIR}/$i 20.PATH.c: ${COMMON_DIR}/$i
21.endif 21.endif
 22.if exists(${COMMON_ARCHDIR}/${i}/Makefile.inc)
 23.include "${COMMON_ARCHDIR}/${i}/Makefile.inc"
 24.endif
22.if exists(${COMMON_ARCHDIR}/$i) 25.if exists(${COMMON_ARCHDIR}/$i)
23.PATH.c: ${COMMON_ARCHDIR}/$i 26.PATH.c: ${COMMON_ARCHDIR}/$i
24.PATH.S: ${COMMON_ARCHDIR}/$i 27.PATH.S: ${COMMON_ARCHDIR}/$i
25.endif 28.endif
26.if exists(${COMMON_ARCHDIR}/${i}/Makefile.inc) 
27.include "${COMMON_ARCHDIR}/${i}/Makefile.inc" 
28.endif 
29.endfor 29.endfor
30 30
31CPPFLAGS+=-I${COMMON_DIR}/quad -I${COMMON_DIR}/string 31CPPFLAGS+=-I${COMMON_DIR}/quad -I${COMMON_DIR}/string
32.if defined(COMMON_ARCHSUBDIR) 32.if defined(COMMON_ARCHSUBDIR)
33CPPFLAGS+=-I${COMMON_ARCHDIR}/string 33CPPFLAGS+=-I${COMMON_ARCHDIR}/string
34.endif 34.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/alpha/atomic/Makefile.inc 2008/01/09 01:20:47 1.2.4.2
+++ src/common/lib/libc/arch/alpha/atomic/Makefile.inc 2008/03/23 00:12:40 1.2.4.3
@@ -1,8 +1,14 @@ @@ -1,8 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:20:47 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:20:47 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ 5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S 6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S
7 7
8.endif 8.endif
 9
 10.if defined(LIB) && (${LIB} == "c")
 11
 12SRCS+= atomic_init_cas.c
 13
 14.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/alpha/atomic/atomic_cas.S 2008/01/09 01:20:48 1.2.4.2
+++ src/common/lib/libc/arch/alpha/atomic/atomic_cas.S 2008/03/23 00:12:40 1.2.4.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.2.4.2 2008/01/09 01:20:48 matt Exp $ */ 1/* atomic_cas.S,v 1.2.4.2 2008/01/09 01:20:48 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -40,32 +40,46 @@ @@ -40,32 +40,46 @@
40 40
41 .text 41 .text
42 42
43LEAF_NOPROFILE(_atomic_cas_32, 3) 43LEAF_NOPROFILE(_atomic_cas_32, 3)
441: mov a2, t2 441: mov a2, t2
45 ldl_l v0, 0(a0) 45 ldl_l v0, 0(a0)
46 cmpeq v0, a1, t1 46 cmpeq v0, a1, t1
47 beq t1, 2f 47 beq t1, 2f
48 stl_c t2, 0(a0) 48 stl_c t2, 0(a0)
49 beq t2, 3f 49 beq t2, 3f
502: RET 502: RET
513: br 1b 513: br 1b
52 END(_atomic_cas_32) 52 END(_atomic_cas_32)
 53
53ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) 54ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
54ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) 55ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
55STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 56STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
56 57
 58ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 59STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
 60ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
 61STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
 62
57LEAF_NOPROFILE(_atomic_cas_64, 3) 63LEAF_NOPROFILE(_atomic_cas_64, 3)
581: mov a2, t2 641: mov a2, t2
59 ldq_l v0, 0(a0) 65 ldq_l v0, 0(a0)
60 cmpeq v0, a1, t1 66 cmpeq v0, a1, t1
61 beq t1, 2f 67 beq t1, 2f
62 stq_c t2, 0(a0) 68 stq_c t2, 0(a0)
63 beq t2, 3f 69 beq t2, 3f
642: RET 702: RET
653: br 1b 713: br 1b
66 END(_atomic_cas_64) 72 END(_atomic_cas_64)
 73
67ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) 74ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
68ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) 75ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
69STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) 76STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
70ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) 77ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
71STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) 78STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
 79
 80ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
 81STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64)
 82ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64)
 83STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64)
 84ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64)
 85STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64)

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/alpha/atomic/membar_ops.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/alpha/atomic/membar_ops.S 2008/01/09 01:20:51 1.2.4.2
+++ src/common/lib/libc/arch/alpha/atomic/membar_ops.S 2008/03/23 00:12:40 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: membar_ops.S,v 1.2.4.2 2008/01/09 01:20:51 matt Exp $ */ 1/* membar_ops.S,v 1.2.4.2 2008/01/09 01:20:51 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -28,56 +28,69 @@ @@ -28,56 +28,69 @@
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41#if defined(_KERNEL) 
42 
43 .text 41 .text
44 42
 43#ifdef _KERNEL
 44
45/* 45/*
46 * We start out with no-op versions that do nothing. We hot-patch when 46 * We start out with no-op versions that do nothing. We hot-patch when
47 * we detect a MP system. 47 * we detect a MP system.
48 */ 48 */
49LEAF_NOPROFILE(_membar_producer, 0) 49LEAF_NOPROFILE(_membar_producer, 0)
50 RET 50 RET
51 nop 51 nop
52 END(_membar_producer) 52 END(_membar_producer)
53EXPORT(_membar_producer_end) 53EXPORT(_membar_producer_end)
54ATOMIC_OP_ALIAS(membar_producer,_membar_producer) 
55 54
56LEAF_NOPROFILE(_membar_sync, 0) 55LEAF_NOPROFILE(_membar_sync, 0)
57 RET 56 RET
58 nop 57 nop
59 END(_membar_sync) 58 END(_membar_sync)
60EXPORT(_membar_sync_end) 59EXPORT(_membar_sync_end)
61ATOMIC_OP_ALIAS(membar_sync,_membar_sync) 
62ATOMIC_OP_ALIAS(membar_enter,_membar_sync) 
63STRONG_ALIAS(_membar_enter,_membar_sync) 
64ATOMIC_OP_ALIAS(membar_exit,_membar_sync) 
65STRONG_ALIAS(_membar_exit,_membar_sync) 
66ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) 
67STRONG_ALIAS(_membar_consumer,_membar_sync) 
68 60
69LEAF_NOPROFILE(_membar_producer_mp, 0) 61LEAF_NOPROFILE(_membar_producer_mp, 0)
70 wmb 62 wmb
71 RET 63 RET
72 END(_membar_producer_mp) 64 END(_membar_producer_mp)
73EXPORT(_membar_producer_mp_end) 65EXPORT(_membar_producer_mp_end)
74 66
75LEAF_NOPROFILE(_membar_sync_mp, 0) 67LEAF_NOPROFILE(_membar_sync_mp, 0)
76 mb 68 mb
77 RET 69 RET
78 END(_membar_sync_mp) 70 END(_membar_sync_mp)
79EXPORT(_membar_sync_mp_end) 71EXPORT(_membar_sync_mp_end)
80 72
81#else /* _KERNEL */ 73#else /* _KERNEL */
 74
 75LEAF_NOPROFILE(_membar_producer, 0)
 76 mb
 77 RET
 78 END(_membar_producer)
 79EXPORT(_membar_producer_end)
82 80
83#endif /* _KERNEL */ 81LEAF_NOPROFILE(_membar_sync, 0)
 82 mb
 83 RET
 84 END(_membar_sync)
 85EXPORT(_membar_sync_end)
 86
 87#endif /* _KERNEL */
 88
 89ATOMIC_OP_ALIAS(membar_producer,_membar_producer)
 90ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
 91ATOMIC_OP_ALIAS(membar_enter,_membar_sync)
 92STRONG_ALIAS(_membar_enter,_membar_sync)
 93ATOMIC_OP_ALIAS(membar_exit,_membar_sync)
 94STRONG_ALIAS(_membar_exit,_membar_sync)
 95ATOMIC_OP_ALIAS(membar_consumer,_membar_sync)
 96STRONG_ALIAS(_membar_consumer,_membar_sync)

cvs diff -r1.2 -r1.2.18.1 src/common/lib/libc/arch/alpha/gen/byte_swap_2.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/alpha/gen/byte_swap_2.S 2005/12/27 09:22:08 1.2
+++ src/common/lib/libc/arch/alpha/gen/byte_swap_2.S 2008/03/23 00:12:40 1.2.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: byte_swap_2.S,v 1.2 2005/12/27 09:22:08 yamt Exp $ */ 1/* byte_swap_2.S,v 1.2 2005/12/27 09:22:08 yamt Exp */
2 2
3/* 3/*
4 * Copyright (c) 1996 Carnegie-Mellon University. 4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Author: Chris G. Demetriou 7 * Author: Chris G. Demetriou
8 * 8 *
9 * Permission to use, copy, modify and distribute this software and 9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright 10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the 11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions 12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation. 13 * thereof, and that both notices appear in supporting documentation.
14 * 14 *
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * School of Computer Science 22 * School of Computer Science
23 * Carnegie Mellon University 23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890 24 * Pittsburgh PA 15213-3890
25 * 25 *
26 * any improvements or extensions that they make and grant Carnegie the 26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes. 27 * rights to redistribute these changes.
28 */ 28 */
29 29
30#include <machine/asm.h> 30#include <machine/asm.h>
31 31
32/* 32/*
33 * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) 33 * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.)
34 * 34 *
35 * Argument is an unsigned 2-byte integer (u_int16_t). 35 * Argument is an unsigned 2-byte integer (uint16_t).
36 */ 36 */
37#if defined(_KERNEL) || defined(_STANDALONE) 37#if defined(_KERNEL) || defined(_STANDALONE)
38#define BSWAP16 bswap16 38#define BSWAP16 bswap16
39#else /* defined(_KERNEL) || defined(_STANDALONE) */ 39#else /* defined(_KERNEL) || defined(_STANDALONE) */
40#define BSWAP16 __bswap16 40#define BSWAP16 __bswap16
41#endif /* defined(_KERNEL) || defined(_STANDALONE) */ 41#endif /* defined(_KERNEL) || defined(_STANDALONE) */
42LEAF(BSWAP16, 1) /* a0 contains 0x0123 */ 42LEAF(BSWAP16, 1) /* a0 contains 0x0123 */
43XLEAF(htons, 1) 43XLEAF(htons, 1)
44XLEAF(ntohs, 1) 44XLEAF(ntohs, 1)
45 insbl a0, 1, t0 /* t0 = 0x23 */ 45 insbl a0, 1, t0 /* t0 = 0x23 */
46 extbl a0, 1, t1 /* t1 = 0x 01 */ 46 extbl a0, 1, t1 /* t1 = 0x 01 */
47 or t0, t1, v0 /* v0 = 0x2301 */ 47 or t0, t1, v0 /* v0 = 0x2301 */
48 RET 48 RET

cvs diff -r1.2 -r1.2.18.1 src/common/lib/libc/arch/alpha/gen/byte_swap_4.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/alpha/gen/byte_swap_4.S 2005/12/27 09:22:08 1.2
+++ src/common/lib/libc/arch/alpha/gen/byte_swap_4.S 2008/03/23 00:12:40 1.2.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: byte_swap_4.S,v 1.2 2005/12/27 09:22:08 yamt Exp $ */ 1/* byte_swap_4.S,v 1.2 2005/12/27 09:22:08 yamt Exp */
2 2
3/* 3/*
4 * Copyright (c) 1996 Carnegie-Mellon University. 4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Author: Chris G. Demetriou 7 * Author: Chris G. Demetriou
8 * 8 *
9 * Permission to use, copy, modify and distribute this software and 9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright 10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the 11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions 12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation. 13 * thereof, and that both notices appear in supporting documentation.
14 * 14 *
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * School of Computer Science 22 * School of Computer Science
23 * Carnegie Mellon University 23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890 24 * Pittsburgh PA 15213-3890
25 * 25 *
26 * any improvements or extensions that they make and grant Carnegie the 26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes. 27 * rights to redistribute these changes.
28 */ 28 */
29 29
30#include <machine/asm.h> 30#include <machine/asm.h>
31 31
32/* 32/*
33 * Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.) 33 * Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.)
34 * 34 *
35 * Argument is an unsigned 4-byte integer (u_int32_t). 35 * Argument is an unsigned 4-byte integer (uint32_t).
36 */ 36 */
37#if defined(_KERNEL) || defined(_STANDALONE) 37#if defined(_KERNEL) || defined(_STANDALONE)
38#define BSWAP32 bswap32 38#define BSWAP32 bswap32
39#else /* defined(_KERNEL) || defined(_STANDALONE) */ 39#else /* defined(_KERNEL) || defined(_STANDALONE) */
40#define BSWAP32 __bswap32 40#define BSWAP32 __bswap32
41#endif /* defined(_KERNEL) || defined(_STANDALONE) */ 41#endif /* defined(_KERNEL) || defined(_STANDALONE) */
42LEAF(BSWAP32, 1) /* a0 contains 0x01234567 */ 42LEAF(BSWAP32, 1) /* a0 contains 0x01234567 */
43XLEAF(htonl, 1) 43XLEAF(htonl, 1)
44XLEAF(ntohl, 1) 44XLEAF(ntohl, 1)
45 insbl a0, 3, t0 /* t0 = 0x67 */ 45 insbl a0, 3, t0 /* t0 = 0x67 */
46 extbl a0, 1, t1 /* t1 = 0x 45 */ 46 extbl a0, 1, t1 /* t1 = 0x 45 */
47 extbl a0, 2, t2 /* t2 = 0x 23 */ 47 extbl a0, 2, t2 /* t2 = 0x 23 */
48 extbl a0, 3, t3 /* t3 = 0x 01 */ 48 extbl a0, 3, t3 /* t3 = 0x 01 */

cvs diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/arm/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/arm/atomic/Makefile.inc 2008/01/09 01:20:51 1.3.4.2
+++ src/common/lib/libc/arch/arm/atomic/Makefile.inc 2008/03/23 00:12:40 1.3.4.3
@@ -1,10 +1,16 @@ @@ -1,10 +1,16 @@
1# $NetBSD: Makefile.inc,v 1.3.4.2 2008/01/09 01:20:51 matt Exp $ 1# Makefile.inc,v 1.3.4.2 2008/01/09 01:20:51 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ 5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ 6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ 7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c 8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c
9 9
10.endif 10.endif
 11
 12.if defined(LIB) && (${LIB} == "c")
 13
 14SRCS+= atomic_init_testset.c
 15
 16.endif

cvs diff -r1.1.4.2 -r1.1.4.3 src/common/lib/libc/arch/hppa/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/hppa/atomic/Makefile.inc 2008/01/09 01:20:52 1.1.4.2
+++ src/common/lib/libc/arch/hppa/atomic/Makefile.inc 2008/03/23 00:12:41 1.1.4.3
@@ -1,10 +1,16 @@ @@ -1,10 +1,16 @@
1# $NetBSD: Makefile.inc,v 1.1.4.2 2008/01/09 01:20:52 matt Exp $ 1# Makefile.inc,v 1.1.4.2 2008/01/09 01:20:52 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ 5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ 6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ 7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c 8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c
9 9
10.endif 10.endif
 11
 12.if defined(LIB) && (${LIB} == "c")
 13
 14SRCS+= atomic_init_testset.c
 15
 16.endif

cvs diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/i386/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/i386/atomic/Makefile.inc 2008/01/09 01:20:52 1.3.2.2
+++ src/common/lib/libc/arch/i386/atomic/Makefile.inc 2008/03/23 00:12:41 1.3.2.3
@@ -1,9 +1,16 @@ @@ -1,9 +1,16 @@
1# $NetBSD: Makefile.inc,v 1.3.2.2 2008/01/09 01:20:52 matt Exp $ 1# Makefile.inc,v 1.3.2.2 2008/01/09 01:20:52 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_and_64_cas.c \ 5SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_and_64_cas.c \
6 atomic_and_64_nv_cas.c atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \ 6 atomic_and_64_nv_cas.c atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \
7 atomic_inc_64_cas.c atomic_inc_64_nv_cas.c atomic_or_64_cas.c \ 7 atomic_inc_64_cas.c atomic_inc_64_nv_cas.c atomic_or_64_cas.c \
8 atomic_or_64_nv_cas.c atomic_swap_64_cas.c atomic.S 8 atomic_or_64_nv_cas.c atomic_swap_64_cas.c atomic.S
 9
 10.endif
 11
 12.if defined(LIB) && (${LIB} == "c")
 13
 14SRCS+= atomic_init_cas.c
 15
9.endif 16.endif

cvs diff -r1.7.2.2 -r1.7.2.3 src/common/lib/libc/arch/i386/atomic/atomic.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/i386/atomic/atomic.S 2008/01/09 01:20:53 1.7.2.2
+++ src/common/lib/libc/arch/i386/atomic/atomic.S 2008/03/23 00:12:41 1.7.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic.S,v 1.7.2.2 2008/01/09 01:20:53 matt Exp $ */ 1/* atomic.S,v 1.7.2.2 2008/01/09 01:20:53 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe, and by Andrew Doran. 8 * by Jason R. Thorpe, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -137,50 +137,46 @@ NENTRY(_atomic_swap_32) @@ -137,50 +137,46 @@ NENTRY(_atomic_swap_32)
137 movl 8(%esp), %eax 137 movl 8(%esp), %eax
138 xchgl %eax, (%edx) 138 xchgl %eax, (%edx)
139 ret 139 ret
140 140
141NENTRY(_atomic_cas_32) 141NENTRY(_atomic_cas_32)
142 movl 4(%esp), %edx 142 movl 4(%esp), %edx
143 movl 8(%esp), %eax 143 movl 8(%esp), %eax
144 movl 12(%esp), %ecx 144 movl 12(%esp), %ecx
145 LOCK(12) 145 LOCK(12)
146 cmpxchgl %ecx, (%edx) 146 cmpxchgl %ecx, (%edx)
147 /* %eax now contains the old value */ 147 /* %eax now contains the old value */
148 ret 148 ret
149 149
 150NENTRY(_atomic_cas_32_ni)
 151 movl 4(%esp), %edx
 152 movl 8(%esp), %eax
 153 movl 12(%esp), %ecx
 154 cmpxchgl %ecx, (%edx)
 155 /* %eax now contains the old value */
 156 ret
 157
150NENTRY(_membar_consumer) 158NENTRY(_membar_consumer)
151 LOCK(13) 159 LOCK(13)
152 addl $0, -4(%esp) 160 addl $0, -4(%esp)
153 ret 161 ret
154END(membar_consumer_end) 162END(membar_consumer_end)
155 163
156NENTRY(_membar_producer) 164NENTRY(_membar_producer)
157 /* A store is enough */ 165 /* A store is enough */
158 movl $0, -4(%esp) 166 movl $0, -4(%esp)
159 ret 167 ret
160END(membar_producer_end) 168END(membar_producer_end)
161 169
162NENTRY(_membar_enter) 
163 /* A store is enough */ 
164 movl $0, -4(%esp) 
165 ret 
166END(membar_enter_end) 
167 
168NENTRY(_membar_exit) 
169 /* A store is enough */ 
170 movl $0, -4(%esp) 
171 ret 
172END(membar_exit_end) 
173 
174NENTRY(_membar_sync) 170NENTRY(_membar_sync)
175 LOCK(14) 171 LOCK(14)
176 addl $0, -4(%esp) 172 addl $0, -4(%esp)
177 ret 173 ret
178END(membar_sync_end) 174END(membar_sync_end)
179 175
180#ifdef _KERNEL 176#ifdef _KERNEL
181NENTRY(_atomic_cas_64) 177NENTRY(_atomic_cas_64)
182 cli 178 cli
183 pushl %edi 179 pushl %edi
184 pushl %ebx 180 pushl %ebx
185 movl 12(%esp), %edi 181 movl 12(%esp), %edi
186 movl 16(%esp), %eax 182 movl 16(%esp), %eax
@@ -301,32 +297,38 @@ ALIAS(atomic_or_uint_nv,_atomic_or_32_nv @@ -301,32 +297,38 @@ ALIAS(atomic_or_uint_nv,_atomic_or_32_nv
301ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) 297ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv)
302ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) 298ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv)
303 299
304ALIAS(atomic_swap_32,_atomic_swap_32) 300ALIAS(atomic_swap_32,_atomic_swap_32)
305ALIAS(atomic_swap_uint,_atomic_swap_32) 301ALIAS(atomic_swap_uint,_atomic_swap_32)
306ALIAS(atomic_swap_ulong,_atomic_swap_32) 302ALIAS(atomic_swap_ulong,_atomic_swap_32)
307ALIAS(atomic_swap_ptr,_atomic_swap_32) 303ALIAS(atomic_swap_ptr,_atomic_swap_32)
308 304
309ALIAS(atomic_cas_32,_atomic_cas_32) 305ALIAS(atomic_cas_32,_atomic_cas_32)
310ALIAS(atomic_cas_uint,_atomic_cas_32) 306ALIAS(atomic_cas_uint,_atomic_cas_32)
311ALIAS(atomic_cas_ulong,_atomic_cas_32) 307ALIAS(atomic_cas_ulong,_atomic_cas_32)
312ALIAS(atomic_cas_ptr,_atomic_cas_32) 308ALIAS(atomic_cas_ptr,_atomic_cas_32)
313 309
 310ALIAS(atomic_cas_32_ni,_atomic_cas_32_ni)
 311ALIAS(atomic_cas_uint_ni,_atomic_cas_32_ni)
 312ALIAS(atomic_cas_ulong_ni,_atomic_cas_32_ni)
 313ALIAS(atomic_cas_ptr_ni,_atomic_cas_32_ni)
 314
314ALIAS(atomic_cas_64,_atomic_cas_64) 315ALIAS(atomic_cas_64,_atomic_cas_64)
 316ALIAS(atomic_cas_64_ni,_atomic_cas_64)
315 317
316ALIAS(membar_consumer,_membar_consumer) 318ALIAS(membar_consumer,_membar_consumer)
317ALIAS(membar_producer,_membar_producer) 319ALIAS(membar_producer,_membar_producer)
318ALIAS(membar_enter,_membar_enter) 320ALIAS(membar_enter,_membar_consumer)
319ALIAS(membar_exit,_membar_exit) 321ALIAS(membar_exit,_membar_producer)
320ALIAS(membar_sync,_membar_sync) 322ALIAS(membar_sync,_membar_sync)
321 323
322STRONG_ALIAS(_atomic_add_int,_atomic_add_32) 324STRONG_ALIAS(_atomic_add_int,_atomic_add_32)
323STRONG_ALIAS(_atomic_add_long,_atomic_add_32) 325STRONG_ALIAS(_atomic_add_long,_atomic_add_32)
324STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) 326STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32)
325 327
326STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) 328STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv)
327STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) 329STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv)
328STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) 330STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv)
329 331
330STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 332STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
331STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) 333STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32)
332STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) 334STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32)
@@ -356,13 +358,20 @@ STRONG_ALIAS(_atomic_or_ulong,_atomic_or @@ -356,13 +358,20 @@ STRONG_ALIAS(_atomic_or_ulong,_atomic_or
356STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) 358STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32)
357 359
358STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) 360STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv)
359STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) 361STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv)
360STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) 362STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv)
361 363
362STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) 364STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32)
363STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) 365STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32)
364STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) 366STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32)
365 367
366STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 368STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
367STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) 369STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
368STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) 370STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
 371
 372STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32_ni)
 373STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32_ni)
 374STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32_ni)
 375
 376STRONG_ALIAS(_membar_enter,_membar_consumer)
 377STRONG_ALIAS(_membar_exit,_membar_producer)

File Added: src/common/lib/libc/arch/ia64/atomic/Makefile.inc
#	$NetBSD: Makefile.inc,v 1.1.2.2 2008/03/23 00:12:41 matt Exp $

.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")

SRCS+=	atomic_add_32_cas.c atomic_add_32_nv_cas.c \
	atomic_add_64_cas.c atomic_add_64_nv_cas.c \
	atomic_and_32_cas.c atomic_and_32_nv_cas.c \
	atomic_and_64_cas.c atomic_and_64_nv_cas.c \
	atomic_or_32_cas.c atomic_or_32_nv_cas.c \
	atomic_or_64_cas.c atomic_or_64_nv_cas.c

SRCS+=	atomic.S

.endif

.if defined(LIB) && (${LIB} == "c")

SRCS += atomic_init_cas.c

.endif

File Added: src/common/lib/libc/arch/ia64/atomic/atomic.S
/*	$NetBSD: atomic.S,v 1.1.2.2 2008/03/23 00:12:41 matt Exp $	*/

/*-
 * Copyright (c) 2008 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Takayoshi Kochi.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the NetBSD
 *	Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *      
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <machine/asm.h>

#ifdef _KERNEL
#define	ALIAS(f, t)	STRONG_ALIAS(f,t)
#else
#define	ALIAS(f, t)	WEAK_ALIAS(f,t)
#endif

	.text

ENTRY_NOPROFILE(_atomic_dec_32,1)
	fetchadd4.rel	r8=[r32],-1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_dec_64,1)
	fetchadd8.rel	r8=[r32],-1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_dec_32_nv,1)
	fetchadd4.rel	r8=[r32],-1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_dec_64_nv,1)
	fetchadd8.rel	r8=[r32],-1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_inc_32,1)
	fetchadd4.rel	r8=[r32],1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_inc_64,1)
	fetchadd8.rel	r8=[r32],1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_inc_32_nv,1)
	fetchadd4.rel	r8=[r32],1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_inc_64_nv,1)
	fetchadd8.rel	r8=[r32],1
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_swap_32,2)
	xchg4		r8=[r32],r33
	;;
	mov		r33=r8
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_swap_64,2)
	xchg8		r8=[r32],r33
	;;
	mov		r33=r8
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_cas_32,3)
	mov		ar.ccv=r33
	;;
	cmpxchg4.acq	r8=[r32],r34,ar.ccv
	br.ret.sptk	rp

ENTRY_NOPROFILE(_atomic_cas_64,3)
	mov		ar.ccv=r33
	;;
	cmpxchg8.acq	r8=[r32],r34,ar.ccv
	br.ret.sptk	rp

ENTRY_NOPROFILE(_membar_consumer,0)
	mf
	br.ret.sptk	rp

ENTRY_NOPROFILE(_membar_producer,0)
	mf
	br.ret.sptk	rp

ENTRY_NOPROFILE(_membar_enter,0)
	mf
	br.ret.sptk	rp

ENTRY_NOPROFILE(_membar_exit,0)
	mf
	br.ret.sptk	rp

ENTRY_NOPROFILE(_membar_sync,0)
	mf
	br.ret.sptk	rp


ALIAS(atomic_add_32,_atomic_add_32)
ALIAS(atomic_add_int,_atomic_add_32)
ALIAS(atomic_add_64,_atomic_add_64)
ALIAS(atomic_add_long,_atomic_add_64)
ALIAS(atomic_add_ptr,_atomic_add_64)

ALIAS(atomic_add_32_nv,_atomic_add_32_nv)
ALIAS(atomic_add_int_nv,_atomic_add_32_nv)
ALIAS(atomic_add_64_nv,_atomic_add_64_nv)
ALIAS(atomic_add_long_nv,_atomic_add_64_nv)
ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv)

ALIAS(atomic_and_32,_atomic_and_32)
ALIAS(atomic_and_uint,_atomic_and_32)
ALIAS(atomic_and_64,_atomic_and_64)
ALIAS(atomic_and_ulong,_atomic_and_64)
ALIAS(atomic_and_ptr,_atomic_and_64)

ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
ALIAS(atomic_and_uint_nv,_atomic_and_32_nv)
ALIAS(atomic_and_64_nv,_atomic_and_64_nv)
ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv)
ALIAS(atomic_and_ptr_nv,_atomic_and_64_nv)

ALIAS(atomic_dec_32,_atomic_dec_32)
ALIAS(atomic_dec_uint,_atomic_dec_32)
ALIAS(atomic_dec_64,_atomic_dec_64)
ALIAS(atomic_dec_ulong,_atomic_dec_64)
ALIAS(atomic_dec_ptr,_atomic_dec_64)

ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv)
ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv)
ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv)
ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv)
ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv)

ALIAS(atomic_inc_32,_atomic_inc_32)
ALIAS(atomic_inc_uint,_atomic_inc_32)
ALIAS(atomic_inc_64,_atomic_inc_64)
ALIAS(atomic_inc_ulong,_atomic_inc_64)
ALIAS(atomic_inc_ptr,_atomic_inc_64)

ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv)
ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv)
ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv)
ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv)
ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv)

ALIAS(atomic_or_32,_atomic_or_32)
ALIAS(atomic_or_uint,_atomic_or_32)
ALIAS(atomic_or_64,_atomic_or_64)
ALIAS(atomic_or_ulong,_atomic_or_64)
ALIAS(atomic_or_ptr,_atomic_or_64)

ALIAS(atomic_or_32_nv,_atomic_or_32_nv)
ALIAS(atomic_or_uint_nv,_atomic_or_32_nv)
ALIAS(atomic_or_64_nv,_atomic_or_64_nv)
ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv)
ALIAS(atomic_or_ptr_nv,_atomic_or_64_nv)

ALIAS(atomic_swap_32,_atomic_swap_32)
ALIAS(atomic_swap_uint,_atomic_swap_32)
ALIAS(atomic_swap_64,_atomic_swap_64)
ALIAS(atomic_swap_ulong,_atomic_swap_64)
ALIAS(atomic_swap_ptr,_atomic_swap_64)

ALIAS(atomic_cas_32,_atomic_cas_32)
ALIAS(atomic_cas_uint,_atomic_cas_32)
ALIAS(atomic_cas_64,_atomic_cas_64)
ALIAS(atomic_cas_ulong,_atomic_cas_64)
ALIAS(atomic_cas_ptr,_atomic_cas_64)

ALIAS(membar_consumer,_membar_consumer)
ALIAS(membar_producer,_membar_producer)
ALIAS(membar_enter,_membar_enter)
ALIAS(membar_exit,_membar_exit)
ALIAS(membar_sync,_membar_sync)

STRONG_ALIAS(_atomic_add_int,_atomic_add_32)
STRONG_ALIAS(_atomic_add_long,_atomic_add_64)
STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64)

STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv)
STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv)
STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv)

STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64)
STRONG_ALIAS(_atomic_and_ptr,_atomic_and_64)

STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv)
STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv)
STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_64_nv)

STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32)
STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64)
STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64)

STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv)
STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv)
STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv)

STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32)
STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64)
STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64)

STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv)
STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv)
STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv)

STRONG_ALIAS(_atomic_or_uint,_atomic_or_32)
STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64)
STRONG_ALIAS(_atomic_or_ptr,_atomic_or_64)

STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv)
STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv)
STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_64_nv)

STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32)
STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64)
STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64)

STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/m68k/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/m68k/atomic/Makefile.inc 2008/01/09 01:20:54 1.2.4.2
+++ src/common/lib/libc/arch/m68k/atomic/Makefile.inc 2008/03/23 00:12:41 1.2.4.3
@@ -1,17 +1,23 @@ @@ -1,17 +1,23 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:20:54 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:20:54 matt Exp
2 2
3# 3#
4# Note: The atomic operations here in these assembly files are atomic 4# Note: The atomic operations here in these assembly files are atomic
5# only with respect to regular memory on uniprocessor systems. Since 5# only with respect to regular memory on uniprocessor systems. Since
6# we don't support any MP m68k systems, this is just fine. If we ever 6# we don't support any MP m68k systems, this is just fine. If we ever
7# do, then these routines will probably need to be replaced with CAS- 7# do, then these routines will probably need to be replaced with CAS-
8# based routines (CAS generates an atomic bus cycle, whereas these 8# based routines (CAS generates an atomic bus cycle, whereas these
9# others are merely single-instruction). 9# others are merely single-instruction).
10# 10#
11 11
12.if defined(LIB) && (${LIB} == "kern") 12.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
13 13
14SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ 14SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
15 atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c 15 atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c
16 16
17.endif 17.endif
 18
 19.if defined(LIB) && (${LIB} == "c")
 20
 21SRCS+= atomic_init_cas.c
 22
 23.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/m68k/atomic/atomic_cas.S 2008/01/09 01:20:56 1.2.4.2
+++ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S 2008/03/23 00:12:41 1.2.4.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.2.4.2 2008/01/09 01:20:56 matt Exp $ */ 1/* atomic_cas.S,v 1.2.4.2 2008/01/09 01:20:56 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -38,20 +38,30 @@ @@ -38,20 +38,30 @@
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_cas_32) 43ENTRY_NOPROFILE(_atomic_cas_32)
44 movl %sp@(4), %a0 44 movl %sp@(4), %a0
45 movl %sp@(8), %d0 45 movl %sp@(8), %d0
46 movl %sp@(12), %d1 46 movl %sp@(12), %d1
47 casl %d0, %d1, %a0@ 47 casl %d0, %d1, %a0@
48 /* %d0 now contains the old value */ 48 /* %d0 now contains the old value */
49 movl %d0, %a0 /* pointers return also in %a0 */ 49 movl %d0, %a0 /* pointers return also in %a0 */
50 rts 50 rts
 51
51ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) 52ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
52ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) 53ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
53STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 54STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
54ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) 55ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32)
55STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) 56STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
56ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) 57ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
57STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) 58STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
 59
 60ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 61STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
 62ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
 63STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
 64ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
 65STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
 66ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
 67STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)

cvs diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_and.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/m68k/atomic/atomic_and.S 2008/01/09 01:20:55 1.3.4.2
+++ src/common/lib/libc/arch/m68k/atomic/atomic_and.S 2008/03/23 00:12:41 1.3.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_and.S,v 1.3.4.2 2008/01/09 01:20:55 matt Exp $ */ 1/* atomic_and.S,v 1.3.4.2 2008/01/09 01:20:55 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -50,22 +50,21 @@ ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_ @@ -50,22 +50,21 @@ ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_
50STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 50STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
51ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) 51ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32)
52STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) 52STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32)
53ATOMIC_OP_ALIAS(atomic_and_ptr,_atomic_and_32) 53ATOMIC_OP_ALIAS(atomic_and_ptr,_atomic_and_32)
54STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) 54STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32)
55 55
56ENTRY_NOPROFILE(_atomic_and_32_nv) 56ENTRY_NOPROFILE(_atomic_and_32_nv)
57 movl %sp@(4), %a0 57 movl %sp@(4), %a0
581: movl %a0@, %d0 581: movl %a0@, %d0
59 movl %d0, %d1 59 movl %d0, %d1
60 andl %sp@(8), %d0 60 andl %sp@(8), %d0
61 casl %d1, %d0, %a0@ 61 casl %d1, %d0, %a0@
62 bne 1b 62 bne 1b
63 movl %d0, %a0 /* pointers return also in %a0 */ 
64 rts 63 rts
65ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) 64ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
66ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) 65ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv)
67STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) 66STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv)
68ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) 67ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv)
69STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) 68STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv)
70ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv) 69ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv)
71STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv) 70STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv)

cvs diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/arch/m68k/atomic/atomic_or.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/m68k/atomic/atomic_or.S 2008/01/09 01:20:57 1.3.4.2
+++ src/common/lib/libc/arch/m68k/atomic/atomic_or.S 2008/03/23 00:12:41 1.3.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_or.S,v 1.3.4.2 2008/01/09 01:20:57 matt Exp $ */ 1/* atomic_or.S,v 1.3.4.2 2008/01/09 01:20:57 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -50,22 +50,21 @@ ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_o @@ -50,22 +50,21 @@ ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_o
50STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) 50STRONG_ALIAS(_atomic_or_uint,_atomic_or_32)
51ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) 51ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32)
52STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) 52STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32)
53ATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32) 53ATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32)
54STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) 54STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32)
55 55
56ENTRY_NOPROFILE(_atomic_or_32_nv) 56ENTRY_NOPROFILE(_atomic_or_32_nv)
57 movl %sp@(4), %a0 57 movl %sp@(4), %a0
581: movl %a0@, %d0 581: movl %a0@, %d0
59 movl %d0, %d1 59 movl %d0, %d1
60 orl %sp@(8), %d0 60 orl %sp@(8), %d0
61 casl %d1, %d0, %a0@ 61 casl %d1, %d0, %a0@
62 bne 1b 62 bne 1b
63 movl %d0, %a0 /* pointers return also in %a0 */ 
64 rts 63 rts
65ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) 64ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv)
66ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) 65ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv)
67STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) 66STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv)
68ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) 67ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv)
69STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) 68STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv)
70ATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) 69ATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv)
71STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) 70STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv)

cvs diff -r1.4.4.2 -r1.4.4.3 src/common/lib/libc/arch/mips/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/mips/atomic/Makefile.inc 2008/01/09 01:20:58 1.4.4.2
+++ src/common/lib/libc/arch/mips/atomic/Makefile.inc 2008/03/23 00:12:41 1.4.4.3
@@ -1,14 +1,26 @@ @@ -1,14 +1,26 @@
1# $NetBSD: Makefile.inc,v 1.4.4.2 2008/01/09 01:20:58 matt Exp $ 1# Makefile.inc,v 1.4.4.2 2008/01/09 01:20:58 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ 5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ 6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ 7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c atomic_add_64_cas.c \ 8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c atomic_add_64_cas.c \
9 atomic_add_64_nv_cas.c atomic_and_64_cas.c atomic_and_64_nv_cas.c \ 9 atomic_add_64_nv_cas.c atomic_and_64_cas.c atomic_and_64_nv_cas.c \
10 atomic_dec_64_cas.c atomic_dec_64_nv_cas.c atomic_inc_64_cas.c \ 10 atomic_dec_64_cas.c atomic_dec_64_nv_cas.c atomic_inc_64_cas.c \
11 atomic_inc_64_nv_cas.c atomic_or_64_cas.c atomic_or_64_nv_cas.c \ 11 atomic_inc_64_nv_cas.c atomic_or_64_cas.c atomic_or_64_nv_cas.c \
12 atomic_swap_64_cas.c membar_ops.o 12 atomic_swap_64_cas.c membar_ops.o
13 13
14.endif 14.endif
 15
 16.if defined(LIB) && (${LIB} == "c")
 17
 18SRCS+= membar_ops_nop.c atomic_init_testset.c
 19
 20.endif
 21
 22.if defined(LIB) && (${LIB} == "kern")
 23
 24SRCS+= membar_ops.S
 25
 26.endif

File Deleted: src/common/lib/libc/arch/ns32k/gen/Attic/byte_swap_2.S

File Deleted: src/common/lib/libc/arch/ns32k/gen/Attic/byte_swap_4.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/bcmp.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/bcopy.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/bzero.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/ffs.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/memchr.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/memcmp.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/memcpy.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/memmove.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/memset.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strcat.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strchr.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strcmp.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strcpy.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strlen.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strncmp.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strncpy.S

File Deleted: src/common/lib/libc/arch/ns32k/string/Attic/strrchr.S

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/Makefile.inc 2008/01/09 01:20:59 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/Makefile.inc 2008/03/23 00:12:42 1.2.4.3
@@ -1,8 +1,14 @@ @@ -1,8 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:20:59 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:20:59 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ 5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S 6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S
7 7
8.endif 8.endif
 9
 10.if defined(LIB) && (${LIB} == "c")
 11
 12SRCS+= atomic_init_cas.c
 13
 14.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_add.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_add.S 2008/01/09 01:21:00 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_add.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_add.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp $ */ 1/* atomic_add.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,44 +31,44 @@ @@ -31,44 +31,44 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_add_32) 43ENTRY_NOPROFILE(_atomic_add_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 add r10,r10,r4 45 add %r10,%r10,%r4
46 stwcx. r10,0,r3 46 stwcx. %r10,0,%r3
47 bne- 1b 47 bne- 1b
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) 49ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32)
50ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) 50ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32)
51STRONG_ALIAS(_atomic_add_int,_atomic_add_32) 51STRONG_ALIAS(_atomic_add_int,_atomic_add_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) 53ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32)
54STRONG_ALIAS(_atomic_add_long,_atomic_add_32) 54STRONG_ALIAS(_atomic_add_long,_atomic_add_32)
55ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) 55ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32)
56STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) 56STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32)
57#endif 57#endif
58 58
59ENTRY_NOPROFILE(_atomic_add_32_nv) 59ENTRY_NOPROFILE(_atomic_add_32_nv)
601: lwarx r10,0,r3 601: lwarx %r10,0,%r3
61 add r10,r10,r4 61 add %r10,%r10,%r4
62 stwcx. r10,0,r3 62 stwcx. %r10,0,%r3
63 bne- 1b 63 bne- 1b
64 mr r3,r10 64 mr %r3,%r10
65 blr 65 blr
66ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) 66ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv)
67ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) 67ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv)
68STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) 68STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv)
69#if !defined(_LP64) 69#if !defined(_LP64)
70ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) 70ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv)
71STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) 71STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv)
72ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) 72ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv)
73STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) 73STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv)
74#endif 74#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_and.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_and.S 2008/01/09 01:21:00 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_and.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_and.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp $ */ 1/* atomic_and.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,40 +31,40 @@ @@ -31,40 +31,40 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_and_32) 43ENTRY_NOPROFILE(_atomic_and_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 and r10,r10,r4 45 and %r10,%r10,%r4
46 stwcx. r10,0,r3 46 stwcx. %r10,0,%r3
47 bne- 1b 47 bne- 1b
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) 49ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32)
50ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) 50ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32)
51STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 51STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) 53ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32)
54STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) 54STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32)
55#endif 55#endif
56 56
57ENTRY_NOPROFILE(_atomic_and_32_nv) 57ENTRY_NOPROFILE(_atomic_and_32_nv)
581: lwarx r10,0,r3 581: lwarx %r10,0,%r3
59 and r10,r10,r4 59 and %r10,%r10,%r4
60 stwcx. r10,0,r3 60 stwcx. %r10,0,%r3
61 bne- 1b 61 bne- 1b
62 mr r3,r10 62 mr %r3,%r10
63 blr 63 blr
64ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) 64ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
65ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) 65ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv)
66STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) 66STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv)
67#if !defined(_LP64) 67#if !defined(_LP64)
68ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) 68ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv)
69STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) 69STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv)
70#endif 70#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_cas.S 2008/01/09 01:21:00 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_cas.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp $ */ 1/* atomic_cas.S,v 1.2.4.2 2008/01/09 01:21:00 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -31,29 +31,41 @@ @@ -31,29 +31,41 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_cas_32) 43ENTRY_NOPROFILE(_atomic_cas_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 cmpw r10,r4 45 cmpw %r10,%r4
46 bne- 2f 46 bne- 2f
47 stwcx. r5,0,r3 47 stwcx. %r5,0,%r3
48 bne- 1b 48 bne- 1b
492: mr r3,r10 492: mr %r3,%r10
50 blr 50 blr
 51
51ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) 52ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
52ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) 53ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
53STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 54STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
54#if !defined(_LP64) 55#if !defined(_LP64)
55ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) 56ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32)
56STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) 57STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
57ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) 58ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
58STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) 59STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
59#endif 60#endif
 61
 62ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 63STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
 64ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
 65STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
 66#if !defined(_LP64)
 67ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
 68STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
 69ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
 70STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)
 71#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_dec.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_dec.S 2008/01/09 01:21:01 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_dec.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_dec.S,v 1.2.4.2 2008/01/09 01:21:01 matt Exp $ */ 1/* atomic_dec.S,v 1.2.4.2 2008/01/09 01:21:01 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,44 +31,44 @@ @@ -31,44 +31,44 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_dec_32) 43ENTRY_NOPROFILE(_atomic_dec_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 addi r10,r10,-1 45 addi %r10,%r10,-1
46 stwcx. r10,0,r3 46 stwcx. %r10,0,%r3
47 bne- 1b 47 bne- 1b
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) 49ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32)
50ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) 50ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32)
51STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) 51STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) 53ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32)
54STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) 54STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32)
55ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) 55ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32)
56STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) 56STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32)
57#endif 57#endif
58 58
59ENTRY_NOPROFILE(_atomic_dec_32_nv) 59ENTRY_NOPROFILE(_atomic_dec_32_nv)
601: lwarx r10,0,r3 601: lwarx %r10,0,%r3
61 addi r10,r10,-1 61 addi %r10,%r10,-1
62 stwcx. r10,0,r3 62 stwcx. %r10,0,%r3
63 bne- 1b 63 bne- 1b
64 mr r3,r10 64 mr %r3,%r10
65 blr 65 blr
66ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) 66ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv)
67ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) 67ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv)
68STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) 68STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv)
69#if !defined(_LP64) 69#if !defined(_LP64)
70ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) 70ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv)
71STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) 71STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv)
72ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) 72ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv)
73STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) 73STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv)
74#endif 74#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_inc.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_inc.S 2008/01/09 01:21:01 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_inc.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_inc.S,v 1.2.4.2 2008/01/09 01:21:01 matt Exp $ */ 1/* atomic_inc.S,v 1.2.4.2 2008/01/09 01:21:01 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,44 +31,44 @@ @@ -31,44 +31,44 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_inc_32) 43ENTRY_NOPROFILE(_atomic_inc_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 addi r10,r10,1 45 addi %r10,%r10,1
46 stwcx. r10,0,r3 46 stwcx. %r10,0,%r3
47 bne- 1b 47 bne- 1b
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) 49ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32)
50ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) 50ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32)
51STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) 51STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) 53ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32)
54STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) 54STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32)
55ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) 55ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32)
56STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) 56STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32)
57#endif 57#endif
58 58
59ENTRY_NOPROFILE(_atomic_inc_32_nv) 59ENTRY_NOPROFILE(_atomic_inc_32_nv)
601: lwarx r10,0,r3 601: lwarx %r10,0,%r3
61 addi r10,r10,1 61 addi %r10,%r10,1
62 stwcx. r10,0,r3 62 stwcx. %r10,0,%r3
63 bne- 1b 63 bne- 1b
64 mr r3,r10 64 mr %r3,%r10
65 blr 65 blr
66ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) 66ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv)
67ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) 67ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv)
68STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) 68STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv)
69#if !defined(_LP64) 69#if !defined(_LP64)
70ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) 70ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv)
71STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) 71STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv)
72ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) 72ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv)
73STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) 73STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv)
74#endif 74#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h 2008/01/09 01:21:01 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_op_asm.h,v 1.2.4.2 2008/01/09 01:21:01 matt Exp $ */ 1/* atomic_op_asm.h,v 1.2.4.2 2008/01/09 01:21:01 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -29,26 +29,27 @@ @@ -29,26 +29,27 @@
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#ifndef _ATOMIC_OP_ASM_H_ 39#ifndef _ATOMIC_OP_ASM_H_
40#define _ATOMIC_OP_ASM_H_ 40#define _ATOMIC_OP_ASM_H_
41 41
 42#define _NOREGNAMES
42#include <machine/asm.h> 43#include <machine/asm.h>
43 44
44#if defined(_KERNEL) 45#if defined(_KERNEL)
45 46
46#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) 47#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
47 48
48#else /* _KERNEL */ 49#else /* _KERNEL */
49 50
50#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) 51#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
51 52
52#endif /* _KERNEL */ 53#endif /* _KERNEL */
53 54
54#endif /* _ATOMIC_OP_ASM_H_ */ 55#endif /* _ATOMIC_OP_ASM_H_ */

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_or.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_or.S 2008/01/09 01:21:02 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_or.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_or.S,v 1.2.4.2 2008/01/09 01:21:02 matt Exp $ */ 1/* atomic_or.S,v 1.2.4.2 2008/01/09 01:21:02 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,40 +31,40 @@ @@ -31,40 +31,40 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_or_32) 43ENTRY_NOPROFILE(_atomic_or_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 or r10,r10,r4 45 or %r10,%r10,%r4
46 stwcx. r10,0,r3 46 stwcx. %r10,0,%r3
47 bne- 1b 47 bne- 1b
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) 49ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32)
50ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) 50ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32)
51STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) 51STRONG_ALIAS(_atomic_or_uint,_atomic_or_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) 53ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32)
54STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) 54STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32)
55#endif 55#endif
56 56
57ENTRY_NOPROFILE(_atomic_or_32_nv) 57ENTRY_NOPROFILE(_atomic_or_32_nv)
581: lwarx r10,0,r3 581: lwarx %r10,0,%r3
59 or r10,r10,r4 59 or %r10,%r10,%r4
60 stwcx. r10,0,r3 60 stwcx. %r10,0,%r3
61 bne- 1b 61 bne- 1b
62 mr r3,r10 62 mr %r3,%r10
63 blr 63 blr
64ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) 64ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv)
65ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) 65ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv)
66STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) 66STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv)
67#if !defined(_LP64) 67#if !defined(_LP64)
68ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) 68ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv)
69STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) 69STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv)
70#endif 70#endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc/atomic/atomic_swap.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc/atomic/atomic_swap.S 2008/01/09 01:21:02 1.2.4.2
+++ src/common/lib/libc/arch/powerpc/atomic/atomic_swap.S 2008/03/23 00:12:42 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_swap.S,v 1.2.4.2 2008/01/09 01:21:02 matt Exp $ */ 1/* atomic_swap.S,v 1.2.4.2 2008/01/09 01:21:02 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_swap_32) 43ENTRY_NOPROFILE(_atomic_swap_32)
441: lwarx r10,0,r3 441: lwarx %r10,0,%r3
45 stwcx. r4,0,r3 45 stwcx. %r4,0,%r3
46 bne- 1b 46 bne- 1b
47 mr r3,r10 47 mr %r3,%r10
48 blr 48 blr
49ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) 49ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32)
50ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) 50ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32)
51STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) 51STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32)
52#if !defined(_LP64) 52#if !defined(_LP64)
53ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) 53ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32)
54STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) 54STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32)
55ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) 55ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32)
56STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) 56STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32)
57#endif 57#endif

File Added: src/common/lib/libc/arch/powerpc/string/bcopy.S
/* $NetBSD: bcopy.S,v 1.1.2.2 2008/03/23 00:12:42 matt Exp $ */

#define _BCOPY
#include "memmove.S"

File Added: src/common/lib/libc/arch/powerpc/string/memcmp.S
/* $NetBSD: memcmp.S,v 1.2.2.2 2008/03/23 00:12:42 matt Exp $ */

/* stropt/memcmp.S, pl_string_common, pl_linux 10/11/04 11:45:35
 * ==========================================================================
 * Optimized memcmp implementation for IBM PowerPC 405/440.
 *
 *	Copyright (c) 2003, IBM Corporation
 *	All rights reserved.		
 *					
 *	Redistribution and use in source and binary forms, with or	
 *	without modification, are permitted provided that the following 
 *	conditions are met:						
 *									
 *	* Redistributions of source code must retain the above	
 *	copyright notice, this list of conditions and the following 
 *	disclaimer.						 
 *	* Redistributions in binary form must reproduce the above	
 *	copyright notice, this list of conditions and the following 
 *	disclaimer in the documentation and/or other materials	
 *	provided with the distribution.				
 *	* Neither the name of IBM nor the names of its contributors	
 *	may be used to endorse or promote products derived from this
 *	software without specific prior written permission.	 
 *									
 *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND		
 *	CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,	
 *	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF	
 *	MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE	
 *	DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS	
 *	BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 *	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,		
 *	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR	
 *	PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 *	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT	
 *	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE	
 *	USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *										
 * ==========================================================================
 *
 * Function: Compare two character strings (up to n characters)
 *
 *		int memcmp(const char *s1, const char *s2, int n)
 *
 * Input:	r3 - buffer 1 address
 *	 	r4 - buffer 2 address
 *	 	r5 - maximum characters to compare
 * Output: r3 <0 (less), 0 (equal), >0 (greater)
 *
 * ==========================================================================
 */

#define _NOREGNAMES
#include <machine/asm.h>

        .text
        .align 4
/* LINTSTUB: Func: void *memcmp(const void *, const void *, size_t) */
ENTRY(memcmp)

	/*
	 * Check count passed in R5. If zero, return 0; otherwise continue.
	 */
	cmpwi	%r5,0
	beq-	ret_0;

	/*
	 * Most of the time the difference is found in the first
	 * several bytes.  The following code minimizes the number
	 * of load operations for short compares.
	 */

	mr	%r11, %r3		/* Save buffer 1		*/

again:

	not	%r10, %r4		/* buffer 2: bytes to page bdy	*/
	rlwinm.	%r10, %r10,29,23,31	/* buffer 2: dwords to page bdy	*/
	beq-	bytebybyte		/* If < 8 bytes to the page bdy */
					/* do byte by byte		*/
	lwz	%r8, 0(%r4)		/* load 1st buffer 2 word	*/

	not	%r12, %r11		/* buffer 1: bytes to page bdy	*/
	rlwinm.	%r12, %r12,29,23,31	/* buffer 1: dwords to page bdy	*/
	beq-	bytebybyte		/* If < 8 bytes to the page bdy */
					/* do byte by byte		*/
	lwz	%r6, 0(%r11)		/* load 1st buffer 1 word	*/

	cmpwi	%r5, 4			/* If remaining count <= 4	*/
	ble+	first4			/* handle specially.	DWG	*/

	cmplw	%r8, %r6		/* compare buffer 2 and buffer 1*/
	bne+	all_done		/* different => we're done	*/

	lwzu	%r9, 4(%r4)		/* load 2nd buffer 2 word	*/
	lwzu	%r7, 4(%r11)		/* load 2nd buffer 1 word	*/

	cmpwi	%r5, 8			/* If remaining count <= 8	*/
	ble+	last4			/* handle specially.	DWG	*/

	cmplw	%r9, %r7		/* compare buffer 2 and buffer 1*/
	bne+	all_done		/* different => we're done	*/

	addi	%r5, %r5, -8		/* Update character counter DWG */
	addi	%r10, %r4, 0x0004	/* DWG*/
	not	%r10, %r10		/* buffer 2: bytes to page bdy DWG */
	rlwinm.	%r10, %r10,29,23,31	/* buffer 2: dwords to page bdy	DWG */
	addi	%r12, %r11, 0x0004	/* DWG */
	not	%r12, %r12		/* buffer 1: bytes to page bdy DWG */
	rlwinm.	%r12, %r12,29,23,31	/* buffer 1: dwords to page bdy	DWG */
	
	/* The following section prior to loop: figures out whether	*/
	/* the buffer 1 or buffer 2 is closer to the page boundary.	*/
	/* The main loop count is then set up to reflect the number of	*/
	/* double words of the buffer that is closest			*/

	cmpw	%r10, %r12		/* Find closest			*/
	blt	lt

	mr	%r10, %r12

lt:

	srwi	%r12, %r5, 3		/* Double check the total count */
	cmpw	%r10, %r12		/* limitation			*/
	blt	lt2

	mr	%r10, %r12		/* DWG */
lt2:					/* DWG */
	cmpwi	%r10, 0			/* DWG */
	bne	lt3			/* DWG */
	addi	%r4, %r4, 0x0004	/* DWG */
	addi	%r11,%r11,0x0004	/* DWG */
	b	again			/* DWG */
lt3:					/* DWG */
	mtctr	%r10			/* dword count for loop		*/
	lwzu	%r6, 4(%r11)		/* pre-load buffer 1 word	*/

	b	in			/* To the loop			*/

loop:					/* main loop			*/

	cmplw	%r8, %r6		/* Compare first buffer 2 word	*/
	bne-	all_done		/* with first buffer 1 word	*/
					/* If different, we're done	*/
	cmplw	%r9, %r7		/* Compare second buffer 2 word	*/
					/* with second buffer 1 word	*/
	lwzu	%r6, 4(%r11)		/* pre-load buffer 1 word	*/

	bne-	all_done		/* If different, we're done	*/

in:

	lwzu	%r7, 4(%r11)		/* pre-load buffer 1 word	*/
	lwzu	%r8, 4(%r4)		/* pre-load buffer 2 word	*/
	lwzu	%r9, 4(%r4)		/* pre-load buffer 2 word	*/

	bdnz+	loop			/* Do more DW's if cnt > 0	*/

	/*mfctr	%r12*/ /*DWG*/		/* number of dwords left	*/
	/*subf	%r10, %r12, %r10*/ /*DWG*//* number of dwords compared	*/
	slwi	%r10, %r10, 3
	subf	%r5, %r10, %r5		/* adjust byte counter		*/
	/*bne+	partial*/ /*DWG*/	/* If less than 8 bytes, handle */
					/* specially			*/
	/*cmpwi	%r5, 8*/		/* Removed.		 DWG */
	/*blt	partial*/		/* Removed.		 DWG */

	/*addic	%r5, %r5, -8*/ /*DWG*/	/* Subtract two words from count*/

	cmplw	%r8, %r6		/* compare last dword		*/
	addi	%r4, %r4, 4
	bne-	all_done

	cmplw	%r9, %r7
	addi	%r11, %r11, 4
	bne-	all_done

bytebybyte:

	/* We've gotten close to a page boundary: do a byte-byte-byte
	 * compare for the following 8 bytes, and then go back to
	 * the full-word compare loop.
	 */

	li	%r3, 8			/* loop count			*/
	cmpw	%r3, %r5		/* take min(8, counter)		*/
	ble	f2

	mr.	%r3, %r5

	beqlr

f2:

	mtctr	%r3
	subf	%r5, %r3, %r5		/* adjust counter		*/

bbb:

	lbz	%r6, 0(%r11)		/* byte copy loop		*/

	addi	%r11, %r11, 1

	lbz	%r8, 0(%r4)

	addi	%r4, %r4, 1

	cmplw	%r8, %r6

	bdnzt+	eq, bbb

	bne	all_done

	cmpwi	%r5, 0
	bgt	again			/* handle the rest		*/

	xor	%r3,%r3,%r3

	blr

#if 0 /* Removed code section. DWG */
partial:

	mr.	%r3, %r5

	beqlr				/* If count -> 0, we're done	*/

f1:

	subfic	%r3, %r3, 4		/* zero/end in first word?	*/
	cmpwi	%r3, 0
	blt	last4
#endif /* DWG */

first4:
	subfic	%r3, %r5, 4		/* If count <= 4, handle 	*/
	rlwinm	%r3, %r3, 3, 0, 31	/* count *= 8			*/
	srw	%r6, %r6, %r3		/* align 1st buffer 1 word	*/
	srw	%r8, %r8, %r3		/* align 1st buffer 2 word	*/

	cmplw	%r8, %r6		/* get result			*/
	bne	all_done
	xor	%r3,%r3,%r3
	blr

last4:
	subfic	%r10, %r5, 8		/*DWG*/
	rlwinm	%r10, %r10, 3, 0, 31	/* count *= 8			*/
	srw	%r7, %r7, %r10		/* align 2nd buffer 1 word	*/
	srw	%r9, %r9, %r10		/* align 2nd buffer 2 word	*/

	cmplw	%r9, %r7		/* get result			*/
	bne	all_done
ret_0:
	xor	%r3,%r3,%r3		/* Equal result		 */
	blr

all_done:

	blt	finish_lt

	addi	%r3,0,-1		/* Less than result		*/

	blr

finish_lt:

	addi	%r3,0,1			/* Greater than result		*/

	blr

File Added: src/common/lib/libc/arch/powerpc/string/memcpy.S
/* $NetBSD: memcpy.S,v 1.2.2.2 2008/03/23 00:12:43 matt Exp $ */

/* stropt/memcpy_440.S, pl_string_common, pl_linux 10/11/04 11:45:36
 * ==========================================================================
 * Optimized memcpy implementation for IBM PowerPC 440.
 *
 *  Copyright (c) 2003, IBM Corporation
 *  All rights reserved.	       
 *				     
 *  Redistribution and use in source and binary forms, with or      
 *  without modification, are permitted provided that the following 
 *  conditions are met:					     
 *								  
 *    * Redistributions of source code must retain the above	
 *      copyright notice, this list of conditions and the following 
 *      disclaimer.						 
 *    * Redistributions in binary form must reproduce the above     
 *      copyright notice, this list of conditions and the following 
 *      disclaimer in the documentation and/or other materials      
 *      provided with the distribution.			     
 *    * Neither the name of IBM nor the names of its contributors   
 *      may be used to endorse or promote products derived from this
 *      software without specific prior written permission.	 
 *								  
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND	  
 *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,     
 *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF	
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE	
 *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS   
 *  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 *  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,	    
 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  
 *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 *  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT	
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE   
 *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *									  
 * ==========================================================================
 *
 * Function: Copy n bytes of the source to the destination. Behavior is
 *	   undefined for objects that overlap.
 *
 *
 *	   void *memcpy(void * dest, const void * src, int n)
 *
 * Input:  r3 - destination address
 *	 r4 - source address
 *	 r5 - byte count
 * Output: r3 - destination address
 *
 * ==========================================================================
 */

#define _NOREGNAMES
#include <machine/asm.h>

	.text
	.align 4
/* LINTSTUB: Func: void *memcpy(void *, const void *, size_t) */
ENTRY(memcpy)
	/*
	 * Check count passed in R5. If zero, return; otherwise continue.
	 */
	cmpwi	%r5,0
	beqlr-

	mr	%r8, %r3		/* Copy dst (return value)	*/

	addi	%r4, %r4, -4		/* Prepare for main loop's auto	*/
	addi	%r8, %r8, -4		/* update		       */

	srwi.	%r9,%r5,2		/* Word count -> r9 		*/
	beq-	last1			/* Partial copy if <4 bytes	*/

	mtctr	%r9			/* Word cnt in CTR for loop     */
	lwzu	%r7, 4(%r4)		/* Preload for main loop	*/

	b	g1

g0:					/* Main loop			*/

	lwzu	%r7, 4(%r4)		/* Load a new word		*/
	stwu	%r6, 4(%r8)		/* Store previous word		*/

g1:

	bdz-	last			/* Dec ctr and exit loop if no  */
					/* more words		   */
	lwzu	%r6, 4(%r4)		/* Load another word		*/
	stwu	%r7, 4(%r8)		/* Store previous word		*/
	bdnz+	g0			/* Dec ctr and continue loop if */
					/* more words		   */

	mr	%r7, %r6

last:

	stwu	%r7, 4(%r8)		/* Store last word		*/

last1:					/* Byte-by-byte copy		*/

	clrlwi.	%r5,%r5,30
	beqlr

	mtctr	%r5

	lbzu	%r6, 4(%r4)		/* 1st byte: update by word	*/
	stbu	%r6, 4(%r8)
	bdzlr-

last2:

	lbzu	%r6, 1(%r4)		/* Handle the rest		*/
	stbu	%r6, 1(%r8)
	bdnz+	last2

	blr


File Added: src/common/lib/libc/arch/powerpc/string/memmove.S
/* $NetBSD: memmove.S,v 1.2.2.2 2008/03/23 00:12:43 matt Exp $ */

/* stropt/memmove.S, pl_string_common, pl_linux 10/11/04 11:45:37
 * ==========================================================================
 * Optimized memmove implementation for IBM PowerPC 405/440.
 *
 *	Copyright (c) 2003, IBM Corporation
 *	All rights reserved.		
 *					
 *	Redistribution and use in source and binary forms, with or	
 *	without modification, are permitted provided that the following 
 *	conditions are met:						
 *									
 *	* Redistributions of source code must retain the above	
 *	copyright notice, this list of conditions and the following 
 *	disclaimer.						 
 *	* Redistributions in binary form must reproduce the above	
 *	copyright notice, this list of conditions and the following 
 *	disclaimer in the documentation and/or other materials	
 *	provided with the distribution.				
 *	* Neither the name of IBM nor the names of its contributors	
 *	may be used to endorse or promote products derived from this
 *	software without specific prior written permission.	 
 *									
 *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND		
 *	CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,	
 *	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF	
 *	MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE	
 *	DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS	
 *	BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 *	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,		
 *	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR	
 *	PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 *	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT	
 *	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE	
 *	USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *										
 * ==========================================================================
 *
 * Function: Move memory area (handles overlapping regions)
 *
 *		void *memmove(void * dest, const void * src, int n) 
 *	
 * Input:	r3 - destination address 
 *	 r4 - source address 
 *	 r5 - byte count
 * Output: r3 - destination address
 *
 * ==========================================================================
 */

#define _NOREGNAMES
#include <machine/asm.h>

        .text
        .align 4
#ifdef _BCOPY
/* bcopy = memcpy/memmove with arguments reversed. */
/* LINTSTUB: Func: void bcopy(void *, void *, size_t) */
ENTRY(bcopy)
	mr	%r6, %r3		/* swap src/dst */
	mr	%r3, %r4
	mr	%r4, %r6
#else
/* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */
ENTRY(memmove)
#endif

	mr	%r8, %r3		/* Save dst (return value)	*/
	
	cmpw	%r4, %r8		/* Branch to reverse if 	*/
	blt	reverse			/* src < dest. Don't want to	*/
					/* overwrite end of src with	*/
					/* start of dest 		*/

	addi	%r4, %r4, -4		/* Back up src and dst pointers */
	addi	%r8, %r8, -4		/* due to auto-update of 'load' */ 
	
	srwi.	%r9,%r5,2			/* How many words in total cnt	*/
	beq-	last1			/* Handle byte by byte if < 4	*/
					/* bytes total 			*/
	mtctr	%r9			/* Count of words for loop		*/
	lwzu	%r7, 4(%r4)		/* Preload first word		*/
	
	b	g1

g0:					/* Main loop			*/

	lwzu	%r7, 4(%r4)		/* Load a new word		*/
	stwu	%r6, 4(%r8)		/* Store previous word		*/
	
g1:

	bdz-	last			/* Dec cnt, and branch if just	*/
					/* one word to store		*/
	lwzu	%r6, 4(%r4)		/* Load another word		*/
	stwu	%r7, 4(%r8)		/* Store previous word		*/
	bdnz+	g0			/* Dec cnt, and loop again if	*/
					/* more words			*/
	mr	%r7, %r6			/* If word count -> 0, then...	*/
	
last:

	stwu	%r7, 4(%r8)		/* ... store last word		*/

last1:					/* Byte-by-byte copy		*/

	clrlwi.	%r5,%r5,30		/* If count -> 0, then ...	*/
	beqlr				/* we're done			*/
	
	mtctr	%r5			/* else load count for loop	*/
	
	lbzu	%r6, 4(%r4)		/* 1st byte: update addr by 4	*/
	stbu	%r6, 4(%r8)		/* since we pre-adjusted by 4	*/
	bdzlr-				/* in anticipation of main loop */
	
last2:

	lbzu	%r6, 1(%r4)		/* But handle the rest by		*/
	stbu	%r6, 1(%r8)		/* updating addr by 1		*/
	bdnz+	last2
	
	blr

	/* We're here since src < dest. Don't want to overwrite end of	*/
	/* src with start of dest						*/

reverse:

	add	%r4, %r4, %r5		/* Work from end to beginning	*/
	add	%r8, %r8, %r5 		/* so add count to string ptrs	*/
	srwi.	%r9,%r5,2			/* Words in total count		*/
	beq-	rlast1			/* Handle byte by byte if < 4	*/
					/* bytes total 			*/
	
	mtctr	%r9			/* Count of words for loop 	*/
	
	lwzu	%r7, -4(%r4)		/* Preload first word		*/
	b	rg1

rg0:					/* Main loop			*/

	lwzu	%r7, -4(%r4)		/* Load a new word		*/
	stwu	%r6, -4(%r8)		/* Store previous word		*/
	
rg1:

	bdz-	rlast			/* Dec cnt, and branch if just	*/
					/* one word to store		*/

	lwzu	%r6, -4(%r4)		/* Load another word		*/
	stwu	%r7, -4(%r8)		/* Store previous word		*/
	
	bdnz+	rg0			/* Dec cnt, and loop again if	*/
					/* more words			*/

	mr	%r7, %r6			/* If word count -> 0, then...	*/
	
rlast:

	stwu	%r7, -4(%r8)		/* ... store last word		*/

rlast1:					/* Byte-by-byte copy		*/

	clrlwi.	%r5,%r5,30		/* If count -> 0, then...	*/
	beqlr				/* ... we're done 		*/
	
	mtctr	%r5			/* else load count for loop 	*/
	
rlast2:

	lbzu	%r6, -1(%r4)		/* Handle the rest, byte by 	*/
	stbu	%r6, -1(%r8)		/* byte				*/
	
	bdnz+	rlast2		 	/* Dec ctr, and branch if more	*/
					/* bytes left			*/
	blr


cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc64/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc64/atomic/Makefile.inc 2008/01/09 01:21:03 1.2.4.2
+++ src/common/lib/libc/arch/powerpc64/atomic/Makefile.inc 2008/03/23 00:12:43 1.2.4.3
@@ -1,8 +1,14 @@ @@ -1,8 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:21:03 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:21:03 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ 5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S 6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S
7 7
8.endif 8.endif
 9
 10.if defined(LIB) && (${LIB} == "c")
 11
 12SRCS+= atomic_init_cas.c
 13
 14.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/powerpc64/atomic/Attic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/powerpc64/atomic/Attic/atomic_cas.S 2008/01/09 01:21:04 1.2.4.2
+++ src/common/lib/libc/arch/powerpc64/atomic/Attic/atomic_cas.S 2008/03/23 00:12:43 1.2.4.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.2.4.2 2008/01/09 01:21:04 matt Exp $ */ 1/* atomic_cas.S,v 1.2.4.2 2008/01/09 01:21:04 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -40,18 +40,26 @@ @@ -40,18 +40,26 @@
40 40
41#include "../../powerpc/atomic/atomic_cas.S" 41#include "../../powerpc/atomic/atomic_cas.S"
42 42
43 .text 43 .text
44 44
45ENTRY_NOPROFILE(_atomic_cas_64) 45ENTRY_NOPROFILE(_atomic_cas_64)
461: ldarx r10,0,r3 461: ldarx r10,0,r3
47 cmpd r10,r4 47 cmpd r10,r4
48 bne- 2f 48 bne- 2f
49 stdcx. r5,0,r3 49 stdcx. r5,0,r3
50 bne- 1b 50 bne- 1b
512: mr r3,r10 512: mr r3,r10
52 blr 52 blr
 53
53ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) 54ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
54ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) 55ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
55STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) 56STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
56ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) 57ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
57STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) 58STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
 59
 60ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
 61STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64)
 62ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64)
 63STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64)
 64ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64)
 65STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64)

cvs diff -r1.1.4.2 -r1.1.4.3 src/common/lib/libc/arch/sh3/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/sh3/atomic/Makefile.inc 2008/01/09 01:21:07 1.1.4.2
+++ src/common/lib/libc/arch/sh3/atomic/Makefile.inc 2008/03/23 00:12:43 1.1.4.3
@@ -1,10 +1,16 @@ @@ -1,10 +1,16 @@
1# $NetBSD: Makefile.inc,v 1.1.4.2 2008/01/09 01:21:07 matt Exp $ 1# Makefile.inc,v 1.1.4.2 2008/01/09 01:21:07 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ 5SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ 6 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ 7 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c 8 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c
9 9
10.endif 10.endif
 11
 12.if defined(LIB) && (${LIB} == "c")
 13
 14SRCS+= atomic_init_testset.c
 15
 16.endif

cvs diff -r1.1 -r1.1.18.1 src/common/lib/libc/arch/sh3/string/memset.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/sh3/string/memset.S 2005/12/20 19:28:50 1.1
+++ src/common/lib/libc/arch/sh3/string/memset.S 2008/03/23 00:12:43 1.1.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ 1/* memset.S,v 1.1 2005/12/20 19:28:50 christos Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2002 SHIMIZU Ryo. All rights reserved. 4 * Copyright (c) 2002 SHIMIZU Ryo. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products 14 * 3. The name of the author may not be used to endorse or promote products
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <machine/asm.h> 29#include <machine/asm.h>
30 30
31#if defined(LIBC_SCCS) && !defined(lint) 31#if defined(LIBC_SCCS) && !defined(lint)
32 RCSID("$NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $") 32 RCSID("memset.S,v 1.1 2005/12/20 19:28:50 christos Exp")
33#endif 33#endif
34 34
35#define REG_PTR r0 35#define REG_PTR r0
36#define REG_TMP1 r1 36#define REG_TMP1 r1
37 37
38#ifdef BZERO 38#ifdef BZERO
39# define REG_C r2 39# define REG_C r2
40# define REG_DST r4 40# define REG_DST r4
41# define REG_LEN r5 41# define REG_LEN r5
42#else 42#else
43# define REG_DST0 r3 43# define REG_DST0 r3
44# define REG_DST r4 44# define REG_DST r4
45# define REG_C r5 45# define REG_C r5
@@ -263,36 +263,36 @@ aligned: @@ -263,36 +263,36 @@ aligned:
263 263
264unaligned_dst: 264unaligned_dst:
265 mov #1,REG_TMP1 265 mov #1,REG_TMP1
266 tst REG_TMP1,REG_DST /* if (dst & 1) { */ 266 tst REG_TMP1,REG_DST /* if (dst & 1) { */
267 add #1,REG_TMP1 267 add #1,REG_TMP1
268 bt/s 2f 268 bt/s 2f
269 tst REG_TMP1,REG_DST 269 tst REG_TMP1,REG_DST
270 mov.b REG_C,@REG_DST /* *dst++ = c; */ 270 mov.b REG_C,@REG_DST /* *dst++ = c; */
271 add #1,REG_DST 271 add #1,REG_DST
272 tst REG_TMP1,REG_DST 272 tst REG_TMP1,REG_DST
2732: /* } */ 2732: /* } */
274 /* if (dst & 2) { */ 274 /* if (dst & 2) { */
275 bt 4f 275 bt 4f
276 mov.w REG_C,@REG_DST /* *(u_int16_t*)dst++ = c; */ 276 mov.w REG_C,@REG_DST /* *(uint16_t*)dst++ = c; */
277 add #2,REG_DST 277 add #2,REG_DST
2784: /* } */ 2784: /* } */
279 279
280 280
281 tst #3,REG_PTR /* if (ptr & 3) { */ 281 tst #3,REG_PTR /* if (ptr & 3) { */
282 bt/s 4f /* */ 282 bt/s 4f /* */
283unaligned_len: 283unaligned_len:
284 tst #1,REG_PTR /* if (ptr & 1) { */ 284 tst #1,REG_PTR /* if (ptr & 1) { */
285 bt/s 2f 285 bt/s 2f
286 tst #2,REG_PTR 286 tst #2,REG_PTR
287 mov.b REG_C,@-REG_PTR /* --ptr = c; */ 287 mov.b REG_C,@-REG_PTR /* --ptr = c; */
2882: /* } */ 2882: /* } */
289 /* if (ptr & 2) { */ 289 /* if (ptr & 2) { */
290 bt 4f 290 bt 4f
291 mov.w REG_C,@-REG_PTR /* *--(u_int16_t*)ptr = c; */ 291 mov.w REG_C,@-REG_PTR /* *--(uint16_t*)ptr = c; */
2924: /* } */ 2924: /* } */
293 /* } */ 293 /* } */
294 294
295 mov REG_PTR,REG_LEN 295 mov REG_PTR,REG_LEN
296 bra aligned 296 bra aligned
297 sub REG_DST,REG_LEN 297 sub REG_DST,REG_LEN
298 298

cvs diff -r1.4.2.2 -r1.4.2.3 src/common/lib/libc/arch/sparc/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc/atomic/Makefile.inc 2008/01/09 01:21:07 1.4.2.2
+++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc 2008/03/23 00:12:43 1.4.2.3
@@ -1,23 +1,34 @@ @@ -1,23 +1,34 @@
1# $NetBSD: Makefile.inc,v 1.4.2.2 2008/01/09 01:21:07 matt Exp $ 1# Makefile.inc,v 1.4.2.2 2008/01/09 01:21:07 matt Exp
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
5.if ${MACHINE} == "sparc64" 5.if ${MACHINE} == "sparc64"
6 6
7SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic 7SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic
8.PATH: ${SPARC64DIR} 8.PATH.c: ${SPARC64DIR}
 9.PATH.S: ${SPARC64DIR}
9 10
10.include "${SPARC64DIR}/Makefile.inc" 11.include "${SPARC64DIR}/Makefile.inc"
11 12
12.else 13.else
13. if defined(LIB) && (${LIB} == "kern") 
14 14
 15. if defined(LIB)
 16
 17. if (${LIB} == "kern" || ${LIB} == "c")
15SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ 18SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
16 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ 19 atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
17 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ 20 atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
18 atomic_or_32_nv_cas.c atomic_swap_32_cas.c \ 21 atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S
19 atomic_cas.S membar_ops.S 22. endif
 23
 24. if (${LIB} == "kern")
 25SRCS+= atomic_cas.S
 26. endif
 27
 28. if (${LIB} == "c")
 29SRCS+= atomic_init_testset.c
 30. endif
20 31
21. endif 32. endif
22 33
23.endif 34.endif

cvs diff -r1.4.4.2 -r1.4.4.3 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc/atomic/atomic_cas.S 2008/01/09 01:21:08 1.4.4.2
+++ src/common/lib/libc/arch/sparc/atomic/atomic_cas.S 2008/03/23 00:12:43 1.4.4.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.4.4.2 2008/01/09 01:21:08 matt Exp $ */ 1/* atomic_cas.S,v 1.4.4.2 2008/01/09 01:21:08 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran and Jason R. Thorpe. 8 * by Andrew Doran and Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -129,13 +129,22 @@ ENTRY_NOPROFILE(_atomic_cas_32) @@ -129,13 +129,22 @@ ENTRY_NOPROFILE(_atomic_cas_32)
129 129
1303: RELEASE_INTERLOCK 1303: RELEASE_INTERLOCK
131 131
132 retl 132 retl
133 mov %o3, %o0 ! return old value 133 mov %o3, %o0 ! return old value
134 134
135ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) 135ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
136ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) 136ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
137STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 137STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
138ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) 138ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32)
139STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) 139STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
140ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) 140ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
141STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) 141STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
 142
 143ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 144STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
 145ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
 146STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
 147ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
 148STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
 149ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
 150STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)

cvs diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h 2008/01/09 01:21:08 1.3.2.2
+++ src/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h 2008/03/23 00:12:43 1.3.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_op_asm.h,v 1.3.2.2 2008/01/09 01:21:08 matt Exp $ */ 1/* atomic_op_asm.h,v 1.3.2.2 2008/01/09 01:21:08 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -35,38 +35,38 @@ @@ -35,38 +35,38 @@
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#ifndef _ATOMIC_OP_ASM_H_ 39#ifndef _ATOMIC_OP_ASM_H_
40#define _ATOMIC_OP_ASM_H_ 40#define _ATOMIC_OP_ASM_H_
41 41
42#include <machine/asm.h> 42#include <machine/asm.h>
43 43
44#if defined(_KERNEL) 44#if defined(_KERNEL)
45 45
46#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) 46#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
47 47
48#ifdef __sparc64__ 48#ifdef __arch64__
49#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64) 49#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
50#else 50#else
51#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32) 51#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
52#endif 52#endif
53 53
54#else /* _KERNEL */ 54#else /* _KERNEL */
55 55
56#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) 56#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
57 57
58#ifdef __sparc64__ 58#ifdef __arch64__
59#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64) 59#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64)
60#else 60#else
61#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32) 61#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32)
62#endif 62#endif
63 63
64#endif /* _KERNEL */ 64#endif /* _KERNEL */
65 65
66#ifdef __sparc64__ 66#ifdef __arch64__
67#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64) 67#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
68#else 68#else
69#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32) 69#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
70#endif 70#endif
71 71
72#endif /* _ATOMIC_OP_ASM_H_ */ 72#endif /* _ATOMIC_OP_ASM_H_ */

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/sparc64/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc64/atomic/Makefile.inc 2008/01/09 01:21:09 1.2.4.2
+++ src/common/lib/libc/arch/sparc64/atomic/Makefile.inc 2008/03/23 00:12:43 1.2.4.3
@@ -1,8 +1,14 @@ @@ -1,8 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:21:09 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:21:09 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ 5SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S 6 atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S
7 7
8.endif 8.endif
 9
 10.if defined(LIB) && (${LIB} == "c")
 11
 12SRCS+= atomic_init_cas.c
 13
 14.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/sparc64/atomic/membar_ops.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc64/atomic/membar_ops.S 2008/01/09 01:21:14 1.2.4.2
+++ src/common/lib/libc/arch/sparc64/atomic/membar_ops.S 2008/03/23 00:12:43 1.2.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: membar_ops.S,v 1.2.4.2 2008/01/09 01:21:14 matt Exp $ */ 1/* membar_ops.S,v 1.2.4.2 2008/01/09 01:21:14 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe, and by Andrew Doran. 8 * by Jason R. Thorpe, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -37,24 +37,25 @@ @@ -37,24 +37,25 @@
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43/* These assume Total Store Order (TSO) */ 43/* These assume Total Store Order (TSO) */
44 44
45ENTRY_NOPROFILE(_membar_producer) 45ENTRY_NOPROFILE(_membar_producer)
46 retl 46 retl
47 nop 47 nop
48 48
49ENTRY_NOPROFILE(_membar_consumer) 49ENTRY_NOPROFILE(_membar_consumer)
 50 membar #LoadLoad
50 retl 51 retl
51 membar #LoadLoad 52 nop
52 53
53ATOMIC_OP_ALIAS(membar_producer,_membar_producer) 54ATOMIC_OP_ALIAS(membar_producer,_membar_producer)
54ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) 55ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer)
55ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) 56ATOMIC_OP_ALIAS(membar_enter,_membar_consumer)
56STRONG_ALIAS(_membar_enter,_membar_consumer) 57STRONG_ALIAS(_membar_enter,_membar_consumer)
57ATOMIC_OP_ALIAS(membar_exit,_membar_consumer) 58ATOMIC_OP_ALIAS(membar_exit,_membar_consumer)
58STRONG_ALIAS(_membar_exit,_membar_consumer) 59STRONG_ALIAS(_membar_exit,_membar_consumer)
59ATOMIC_OP_ALIAS(membar_sync,_membar_consumer) 60ATOMIC_OP_ALIAS(membar_sync,_membar_consumer)
60STRONG_ALIAS(_membar_sync,_membar_consumer) 61STRONG_ALIAS(_membar_sync,_membar_consumer)

cvs diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_cas.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc64/atomic/atomic_cas.S 2008/01/09 01:21:11 1.3.2.2
+++ src/common/lib/libc/arch/sparc64/atomic/atomic_cas.S 2008/03/23 00:12:43 1.3.2.3
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* $NetBSD: atomic_cas.S,v 1.3.2.2 2008/01/09 01:21:11 matt Exp $ */ 1/* atomic_cas.S,v 1.3.2.2 2008/01/09 01:21:11 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
@@ -34,27 +34,40 @@ @@ -34,27 +34,40 @@
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#include "atomic_op_asm.h" 39#include "atomic_op_asm.h"
40 40
41 .text 41 .text
42 42
43ENTRY_NOPROFILE(_atomic_cas_32) 43ENTRY_NOPROFILE(_atomic_cas_32)
44 cas [%o0], %o1, %o2 44 cas [%o0], %o1, %o2
45 retl 45 retl
46 mov %o2, %o0 46 mov %o2, %o0
 47
47ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) 48ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
48ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) 49ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
49STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 50STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
50 51
 52ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 53STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
 54ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
 55STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
 56
51ENTRY_NOPROFILE(_atomic_cas_64) 57ENTRY_NOPROFILE(_atomic_cas_64)
52 casx [%o0], %o1, %o2 58 casx [%o0], %o1, %o2
53 retl 59 retl
54 mov %o2, %o0 60 mov %o2, %o0
55ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) 
56 61
 62ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
57ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas) 63ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas)
58STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas) 64STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas)
59ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas) 65ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas)
60STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas) 66STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas)
 67
 68ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
 69STRONG_ALIAS_SIZE(_atomic_cas_64_ni,_atomic_cas)
 70ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong_ni,_atomic_cas)
 71STRONG_ALIAS_SIZE(_atomic_cas_ulong_ni,_atomic_cas)
 72ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr_ni,_atomic_cas)
 73STRONG_ALIAS_SIZE(_atomic_cas_ptr_ni,_atomic_cas)

cvs diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h 2008/01/09 01:21:12 1.3.2.2
+++ src/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h 2008/03/23 00:12:43 1.3.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_op_asm.h,v 1.3.2.2 2008/01/09 01:21:12 matt Exp $ */ 1/* atomic_op_asm.h,v 1.3.2.2 2008/01/09 01:21:12 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -35,38 +35,38 @@ @@ -35,38 +35,38 @@
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39#ifndef _ATOMIC_OP_ASM_H_ 39#ifndef _ATOMIC_OP_ASM_H_
40#define _ATOMIC_OP_ASM_H_ 40#define _ATOMIC_OP_ASM_H_
41 41
42#include <machine/asm.h> 42#include <machine/asm.h>
43 43
44#if defined(_KERNEL) 44#if defined(_KERNEL)
45 45
46#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) 46#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s)
47 47
48#ifdef __sparc64__ 48#ifdef __arch64__
49#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64) 49#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
50#else 50#else
51#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32) 51#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
52#endif 52#endif
53 53
54#else /* _KERNEL */ 54#else /* _KERNEL */
55 55
56#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) 56#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s)
57 57
58#ifdef __sparc64__ 58#ifdef __arch64__
59#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64) 59#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_64)
60#else 60#else
61#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32) 61#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s/**/_32)
62#endif 62#endif
63 63
64#endif /* _KERNEL */ 64#endif /* _KERNEL */
65 65
66#ifdef __sparc64__ 66#ifdef __arch64__
67#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64) 67#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_64)
68#else 68#else
69#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32) 69#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s/**/_32)
70#endif 70#endif
71 71
72#endif /* _ATOMIC_OP_ASM_H_ */ 72#endif /* _ATOMIC_OP_ASM_H_ */

cvs diff -r1.3.2.2 -r1.3.2.3 src/common/lib/libc/arch/sparc64/atomic/atomic_or.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/sparc64/atomic/atomic_or.S 2008/01/09 01:21:13 1.3.2.2
+++ src/common/lib/libc/arch/sparc64/atomic/atomic_or.S 2008/03/23 00:12:43 1.3.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_or.S,v 1.3.2.2 2008/01/09 01:21:13 matt Exp $ */ 1/* atomic_or.S,v 1.3.2.2 2008/01/09 01:21:13 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -63,17 +63,17 @@ ENTRY_NOPROFILE(_atomic_or_64) @@ -63,17 +63,17 @@ ENTRY_NOPROFILE(_atomic_or_64)
631: or %o1, %o2, %o3 631: or %o1, %o2, %o3
64 casx [%o0], %o2, %o3 64 casx [%o0], %o2, %o3
65 cmp %o2, %o3 65 cmp %o2, %o3
66 bne,a,pn %icc, 1b 66 bne,a,pn %icc, 1b
67 mov %o3, %o2 67 mov %o3, %o2
68 retl 68 retl
69 or %o1, %o2, %o0 69 or %o1, %o2, %o0
70ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) 70ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
71 71
72ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64) 72ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64)
73STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64) 73STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64)
74 74
75ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong,_atomic_or) 75ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong,_atomic_or)
76STRONG_ALIAS(_atomic_or_ulong,_atomic_or) 76STRONG_ALIAS_SIZE(_atomic_or_ulong,_atomic_or)
77 77
78ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong_nv,_atomic_or) 78ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong_nv,_atomic_or)
79STRONG_ALIAS_SIZE(_atomic_or_ulong_nv,_atomic_or) 79STRONG_ALIAS_SIZE(_atomic_or_ulong_nv,_atomic_or)

File Added: src/common/lib/libc/arch/vax/atomic/Makefile.inc
#	$NetBSD: Makefile.inc,v 1.3.4.2 2008/03/23 00:12:43 matt Exp $

.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")

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 \
	atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
	atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c

.endif

.if defined(LIB) && (${LIB} == "c")

SRCS+=	atomic_init_testset.c

.endif

cvs diff -r1.2.4.2 -r1.2.4.3 src/common/lib/libc/arch/x86_64/atomic/Makefile.inc (expand / switch to unified diff)

--- src/common/lib/libc/arch/x86_64/atomic/Makefile.inc 2008/01/09 01:21:14 1.2.4.2
+++ src/common/lib/libc/arch/x86_64/atomic/Makefile.inc 2008/03/23 00:12:44 1.2.4.3
@@ -1,7 +1,13 @@ @@ -1,7 +1,13 @@
1# $NetBSD: Makefile.inc,v 1.2.4.2 2008/01/09 01:21:14 matt Exp $ 1# Makefile.inc,v 1.2.4.2 2008/01/09 01:21:14 matt Exp
2 2
3.if defined(LIB) && (${LIB} == "kern") 3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c")
4 4
5SRCS+= atomic.S 5SRCS+= atomic.S
6 6
7.endif 7.endif
 8
 9.if defined(LIB) && (${LIB} == "c")
 10
 11SRCS+= atomic_init_cas.c
 12
 13.endif

cvs diff -r1.7.4.2 -r1.7.4.3 src/common/lib/libc/arch/x86_64/atomic/atomic.S (expand / switch to unified diff)

--- src/common/lib/libc/arch/x86_64/atomic/atomic.S 2008/01/09 01:21:15 1.7.4.2
+++ src/common/lib/libc/arch/x86_64/atomic/atomic.S 2008/03/23 00:12:44 1.7.4.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic.S,v 1.7.4.2 2008/01/09 01:21:15 matt Exp $ */ 1/* atomic.S,v 1.7.4.2 2008/01/09 01:21:15 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe, and by Andrew Doran. 8 * by Jason R. Thorpe, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -122,26 +122,32 @@ NENTRY(_atomic_or_32_nv) @@ -122,26 +122,32 @@ NENTRY(_atomic_or_32_nv)
122 122
123NENTRY(_atomic_swap_32) 123NENTRY(_atomic_swap_32)
124 movl %esi, %eax 124 movl %esi, %eax
125 xchgl %eax, (%rdi) 125 xchgl %eax, (%rdi)
126 ret 126 ret
127 127
128NENTRY(_atomic_cas_32) 128NENTRY(_atomic_cas_32)
129 movl %esi, %eax 129 movl %esi, %eax
130 LOCK(12) 130 LOCK(12)
131 cmpxchgl %edx, (%rdi) 131 cmpxchgl %edx, (%rdi)
132 /* %eax now contains the old value */ 132 /* %eax now contains the old value */
133 ret 133 ret
134 134
 135NENTRY(_atomic_cas_32_ni)
 136 movl %esi, %eax
 137 cmpxchgl %edx, (%rdi)
 138 /* %eax now contains the old value */
 139 ret
 140
135/* 64-bit */ 141/* 64-bit */
136 142
137NENTRY(_atomic_add_64) 143NENTRY(_atomic_add_64)
138 LOCK(13) 144 LOCK(13)
139 addq %rsi, (%rdi) 145 addq %rsi, (%rdi)
140 ret 146 ret
141 147
142NENTRY(_atomic_add_64_nv) 148NENTRY(_atomic_add_64_nv)
143 movq %rsi, %rax 149 movq %rsi, %rax
144 LOCK(14) 150 LOCK(14)
145 xaddq %rax, (%rdi) 151 xaddq %rax, (%rdi)
146 addq %rsi, %rax 152 addq %rsi, %rax
147 ret 153 ret
@@ -204,52 +210,46 @@ NENTRY(_atomic_or_64_nv) @@ -204,52 +210,46 @@ NENTRY(_atomic_or_64_nv)
204 210
205NENTRY(_atomic_swap_64) 211NENTRY(_atomic_swap_64)
206 movq %rsi, %rax 212 movq %rsi, %rax
207 xchgq %rax, (%rdi) 213 xchgq %rax, (%rdi)
208 ret 214 ret
209 215
210NENTRY(_atomic_cas_64) 216NENTRY(_atomic_cas_64)
211 movq %rsi, %rax 217 movq %rsi, %rax
212 LOCK(24) 218 LOCK(24)
213 cmpxchgq %rdx, (%rdi) 219 cmpxchgq %rdx, (%rdi)
214 /* %eax now contains the old value */ 220 /* %eax now contains the old value */
215 ret 221 ret
216 222
 223NENTRY(_atomic_cas_64_ni)
 224 movq %rsi, %rax
 225 cmpxchgq %rdx, (%rdi)
 226 /* %eax now contains the old value */
 227 ret
 228
217/* memory barriers */ 229/* memory barriers */
218 230
219NENTRY(_membar_consumer) 231NENTRY(_membar_consumer)
220 LOCK(25) 232 LOCK(25)
221 addq $0, -8(%rsp) 233 addq $0, -8(%rsp)
222 ret 234 ret
223END(membar_consumer_end) 235END(membar_consumer_end)
224 236
225NENTRY(_membar_producer) 237NENTRY(_membar_producer)
226 /* A store is enough */ 238 /* A store is enough */
227 movq $0, -8(%rsp) 239 movq $0, -8(%rsp)
228 ret 240 ret
229END(membar_producer_end) 241END(membar_producer_end)
230 242
231NENTRY(_membar_enter) 
232 /* A store is enough */ 
233 movq $0, -8(%rsp) 
234 ret 
235END(membar_enter_end) 
236 
237NENTRY(_membar_exit) 
238 /* A store is enough */ 
239 movq $0, -8(%rsp) 
240 ret 
241END(membar_exit_end) 
242 
243NENTRY(_membar_sync) 243NENTRY(_membar_sync)
244 LOCK(26) 244 LOCK(26)
245 addq $0, -8(%rsp) 245 addq $0, -8(%rsp)
246 ret 246 ret
247END(membar_sync_end) 247END(membar_sync_end)
248 248
249#ifdef _KERNEL 249#ifdef _KERNEL
250NENTRY(sse2_lfence) 250NENTRY(sse2_lfence)
251 lfence 251 lfence
252 ret 252 ret
253END(sse2_lfence_end) 253END(sse2_lfence_end)
254 254
255NENTRY(sse2_mfence) 255NENTRY(sse2_mfence)
@@ -328,30 +328,36 @@ ALIAS(atomic_or_ptr_nv,_atomic_or_64_nv) @@ -328,30 +328,36 @@ ALIAS(atomic_or_ptr_nv,_atomic_or_64_nv)
328 328
329ALIAS(atomic_swap_32,_atomic_swap_32) 329ALIAS(atomic_swap_32,_atomic_swap_32)
330ALIAS(atomic_swap_64,_atomic_swap_64) 330ALIAS(atomic_swap_64,_atomic_swap_64)
331ALIAS(atomic_swap_uint,_atomic_swap_32) 331ALIAS(atomic_swap_uint,_atomic_swap_32)
332ALIAS(atomic_swap_ulong,_atomic_swap_64) 332ALIAS(atomic_swap_ulong,_atomic_swap_64)
333ALIAS(atomic_swap_ptr,_atomic_swap_64) 333ALIAS(atomic_swap_ptr,_atomic_swap_64)
334 334
335ALIAS(atomic_cas_32,_atomic_cas_32) 335ALIAS(atomic_cas_32,_atomic_cas_32)
336ALIAS(atomic_cas_64,_atomic_cas_64) 336ALIAS(atomic_cas_64,_atomic_cas_64)
337ALIAS(atomic_cas_uint,_atomic_cas_32) 337ALIAS(atomic_cas_uint,_atomic_cas_32)
338ALIAS(atomic_cas_ulong,_atomic_cas_64) 338ALIAS(atomic_cas_ulong,_atomic_cas_64)
339ALIAS(atomic_cas_ptr,_atomic_cas_64) 339ALIAS(atomic_cas_ptr,_atomic_cas_64)
340 340
 341ALIAS(atomic_cas_32_ni,_atomic_cas_32_ni)
 342ALIAS(atomic_cas_64_ni,_atomic_cas_64_ni)
 343ALIAS(atomic_cas_uint_ni,_atomic_cas_32_ni)
 344ALIAS(atomic_cas_ulong_ni,_atomic_cas_64_ni)
 345ALIAS(atomic_cas_ptr_ni,_atomic_cas_64_ni)
 346
341ALIAS(membar_consumer,_membar_consumer) 347ALIAS(membar_consumer,_membar_consumer)
342ALIAS(membar_producer,_membar_producer) 348ALIAS(membar_producer,_membar_producer)
343ALIAS(membar_enter,_membar_enter) 349ALIAS(membar_enter,_membar_consumer)
344ALIAS(membar_exit,_membar_exit) 350ALIAS(membar_exit,_membar_producer)
345ALIAS(membar_sync,_membar_sync) 351ALIAS(membar_sync,_membar_sync)
346 352
347STRONG_ALIAS(_atomic_add_int,_atomic_add_32) 353STRONG_ALIAS(_atomic_add_int,_atomic_add_32)
348STRONG_ALIAS(_atomic_add_long,_atomic_add_64) 354STRONG_ALIAS(_atomic_add_long,_atomic_add_64)
349STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) 355STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64)
350 356
351STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) 357STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv)
352STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) 358STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv)
353STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) 359STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv)
354 360
355STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 361STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
356STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) 362STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64)
357STRONG_ALIAS(_atomic_and_ptr,_atomic_and_64) 363STRONG_ALIAS(_atomic_and_ptr,_atomic_and_64)
@@ -381,13 +387,20 @@ STRONG_ALIAS(_atomic_or_ulong,_atomic_or @@ -381,13 +387,20 @@ STRONG_ALIAS(_atomic_or_ulong,_atomic_or
381STRONG_ALIAS(_atomic_or_ptr,_atomic_or_64) 387STRONG_ALIAS(_atomic_or_ptr,_atomic_or_64)
382 388
383STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) 389STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv)
384STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) 390STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv)
385STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_64_nv) 391STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_64_nv)
386 392
387STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) 393STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32)
388STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) 394STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64)
389STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) 395STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64)
390 396
391STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) 397STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
392STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) 398STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
393STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) 399STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
 400
 401STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32_ni)
 402STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64_ni)
 403STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64_ni)
 404
 405STRONG_ALIAS(_membar_enter,_membar_consumer)
 406STRONG_ALIAS(_membar_exit,_membar_producer)

File Added: src/common/lib/libc/atomic/atomic_init_cas.c
/*	$NetBSD: atomic_init_cas.c,v 1.2.4.2 2008/03/23 00:12:44 matt Exp $	*/

/*-
 * Copyright (c) 2008 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * libc glue for atomic operations where the hardware _does_ provide
 * compare-and-swap.
 */

#include <sys/cdefs.h>
__RCSID("$NetBSD: atomic_init_cas.c,v 1.2.4.2 2008/03/23 00:12:44 matt Exp $");

void	__libc_atomic_init(void) __attribute__ ((visibility("hidden")));

void
__libc_atomic_init(void)
{

	/* nothing to do */
}

File Added: src/common/lib/libc/atomic/atomic_init_testset.c
/*	$NetBSD: atomic_init_testset.c,v 1.3.4.2 2008/03/23 00:12:44 matt Exp $	*/

/*-
 * Copyright (c) 2008 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * libc glue for atomic operations where the hardware does not provide
 * compare-and-swap.  It's assumed that this will only be used on 32-bit
 * platforms.
 *
 * This should be compiled with '-fno-reorder-blocks -fomit-frame-pointer'
 * if using gcc.
 */

#include <sys/cdefs.h>
__RCSID("$NetBSD: atomic_init_testset.c,v 1.3.4.2 2008/03/23 00:12:44 matt Exp $");

#include "atomic_op_namespace.h"

#include <sys/types.h>
#include <sys/atomic.h>
#include <sys/lock.h>
#include <sys/ras.h>
#include <sys/sysctl.h>

#include <string.h>

#define	I2	__SIMPLELOCK_UNLOCKED, __SIMPLELOCK_UNLOCKED,
#define	I16	I2 I2 I2 I2 I2 I2 I2 I2
#define	I128	I16 I16 I16 I16 I16 I16 I16 I16

static __cpu_simple_lock_t atomic_locks[128] = { I128 };
static uint32_t (*_atomic_cas_fn)(volatile uint32_t *, uint32_t, uint32_t);

void	__libc_atomic_init(void) __attribute__ ((visibility("hidden")));

RAS_DECL(_atomic_cas);

static uint32_t
_atomic_cas_up(volatile uint32_t *ptr, uint32_t old, uint32_t new)
{
	uint32_t ret;

	RAS_START(_atomic_cas);
	ret = *ptr;
	if (__predict_false(ret != old)) {
		return ret;
	}
	*ptr = new;
	RAS_END(_atomic_cas);

	return ret;
}

static uint32_t
_atomic_cas_mp(volatile uint32_t *ptr, uint32_t old, uint32_t new)
{
	__cpu_simple_lock_t *lock;
	uint32_t ret;

	lock = &atomic_locks[((uint32_t)ptr >> 3) & 127];
	__cpu_simple_lock(lock);
	ret = *ptr;
	if (__predict_true(ret == old)) {
		*ptr = new;
	}
	__cpu_simple_unlock(lock);

	return ret;
}

uint32_t
_atomic_cas_32(volatile uint32_t *ptr, uint32_t old, uint32_t new)
{

	return (*_atomic_cas_fn)(ptr, old, new);
}

void
__libc_atomic_init(void)
{
	int ncpu, mib[2];
	size_t len;

	_atomic_cas_fn = _atomic_cas_mp;

	mib[0] = CTL_HW;
	mib[1] = HW_NCPU; 
	len = sizeof(ncpu);
	if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1)
		return;
	if (ncpu > 1)
		return;
	if (rasctl(RAS_ADDR(_atomic_cas), RAS_SIZE(_atomic_cas),
	    RAS_INSTALL) == 0) {
		_atomic_cas_fn = _atomic_cas_up;
		return;
	}
}

#undef atomic_cas_32
#undef atomic_cas_uint
#undef atomic_cas_ulong
#undef atomic_cas_ptr

atomic_op_alias(atomic_cas_32,_atomic_cas_32)
atomic_op_alias(atomic_cas_uint,_atomic_cas_32)
__strong_alias(_atomic_cas_uint,_atomic_cas_32)
atomic_op_alias(atomic_cas_ulong,_atomic_cas_32)
__strong_alias(_atomic_cas_ulong,_atomic_cas_32)
atomic_op_alias(atomic_cas_ptr,_atomic_cas_32)
__strong_alias(_atomic_cas_ptr,_atomic_cas_32)

atomic_op_alias(atomic_cas_32_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_32_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_uint_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_uint_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_ulong_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_ulong_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_ptr_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_ptr_ni,_atomic_cas_32)

cvs diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/atomic/Attic/atomic_ops.3 (expand / switch to unified diff)

--- src/common/lib/libc/atomic/Attic/atomic_ops.3 2008/01/09 01:21:30 1.3.4.2
+++ src/common/lib/libc/atomic/Attic/atomic_ops.3 2008/03/23 00:12:44 1.3.4.3
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1.\" $NetBSD: atomic_ops.3,v 1.3.4.2 2008/01/09 01:21:30 matt Exp $ 1.\" atomic_ops.3,v 1.3.4.2 2008/01/09 01:21:30 matt Exp
2.\" 2.\"
3.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
@@ -24,88 +24,120 @@ @@ -24,88 +24,120 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd April 11, 2007 37.Dd Febuary 11, 2007
38.Dt ATOMIC_OPS 3 38.Dt ATOMIC_OPS 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm atomic_ops 41.Nm atomic_ops
42.Nd atomic memory operations 42.Nd atomic memory operations
43.\" .Sh LIBRARY 43.\" .Sh LIBRARY
44.\" .Lb libc 44.\" .Lb libc
45.Sh SYNOPSIS 45.Sh SYNOPSIS
46.In sys/atomic.h 46.In sys/atomic.h
47.Sh DESCRIPTION 47.Sh DESCRIPTION
48The 48The
49.Nm atomic_ops 49.Nm atomic_ops
50family of functions provide atomic memory operations. 50family of functions provide atomic memory operations.
51There are 7 classes of atomic memory operations available: 51There are 7 classes of atomic memory operations available
 52:
52.Pp 53.Pp
53.Bl -tag -width "atomic_swap(3)" 54.Bl -tag -width "atomic_swap(3)"
54.It Xr atomic_add 3 55.It Xr atomic_add 3
55These functions perform atomic addition. 56These functions perform atomic addition.
56.It Xr atomic_and 3 57.It Xr atomic_and 3
57These functions perform atomic logical 58These functions perform atomic logical
58.Dq and . 59.Dq and .
59.It Xr atomic_cas 3 60.It Xr atomic_cas 3
60These functions perform atomic compare-and-swap. 61These functions perform atomic compare-and-swap.
61.It Xr atomic_dec 3 62.It Xr atomic_dec 3
62These functions perform atomic decrement. 63These functions perform atomic decrement.
63.It Xr atomic_inc 3 64.It Xr atomic_inc 3
64These functions perform atomic increment. 65These functions perform atomic increment.
65.It Xr atomic_or 3 66.It Xr atomic_or 3
66These functions perform atomic logical 67These functions perform atomic logical
67.Dq or . 68.Dq or .
68.It Xr atomic_swap 3 69.It Xr atomic_swap 3
69These functions perform atomic swap. 70These functions perform atomic swap.
70.El 71.El
71.Pp 72.Pp
72After an atomic operation is complete, the store to the target memory 73.Bl -tag -width aa
73location will have global visibility. 74.It Synchronization mechanisms
74The global visibility of other loads and stores before and after the atomic 
75operation are undefined. 
76Applications that require synchronization of loads and stores with respect 
77to an atomic operation must use memory barriers. 
78See 
79.Xr membar_ops 3 . 
80.Pp 75.Pp
81Because atomic memory operations require expensive synchronization at the 76Where the architecture does not provide hardware support for atomic compare
82hardware level, applications should take care to minimize their use. 77and swap (CAS), atomicity is provided by a restartable sequence or by a
83In certain cases, it may be more appropriate to use a mutex, especially 78spinlock.
84if more than one memory location will be modified. 79The chosen method is not ordinarily distinguishable by or visible to users
 80of the interface.
 81The following architectures can be assumed to provide CAS in hardware:
 82alpha, amd64, i386, powerpc, powerpc64, sparc64.
 83.It Scope and restrictions
 84.Pp
 85If hardware CAS is available, the atomic operations are globally atomic:
 86operations within a memory region shared between processes are
 87guaranteed to be performed atomically.
 88If hardware CAS is not available, it may only be assumed that the operations
 89are atomic with respect to threads in the same process.
 90Additionally, if hardware CAS is not available, the atomic operations must
 91not be used within a signal handler.
85.Pp 92.Pp
86Users of atomic memory operations should not make assumptions about how 93Users of atomic memory operations should not make assumptions about how
87the memory access is performed 94the memory access is performed
88.Pq specifically, the width of the memory access . 95.Pq specifically, the width of the memory access .
89For this reason, applications making use of atomic memory operations should 96For this reason, applications making use of atomic memory operations should
90limit their use to regular memory. 97limit their use to regular memory.
91The results of using atomic memory operations on anything other than 98The results of using atomic memory operations on anything other than
92regular memory are undefined. 99regular memory are undefined.
93.Pp 100.Pp
94Users of atomic memory operations should take care to modify any given 101Users of atomic memory operations should take care to modify any given
95memory location either entirely with atomic operations or entirely with 102memory location either entirely with atomic operations or entirely with
96some other synchronization mechanism. 103some other synchronization mechanism.
97Intermixing of atomic operations with other synchronization mechanisms 104Intermixing of atomic operations with other synchronization mechanisms
98for the same memory location results in undefined behavior. 105for the same memory location results in undefined behavior.
 106.It Visibility and ordering of memory accesses
 107.Pp
 108If hardware CAS is available, stores to the target memory location by an
 109atomic operation will reach global visibility before the operation
 110completes.
 111If hardware CAS is not available, the store may not reach global visibility
 112until some time after the atomic operation has completed.
 113However, in all cases a subsequent atomic operation on the same memory cell
 114will be delayed until the result of any preceeding operation has reached
 115global visibility.
 116.Pp
 117Atomic operations are strongly ordered with respect to each other.
 118The global visibility of other loads and stores before and after an atomic
 119operation is undefined.
 120Applications that require synchronization of loads and stores with respect
 121to an atomic operation must use memory barriers.
 122See
 123.Xr membar_ops 3 .
 124.It Performance
 125.Pp
 126Because atomic memory operations require expensive synchronization at the
 127hardware level, applications should take care to minimize their use.
 128In certain cases, it may be more appropriate to use a mutex, especially
 129if more than one memory location will be modified.
 130.El
99.Sh SEE ALSO 131.Sh SEE ALSO
100.Xr atomic_add 3 , 132.Xr atomic_add 3 ,
101.Xr atomic_and 3 , 133.Xr atomic_and 3 ,
102.Xr atomic_cas 3 , 134.Xr atomic_cas 3 ,
103.Xr atomic_dec 3 , 135.Xr atomic_dec 3 ,
104.Xr atomic_inc 3 , 136.Xr atomic_inc 3 ,
105.Xr atomic_or 3 , 137.Xr atomic_or 3 ,
106.Xr atomic_swap 3 , 138.Xr atomic_swap 3 ,
107.Xr membar_ops 3 139.Xr membar_ops 3
108.Sh HISTORY 140.Sh HISTORY
109The 141The
110.Nm atomic_ops 142.Nm atomic_ops
111functions first appeared in 143functions first appeared in

cvs diff -r1.3.4.2 -r1.3.4.3 src/common/lib/libc/atomic/Attic/membar_ops.3 (expand / switch to unified diff)

--- src/common/lib/libc/atomic/Attic/membar_ops.3 2008/01/09 01:21:34 1.3.4.2
+++ src/common/lib/libc/atomic/Attic/membar_ops.3 2008/03/23 00:12:44 1.3.4.3
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1.\" $NetBSD: membar_ops.3,v 1.3.4.2 2008/01/09 01:21:34 matt Exp $ 1.\" membar_ops.3,v 1.3.4.2 2008/01/09 01:21:34 matt Exp
2.\" 2.\"
3.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd April 11, 2007 37.Dd Febuary 11, 2007
38.Dt MEMBAR_OPS 3 38.Dt MEMBAR_OPS 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm membar_ops , 41.Nm membar_ops ,
42.Nm membar_enter , 42.Nm membar_enter ,
43.Nm membar_exit , 43.Nm membar_exit ,
44.Nm membar_producer , 44.Nm membar_producer ,
45.Nm membar_consumer , 45.Nm membar_consumer ,
46.Nm membar_sync 46.Nm membar_sync
47.Nd memory access barrier operations 47.Nd memory access barrier operations
48.\" .Sh LIBRARY 48.\" .Sh LIBRARY
49.\" .Lb libc 49.\" .Lb libc
50.Sh SYNOPSIS 50.Sh SYNOPSIS
@@ -57,51 +57,53 @@ @@ -57,51 +57,53 @@
57.Ft void 57.Ft void
58.Fn membar_producer "void" 58.Fn membar_producer "void"
59.Ft void 59.Ft void
60.Fn membar_consumer "void" 60.Fn membar_consumer "void"
61.Ft void 61.Ft void
62.Fn membar_sync "void" 62.Fn membar_sync "void"
63.Sh DESCRIPTION 63.Sh DESCRIPTION
64The 64The
65.Nm membar_ops 65.Nm membar_ops
66family of functions provide memory access barrier operations necessary 66family of functions provide memory access barrier operations necessary
67for synchronization in multiprocessor execution environments that have 67for synchronization in multiprocessor execution environments that have
68relaxed load and store order. 68relaxed load and store order.
69.Pp 69.Pp
70.Bl -tag -width "membar_producer()" 70.Bl -tag -width "mem"
71.It Fn membar_enter 71.It Fn membar_enter
72All loads and stores preceding the memory barrier will complete and 72.Pp
73reach global visibility before any stores after the memory barrier reach 73Any store preceeding
74global visibility 74.Fn membar_enter
75.Pq RW-W . 75will reach global visibility before all loads and stores following it.
 76.Pp
76.Fn membar_enter 77.Fn membar_enter
77is typically used in code that implements locking primitives to ensure 78is typically used in code that implements locking primitives to ensure
78that a lock protects its data. 79that a lock protects its data.
79.It Fn membar_exit 80.It Fn membar_exit
80All stores preceding the memory barrier will reach global visibility 81.Pp
81before any loads and stores after the memory barrier will complete and 82All loads and stores preceding
82reach global visibility 
83.Pq W-RW . 
84.Fn membar_exit 83.Fn membar_exit
85is typically used in code that implements locking primitives when a lock 84will reach global visibility before any store that follows it.
86is released. 85.Pp
 86.Fn membar_exit
 87is typically used in code that implements locking primitives to ensure
 88that a lock protects its data.
87.It Fn membar_producer 89.It Fn membar_producer
 90.Pp
88All stores preceding the memory barrier will reach global visibility 91All stores preceding the memory barrier will reach global visibility
89before any stores after the memory barrier reach global visibility 92before any stores after the memory barrier reach global visibility.
90.Pq W-W . 
91.It Fn membar_consumer 93.It Fn membar_consumer
 94.Pp
92All loads preceding the memory barrier will complete before any loads 95All loads preceding the memory barrier will complete before any loads
93after the memory barrier complete 96after the memory barrier complete.
94.Pq R-R . 
95.It Fn membar_sync 97.It Fn membar_sync
 98.Pp
96All loads and stores preceding the memory barrier will complete and 99All loads and stores preceding the memory barrier will complete and
97reach global visibility before any loads and stores after the memory 100reach global visibility before any loads and stores after the memory
98barrier complete and reach global visibility 101barrier complete and reach global visibility.
99.Pq RW-RW . 
100.El 102.El
101.Sh SEE ALSO 103.Sh SEE ALSO
102.Xr atomic_ops 3 104.Xr atomic_ops 3
103.Sh HISTORY 105.Sh HISTORY
104The 106The
105.Nm membar_ops 107.Nm membar_ops
106functions first appeared in 108functions first appeared in
107.Nx 5.0 . 109.Nx 5.0 .

cvs diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap16.c (expand / switch to unified diff)

--- src/common/lib/libc/gen/bswap16.c 2005/12/20 19:28:51 1.1
+++ src/common/lib/libc/gen/bswap16.c 2008/03/23 00:12:44 1.1.18.1
@@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
1/* $NetBSD: bswap16.c,v 1.1 2005/12/20 19:28:51 christos Exp $ */ 1/* bswap16.c,v 1.1 2005/12/20 19:28:51 christos Exp */
2 2
3/* 3/*
4 * Written by Manuel Bouyer <bouyer@NetBSD.org>. 4 * Written by Manuel Bouyer <bouyer@NetBSD.org>.
5 * Public domain. 5 * Public domain.
6 */ 6 */
7 7
8#include <sys/cdefs.h> 8#include <sys/cdefs.h>
9#if defined(LIBC_SCCS) && !defined(lint) 9#if defined(LIBC_SCCS) && !defined(lint)
10__RCSID("$NetBSD: bswap16.c,v 1.1 2005/12/20 19:28:51 christos Exp $"); 10__RCSID("bswap16.c,v 1.1 2005/12/20 19:28:51 christos Exp");
11#endif /* LIBC_SCCS and not lint */ 11#endif /* LIBC_SCCS and not lint */
12 12
13#include <sys/types.h> 13#include <sys/types.h>
14#include <machine/bswap.h> 14#include <machine/bswap.h>
15 15
16#undef bswap16 16#undef bswap16
17 17
18u_int16_t 18uint16_t
19bswap16(x) 19bswap16(x)
20 u_int16_t x; 20 uint16_t x;
21{ 21{
22 return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); 22 return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
23} 23}

cvs diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap32.c (expand / switch to unified diff)

--- src/common/lib/libc/gen/bswap32.c 2005/12/20 19:28:51 1.1
+++ src/common/lib/libc/gen/bswap32.c 2008/03/23 00:12:44 1.1.18.1
@@ -1,26 +1,26 @@ @@ -1,26 +1,26 @@
1/* $NetBSD: bswap32.c,v 1.1 2005/12/20 19:28:51 christos Exp $ */ 1/* bswap32.c,v 1.1 2005/12/20 19:28:51 christos Exp */
2 2
3/* 3/*
4 * Written by Manuel Bouyer <bouyer@NetBSD.org>. 4 * Written by Manuel Bouyer <bouyer@NetBSD.org>.
5 * Public domain. 5 * Public domain.
6 */ 6 */
7 7
8#include <sys/cdefs.h> 8#include <sys/cdefs.h>
9#if defined(LIBC_SCCS) && !defined(lint) 9#if defined(LIBC_SCCS) && !defined(lint)
10__RCSID("$NetBSD: bswap32.c,v 1.1 2005/12/20 19:28:51 christos Exp $"); 10__RCSID("bswap32.c,v 1.1 2005/12/20 19:28:51 christos Exp");
11#endif /* LIBC_SCCS and not lint */ 11#endif /* LIBC_SCCS and not lint */
12 12
13#include <sys/types.h> 13#include <sys/types.h>
14#include <machine/bswap.h> 14#include <machine/bswap.h>
15 15
16#undef bswap32 16#undef bswap32
17 17
18u_int32_t 18uint32_t
19bswap32(x) 19bswap32(x)
20 u_int32_t x; 20 uint32_t x;
21{ 21{
22 return ((x << 24) & 0xff000000 ) | 22 return ((x << 24) & 0xff000000 ) |
23 ((x << 8) & 0x00ff0000 ) | 23 ((x << 8) & 0x00ff0000 ) |
24 ((x >> 8) & 0x0000ff00 ) | 24 ((x >> 8) & 0x0000ff00 ) |
25 ((x >> 24) & 0x000000ff ); 25 ((x >> 24) & 0x000000ff );
26} 26}

cvs diff -r1.1 -r1.1.18.1 src/common/lib/libc/gen/bswap64.c (expand / switch to unified diff)

--- src/common/lib/libc/gen/bswap64.c 2005/12/20 19:28:51 1.1
+++ src/common/lib/libc/gen/bswap64.c 2008/03/23 00:12:44 1.1.18.1
@@ -1,45 +1,45 @@ @@ -1,45 +1,45 @@
1/* $NetBSD: bswap64.c,v 1.1 2005/12/20 19:28:51 christos Exp $ */ 1/* bswap64.c,v 1.1 2005/12/20 19:28:51 christos Exp */
2 2
3/* 3/*
4 * Written by Manuel Bouyer <bouyer@NetBSD.org>. 4 * Written by Manuel Bouyer <bouyer@NetBSD.org>.
5 * Public domain. 5 * Public domain.
6 */ 6 */
7 7
8#include <sys/cdefs.h> 8#include <sys/cdefs.h>
9#if defined(LIBC_SCCS) && !defined(lint) 9#if defined(LIBC_SCCS) && !defined(lint)
10__RCSID("$NetBSD: bswap64.c,v 1.1 2005/12/20 19:28:51 christos Exp $"); 10__RCSID("bswap64.c,v 1.1 2005/12/20 19:28:51 christos Exp");
11#endif /* LIBC_SCCS and not lint */ 11#endif /* LIBC_SCCS and not lint */
12 12
13#include <sys/types.h> 13#include <sys/types.h>
14#include <machine/bswap.h> 14#include <machine/bswap.h>
15 15
16#undef bswap64 16#undef bswap64
17 17
18u_int64_t 18uint64_t
19bswap64(x) 19bswap64(x)
20 u_int64_t x; 20 uint64_t x;
21{ 21{
22#ifdef _LP64 22#ifdef _LP64
23 /* 23 /*
24 * Assume we have wide enough registers to do it without touching 24 * Assume we have wide enough registers to do it without touching
25 * memory. 25 * memory.
26 */ 26 */
27 return ( (x << 56) & 0xff00000000000000UL ) | 27 return ( (x << 56) & 0xff00000000000000UL ) |
28 ( (x << 40) & 0x00ff000000000000UL ) | 28 ( (x << 40) & 0x00ff000000000000UL ) |
29 ( (x << 24) & 0x0000ff0000000000UL ) | 29 ( (x << 24) & 0x0000ff0000000000UL ) |
30 ( (x << 8) & 0x000000ff00000000UL ) | 30 ( (x << 8) & 0x000000ff00000000UL ) |
31 ( (x >> 8) & 0x00000000ff000000UL ) | 31 ( (x >> 8) & 0x00000000ff000000UL ) |
32 ( (x >> 24) & 0x0000000000ff0000UL ) | 32 ( (x >> 24) & 0x0000000000ff0000UL ) |
33 ( (x >> 40) & 0x000000000000ff00UL ) | 33 ( (x >> 40) & 0x000000000000ff00UL ) |
34 ( (x >> 56) & 0x00000000000000ffUL ); 34 ( (x >> 56) & 0x00000000000000ffUL );
35#else 35#else
36 /* 36 /*
37 * Split the operation in two 32bit steps. 37 * Split the operation in two 32bit steps.
38 */ 38 */
39 u_int32_t tl, th; 39 uint32_t tl, th;
40 40
41 th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL)); 41 th = bswap32((uint32_t)(x & 0x00000000ffffffffULL));
42 tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL)); 42 tl = bswap32((uint32_t)((x >> 32) & 0x00000000ffffffffULL));
43 return ((u_int64_t)th << 32) | tl; 43 return ((uint64_t)th << 32) | tl;
44#endif 44#endif
45} 45}

cvs diff -r1.3 -r1.3.4.1 src/common/lib/libc/hash/rmd160/rmd160.c (expand / switch to unified diff)

--- src/common/lib/libc/hash/rmd160/rmd160.c 2007/07/18 13:57:54 1.3
+++ src/common/lib/libc/hash/rmd160/rmd160.c 2008/03/23 00:12:44 1.3.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp $ */ 1/* rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp */
2/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ 2/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
3/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */ 3/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */
4/* 4/*
5 * Copyright (c) 2001 Markus Friedl. All rights reserved. 5 * Copyright (c) 2001 Markus Friedl. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -23,34 +23,34 @@ @@ -23,34 +23,34 @@
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27/* 27/*
28 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", 28 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160",
29 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, 29 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997,
30 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf 30 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34 34
35#if defined(_KERNEL) || defined(_STANDALONE) 35#if defined(_KERNEL) || defined(_STANDALONE)
36__KERNEL_RCSID(0, "$NetBSD: rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp $"); 36__KERNEL_RCSID(0, "rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp");
37 37
38#include <lib/libkern/libkern.h> 38#include <lib/libkern/libkern.h>
39 39
40#else 40#else
41 41
42#if defined(LIBC_SCCS) && !defined(lint) 42#if defined(LIBC_SCCS) && !defined(lint)
43__RCSID("$NetBSD: rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp $"); 43__RCSID("rmd160.c,v 1.3 2007/07/18 13:57:54 joerg Exp");
44#endif /* LIBC_SCCS and not lint */ 44#endif /* LIBC_SCCS and not lint */
45 45
46#include "namespace.h" 46#include "namespace.h"
47#include <assert.h> 47#include <assert.h>
48#include <string.h> 48#include <string.h>
49 49
50#endif 50#endif
51 51
52#include <sys/types.h> 52#include <sys/types.h>
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/rmd160.h> 54#include <sys/rmd160.h>
55 55
56 56
@@ -120,82 +120,82 @@ __weak_alias(RMD160Transform,_RMD160Tran @@ -120,82 +120,82 @@ __weak_alias(RMD160Transform,_RMD160Tran
120 120
121void 121void
122RMD160Init(RMD160_CTX *ctx) 122RMD160Init(RMD160_CTX *ctx)
123{ 123{
124 ctx->count = 0; 124 ctx->count = 0;
125 ctx->state[0] = H0; 125 ctx->state[0] = H0;
126 ctx->state[1] = H1; 126 ctx->state[1] = H1;
127 ctx->state[2] = H2; 127 ctx->state[2] = H2;
128 ctx->state[3] = H3; 128 ctx->state[3] = H3;
129 ctx->state[4] = H4; 129 ctx->state[4] = H4;
130} 130}
131 131
132void 132void
133RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) 133RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len)
134{ 134{
135 u_int32_t have, off, need; 135 uint32_t have, off, need;
136 136
137 have = (u_int32_t)((ctx->count/8) % 64); 137 have = (uint32_t)((ctx->count/8) % 64);
138 need = 64 - have; 138 need = 64 - have;
139 ctx->count += 8 * len; 139 ctx->count += 8 * len;
140 off = 0; 140 off = 0;
141 141
142 if (len >= need) { 142 if (len >= need) {
143 if (have) { 143 if (have) {
144 memcpy(ctx->buffer + have, input, (size_t)need); 144 memcpy(ctx->buffer + have, input, (size_t)need);
145 RMD160Transform(ctx->state, ctx->buffer); 145 RMD160Transform(ctx->state, ctx->buffer);
146 off = need; 146 off = need;
147 have = 0; 147 have = 0;
148 } 148 }
149 /* now the buffer is empty */ 149 /* now the buffer is empty */
150 while (off + 64 <= len) { 150 while (off + 64 <= len) {
151 RMD160Transform(ctx->state, input+off); 151 RMD160Transform(ctx->state, input+off);
152 off += 64; 152 off += 64;
153 } 153 }
154 } 154 }
155 if (off < len) 155 if (off < len)
156 memcpy(ctx->buffer + have, input+off, (size_t)len-off); 156 memcpy(ctx->buffer + have, input+off, (size_t)len-off);
157} 157}
158 158
159void 159void
160RMD160Final(u_char digest[20], RMD160_CTX *ctx) 160RMD160Final(u_char digest[20], RMD160_CTX *ctx)
161{ 161{
162 int i; 162 int i;
163 u_char size[8]; 163 u_char size[8];
164 u_int32_t padlen; 164 uint32_t padlen;
165 165
166 PUT_64BIT_LE(size, ctx->count); 166 PUT_64BIT_LE(size, ctx->count);
167 167
168 /* 168 /*
169 * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes 169 * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes
170 * for the size 170 * for the size
171 */ 171 */
172 padlen = (u_int32_t)(64 - ((ctx->count/8) % 64)); 172 padlen = (uint32_t)(64 - ((ctx->count/8) % 64));
173 if (padlen < 1 + 8) 173 if (padlen < 1 + 8)
174 padlen += 64; 174 padlen += 64;
175 RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ 175 RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
176 RMD160Update(ctx, size, 8); 176 RMD160Update(ctx, size, 8);
177 177
178 if (digest != NULL) 178 if (digest != NULL)
179 for (i = 0; i < 5; i++) 179 for (i = 0; i < 5; i++)
180 PUT_32BIT_LE(digest + i*4, ctx->state[i]); 180 PUT_32BIT_LE(digest + i*4, ctx->state[i]);
181 181
182 memset(ctx, 0, sizeof (*ctx)); 182 memset(ctx, 0, sizeof (*ctx));
183} 183}
184 184
185void 185void
186RMD160Transform(u_int32_t state[5], const u_char block[64]) 186RMD160Transform(uint32_t state[5], const u_char block[64])
187{ 187{
188 u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; 188 uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
189 189
190#if BYTE_ORDER == LITTLE_ENDIAN 190#if BYTE_ORDER == LITTLE_ENDIAN
191 memcpy(x, block, (size_t)64); 191 memcpy(x, block, (size_t)64);
192#else 192#else
193 int i; 193 int i;
194 194
195 for (i = 0; i < 16; i++) 195 for (i = 0; i < 16; i++)
196 x[i] = le32dec(block+i*4); 196 x[i] = le32dec(block+i*4);
197#endif 197#endif
198 198
199 a = state[0]; 199 a = state[0];
200 b = state[1]; 200 b = state[1];
201 c = state[2]; 201 c = state[2];

cvs diff -r1.2 -r1.2.16.1 src/common/lib/libc/hash/sha1/sha1.c (expand / switch to unified diff)

--- src/common/lib/libc/hash/sha1/sha1.c 2006/10/27 21:25:21 1.2
+++ src/common/lib/libc/hash/sha1/sha1.c 2008/03/23 00:12:44 1.2.16.1
@@ -1,43 +1,43 @@ @@ -1,43 +1,43 @@
1/* $NetBSD: sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp $ */ 1/* sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp */
2/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ 2/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
3 3
4/* 4/*
5 * SHA-1 in C 5 * SHA-1 in C
6 * By Steve Reid <steve@edmweb.com> 6 * By Steve Reid <steve@edmweb.com>
7 * 100% Public Domain 7 * 100% Public Domain
8 * 8 *
9 * Test Vectors (from FIPS PUB 180-1) 9 * Test Vectors (from FIPS PUB 180-1)
10 * "abc" 10 * "abc"
11 * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D 11 * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
12 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 12 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
13 * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 13 * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
14 * A million repetitions of "a" 14 * A million repetitions of "a"
15 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F 15 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
16 */ 16 */
17 17
18#define SHA1HANDSOFF /* Copies data before messing with it. */ 18#define SHA1HANDSOFF /* Copies data before messing with it. */
19 19
20#include <sys/cdefs.h> 20#include <sys/cdefs.h>
21 21
22#if defined(_KERNEL) || defined(_STANDALONE) 22#if defined(_KERNEL) || defined(_STANDALONE)
23__KERNEL_RCSID(0, "$NetBSD: sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp $"); 23__KERNEL_RCSID(0, "sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp");
24 24
25#include <lib/libkern/libkern.h> 25#include <lib/libkern/libkern.h>
26 26
27#else 27#else
28 28
29#if defined(LIBC_SCCS) && !defined(lint) 29#if defined(LIBC_SCCS) && !defined(lint)
30__RCSID("$NetBSD: sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp $"); 30__RCSID("sha1.c,v 1.2 2006/10/27 21:25:21 christos Exp");
31#endif /* LIBC_SCCS and not lint */ 31#endif /* LIBC_SCCS and not lint */
32 32
33#include "namespace.h" 33#include "namespace.h"
34#include <assert.h> 34#include <assert.h>
35#include <string.h> 35#include <string.h>
36 36
37#endif 37#endif
38 38
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/sha1.h> 40#include <sys/sha1.h>
41 41
42 42
43#if HAVE_NBTOOL_CONFIG_H 43#if HAVE_NBTOOL_CONFIG_H
@@ -80,86 +80,86 @@ __weak_alias(SHA1Final,_SHA1Final) @@ -80,86 +80,86 @@ __weak_alias(SHA1Final,_SHA1Final)
80 80
81typedef union { 81typedef union {
82 u_char c[64]; 82 u_char c[64];
83 u_int l[16]; 83 u_int l[16];
84} CHAR64LONG16; 84} CHAR64LONG16;
85 85
86/* old sparc64 gcc could not compile this */ 86/* old sparc64 gcc could not compile this */
87#undef SPARC64_GCC_WORKAROUND 87#undef SPARC64_GCC_WORKAROUND
88#if defined(__sparc64__) && defined(__GNUC__) && __GNUC__ < 3 88#if defined(__sparc64__) && defined(__GNUC__) && __GNUC__ < 3
89#define SPARC64_GCC_WORKAROUND 89#define SPARC64_GCC_WORKAROUND
90#endif 90#endif
91 91
92#ifdef SPARC64_GCC_WORKAROUND 92#ifdef SPARC64_GCC_WORKAROUND
93void do_R01(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *); 93void do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
94void do_R2(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *); 94void do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
95void do_R3(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *); 95void do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
96void do_R4(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *); 96void do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
97 97
98#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i) 98#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i)
99#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i) 99#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i)
100#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i) 100#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i)
101#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i) 101#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i)
102#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i) 102#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i)
103 103
104void 104void
105do_R01(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block) 105do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
106{ 106{
107 nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2); nR0(c,d,e,a,b, 3); 107 nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2); nR0(c,d,e,a,b, 3);
108 nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5); nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7); 108 nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5); nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7);
109 nR0(c,d,e,a,b, 8); nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11); 109 nR0(c,d,e,a,b, 8); nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11);
110 nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14); nR0(a,b,c,d,e,15); 110 nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14); nR0(a,b,c,d,e,15);
111 nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17); nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19); 111 nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17); nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19);
112} 112}
113 113
114void 114void
115do_R2(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block) 115do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
116{ 116{
117 nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22); nR2(c,d,e,a,b,23); 117 nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22); nR2(c,d,e,a,b,23);
118 nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25); nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27); 118 nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25); nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27);
119 nR2(c,d,e,a,b,28); nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31); 119 nR2(c,d,e,a,b,28); nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31);
120 nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34); nR2(a,b,c,d,e,35); 120 nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34); nR2(a,b,c,d,e,35);
121 nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37); nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39); 121 nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37); nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39);
122} 122}
123 123
124void 124void
125do_R3(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block) 125do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
126{ 126{
127 nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42); nR3(c,d,e,a,b,43); 127 nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42); nR3(c,d,e,a,b,43);
128 nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45); nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47); 128 nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45); nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47);
129 nR3(c,d,e,a,b,48); nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51); 129 nR3(c,d,e,a,b,48); nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51);
130 nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54); nR3(a,b,c,d,e,55); 130 nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54); nR3(a,b,c,d,e,55);
131 nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57); nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59); 131 nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57); nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59);
132} 132}
133 133
134void 134void
135do_R4(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block) 135do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
136{ 136{
137 nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63); 137 nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63);
138 nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67); 138 nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67);
139 nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71); 139 nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71);
140 nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75); 140 nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75);
141 nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79); 141 nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79);
142} 142}
143#endif 143#endif
144 144
145/* 145/*
146 * Hash a single 512-bit block. This is the core of the algorithm. 146 * Hash a single 512-bit block. This is the core of the algorithm.
147 */ 147 */
148void SHA1Transform(state, buffer) 148void SHA1Transform(state, buffer)
149 u_int32_t state[5]; 149 uint32_t state[5];
150 const u_char buffer[64]; 150 const u_char buffer[64];
151{ 151{
152 u_int32_t a, b, c, d, e; 152 uint32_t a, b, c, d, e;
153 CHAR64LONG16 *block; 153 CHAR64LONG16 *block;
154 154
155#ifdef SHA1HANDSOFF 155#ifdef SHA1HANDSOFF
156 CHAR64LONG16 workspace; 156 CHAR64LONG16 workspace;
157#endif 157#endif
158 158
159 _DIAGASSERT(buffer != 0); 159 _DIAGASSERT(buffer != 0);
160 _DIAGASSERT(state != 0); 160 _DIAGASSERT(state != 0);
161 161
162#ifdef SHA1HANDSOFF 162#ifdef SHA1HANDSOFF
163 block = &workspace; 163 block = &workspace;
164 (void)memcpy(block, buffer, 64); 164 (void)memcpy(block, buffer, 64);
165#else 165#else

cvs diff -r1.6 -r1.6.4.1 src/common/lib/libc/hash/sha2/sha2.c (expand / switch to unified diff)

--- src/common/lib/libc/hash/sha2/sha2.c 2007/07/18 16:58:14 1.6
+++ src/common/lib/libc/hash/sha2/sha2.c 2008/03/23 00:12:44 1.6.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp $ */ 1/* sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp */
2/* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */ 2/* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */
3 3
4/* 4/*
5 * sha2.c 5 * sha2.c
6 * 6 *
7 * Version 1.0.0beta1 7 * Version 1.0.0beta1
8 * 8 *
9 * Written by Aaron D. Gifford <me@aarongifford.com> 9 * Written by Aaron D. Gifford <me@aarongifford.com>
10 * 10 *
11 * Copyright 2000 Aaron D. Gifford. All rights reserved. 11 * Copyright 2000 Aaron D. Gifford. All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -29,34 +29,34 @@ @@ -29,34 +29,34 @@
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE. 35 * SUCH DAMAGE.
36 * 36 *
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40 40
41#if defined(_KERNEL) || defined(_STANDALONE) 41#if defined(_KERNEL) || defined(_STANDALONE)
42__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp $"); 42__KERNEL_RCSID(0, "sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp");
43 43
44#include <lib/libkern/libkern.h> 44#include <lib/libkern/libkern.h>
45 45
46#else 46#else
47 47
48#if defined(LIBC_SCCS) && !defined(lint) 48#if defined(LIBC_SCCS) && !defined(lint)
49__RCSID("$NetBSD: sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp $"); 49__RCSID("sha2.c,v 1.6 2007/07/18 16:58:14 drochner Exp");
50#endif /* LIBC_SCCS and not lint */ 50#endif /* LIBC_SCCS and not lint */
51 51
52#include "namespace.h" 52#include "namespace.h"
53#include <assert.h> 53#include <assert.h>
54#include <string.h> 54#include <string.h>
55 55
56#endif 56#endif
57 57
58#include <sys/types.h> 58#include <sys/types.h>
59#include <sys/param.h> 59#include <sys/param.h>
60#include <sys/sha2.h> 60#include <sys/sha2.h>
61 61
62/* 62/*
@@ -109,38 +109,38 @@ __RCSID("$NetBSD: sha2.c,v 1.6 2007/07/1 @@ -109,38 +109,38 @@ __RCSID("$NetBSD: sha2.c,v 1.6 2007/07/1
109 * 109 *
110 * The FreeBSD machine this was written on defines BYTE_ORDER 110 * The FreeBSD machine this was written on defines BYTE_ORDER
111 * appropriately by including <sys/types.h> (which in turn includes 111 * appropriately by including <sys/types.h> (which in turn includes
112 * <machine/endian.h> where the appropriate definitions are actually 112 * <machine/endian.h> where the appropriate definitions are actually
113 * made). 113 * made).
114 */ 114 */
115#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) 115#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
116#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN 116#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
117#endif 117#endif
118 118
119/* 119/*
120 * Define the followingsha2_* types to types of the correct length on 120 * Define the followingsha2_* types to types of the correct length on
121 * the native archtecture. Most BSD systems and Linux define u_intXX_t 121 * the native archtecture. Most BSD systems and Linux define u_intXX_t
122 * types. Machines with very recent ANSI C headers, can use the 122 * types. Machines with recent ANSI C headers, can use the standard C99
123 * uintXX_t definintions from inttypes.h by defining SHA2_USE_INTTYPES_H 123 * uintXX_t definintions from inttypes.h by defining SHA2_USE_INTTYPES_H
124 * during compile or in the sha.h header file. 124 * during compile or in the sha.h header file.
125 * 125 *
126 * Machines that support neither u_intXX_t nor inttypes.h's uintXX_t 126 * Machines that support neither u_intXX_t nor inttypes.h's uintXX_t
127 * will need to define these three typedefs below (and the appropriate 127 * will need to define these three typedefs below (and the appropriate
128 * ones in sha.h too) by hand according to their system architecture. 128 * ones in sha.h too) by hand according to their system architecture.
129 * 129 *
130 * Thank you, Jun-ichiro itojun Hagino, for suggesting using u_intXX_t 130 * Thank you, Jun-ichiro itojun Hagino, for suggesting using u_intXX_t
131 * types and pointing out recent ANSI C support for uintXX_t in inttypes.h. 131 * types and pointing out recent ANSI C support for uintXX_t in inttypes.h.
132 */ 132 */
133#if 0 /*def SHA2_USE_INTTYPES_H*/ 133#if 1 /*def SHA2_USE_INTTYPES_H*/
134 134
135typedef uint8_t sha2_byte; /* Exactly 1 byte */ 135typedef uint8_t sha2_byte; /* Exactly 1 byte */
136typedef uint32_t sha2_word32; /* Exactly 4 bytes */ 136typedef uint32_t sha2_word32; /* Exactly 4 bytes */
137typedef uint64_t sha2_word64; /* Exactly 8 bytes */ 137typedef uint64_t sha2_word64; /* Exactly 8 bytes */
138 138
139#else /* SHA2_USE_INTTYPES_H */ 139#else /* SHA2_USE_INTTYPES_H */
140 140
141typedef u_int8_t sha2_byte; /* Exactly 1 byte */ 141typedef u_int8_t sha2_byte; /* Exactly 1 byte */
142typedef u_int32_t sha2_word32; /* Exactly 4 bytes */ 142typedef u_int32_t sha2_word32; /* Exactly 4 bytes */
143typedef u_int64_t sha2_word64; /* Exactly 8 bytes */ 143typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
144 144
145#endif /* SHA2_USE_INTTYPES_H */ 145#endif /* SHA2_USE_INTTYPES_H */
146 146

cvs diff -r1.1 -r1.1.18.1 src/common/lib/libc/inet/inet_addr.c (expand / switch to unified diff)

--- src/common/lib/libc/inet/inet_addr.c 2005/12/20 19:28:51 1.1
+++ src/common/lib/libc/inet/inet_addr.c 2008/03/23 00:12:44 1.1.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: inet_addr.c,v 1.1 2005/12/20 19:28:51 christos Exp $ */ 1/* inet_addr.c,v 1.1 2005/12/20 19:28:51 christos Exp */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1990, 1993 4 * Copyright (c) 1983, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 *  6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -67,27 +67,27 @@ @@ -67,27 +67,27 @@
67 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 67 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
68 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 68 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
69 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 69 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
70 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 70 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
71 */ 71 */
72 72
73#if !defined(_KERNEL) && !defined(_STANDALONE) 73#if !defined(_KERNEL) && !defined(_STANDALONE)
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75#if defined(LIBC_SCCS) && !defined(lint) 75#if defined(LIBC_SCCS) && !defined(lint)
76#if 0 76#if 0
77static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; 77static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
78static const char rcsid[] = "Id: inet_addr.c,v 1.2.206.2 2004/03/17 00:29:45 marka Exp"; 78static const char rcsid[] = "Id: inet_addr.c,v 1.2.206.2 2004/03/17 00:29:45 marka Exp";
79#else 79#else
80__RCSID("$NetBSD: inet_addr.c,v 1.1 2005/12/20 19:28:51 christos Exp $"); 80__RCSID("inet_addr.c,v 1.1 2005/12/20 19:28:51 christos Exp");
81#endif 81#endif
82#endif /* LIBC_SCCS and not lint */ 82#endif /* LIBC_SCCS and not lint */
83 83
84#include "port_before.h" 84#include "port_before.h"
85 85
86#include "namespace.h" 86#include "namespace.h"
87#include <sys/types.h> 87#include <sys/types.h>
88#include <sys/param.h> 88#include <sys/param.h>
89 89
90#include <netinet/in.h> 90#include <netinet/in.h>
91#include <arpa/inet.h> 91#include <arpa/inet.h>
92 92
93#include <ctype.h> 93#include <ctype.h>
@@ -96,49 +96,49 @@ __RCSID("$NetBSD: inet_addr.c,v 1.1 2005 @@ -96,49 +96,49 @@ __RCSID("$NetBSD: inet_addr.c,v 1.1 2005
96 96
97#ifdef __weak_alias 97#ifdef __weak_alias
98__weak_alias(inet_aton,_inet_aton) 98__weak_alias(inet_aton,_inet_aton)
99#endif 99#endif
100#else 100#else
101#include <lib/libkern/libkern.h> 101#include <lib/libkern/libkern.h>
102#include <netinet/in.h> 102#include <netinet/in.h>
103#endif 103#endif
104 104
105/* 105/*
106 * Ascii internet address interpretation routine. 106 * Ascii internet address interpretation routine.
107 * The value returned is in network order. 107 * The value returned is in network order.
108 */ 108 */
109u_int32_t 109uint32_t
110inet_addr(const char *cp) { 110inet_addr(const char *cp) {
111 struct in_addr val; 111 struct in_addr val;
112 112
113 if (inet_aton(cp, &val)) 113 if (inet_aton(cp, &val))
114 return (val.s_addr); 114 return (val.s_addr);
115 return (INADDR_NONE); 115 return (INADDR_NONE);
116} 116}
117 117
118/*  118/*
119 * Check whether "cp" is a valid ascii representation 119 * Check whether "cp" is a valid ascii representation
120 * of an Internet address and convert to a binary address. 120 * of an Internet address and convert to a binary address.
121 * Returns 1 if the address is valid, 0 if not. 121 * Returns 1 if the address is valid, 0 if not.
122 * This replaces inet_addr, the return value from which 122 * This replaces inet_addr, the return value from which
123 * cannot distinguish between failure and a local broadcast address. 123 * cannot distinguish between failure and a local broadcast address.
124 */ 124 */
125int 125int
126inet_aton(const char *cp, struct in_addr *addr) { 126inet_aton(const char *cp, struct in_addr *addr) {
127 u_int32_t val; 127 uint32_t val;
128 int base, n; 128 int base, n;
129 char c; 129 char c;
130 u_int8_t parts[4]; 130 uint8_t parts[4];
131 u_int8_t *pp = parts; 131 uint8_t *pp = parts;
132 int digit; 132 int digit;
133 133
134 c = *cp; 134 c = *cp;
135 for (;;) { 135 for (;;) {
136 /* 136 /*
137 * Collect number up to ``.''. 137 * Collect number up to ``.''.
138 * Values are specified as for C: 138 * Values are specified as for C:
139 * 0x=hex, 0=octal, isdigit=decimal. 139 * 0x=hex, 0=octal, isdigit=decimal.
140 */ 140 */
141 if (!isdigit((unsigned char)c)) 141 if (!isdigit((unsigned char)c))
142 return (0); 142 return (0);
143 val = 0; base = 10; digit = 0; 143 val = 0; base = 10; digit = 0;
144 if (c == '0') { 144 if (c == '0') {

cvs diff -r1.2 -r1.2.18.1 src/common/lib/libc/md/md4c.c (expand / switch to unified diff)

--- src/common/lib/libc/md/md4c.c 2005/12/24 08:34:10 1.2
+++ src/common/lib/libc/md/md4c.c 2008/03/23 00:12:45 1.2.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md4c.c,v 1.2 2005/12/24 08:34:10 matt Exp $ */ 1/* md4c.c,v 1.2 2005/12/24 08:34:10 matt Exp */
2 2
3/* 3/*
4 * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest 4 * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org> 5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
6 * for portability and formatting. 6 * for portability and formatting.
7 */ 7 */
8 8
9/* 9/*
10 * Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. 10 * Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved.
11 * 11 *
12 * License to copy and use this software is granted provided that it 12 * License to copy and use this software is granted provided that it
13 * is identified as the "RSA Data Security, Inc. MD4 Message-Digest 13 * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
14 * Algorithm" in all material mentioning or referencing this software 14 * Algorithm" in all material mentioning or referencing this software
@@ -21,54 +21,54 @@ @@ -21,54 +21,54 @@
21 * 21 *
22 * RSA Data Security, Inc. makes no representations concerning either 22 * RSA Data Security, Inc. makes no representations concerning either
23 * the merchantability of this software or the suitability of this 23 * the merchantability of this software or the suitability of this
24 * software for any particular purpose. It is provided "as is" 24 * software for any particular purpose. It is provided "as is"
25 * without express or implied warranty of any kind. 25 * without express or implied warranty of any kind.
26 * 26 *
27 * These notices must be retained in any copies of any part of this 27 * These notices must be retained in any copies of any part of this
28 * documentation and/or software. 28 * documentation and/or software.
29 */ 29 */
30 30
31#if !defined(_KERNEL) && !defined(_STANDALONE) 31#if !defined(_KERNEL) && !defined(_STANDALONE)
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34__RCSID("$NetBSD: md4c.c,v 1.2 2005/12/24 08:34:10 matt Exp $"); 34__RCSID("md4c.c,v 1.2 2005/12/24 08:34:10 matt Exp");
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include "namespace.h" 37#include "namespace.h"
38 38
39#include <sys/types.h> 39#include <sys/types.h>
40 40
41#include <assert.h> 41#include <assert.h>
42#include <md4.h> 42#include <md4.h>
43#include <string.h> 43#include <string.h>
44 44
45#if HAVE_NBTOOL_CONFIG_H 45#if HAVE_NBTOOL_CONFIG_H
46#include "nbtool_config.h" 46#include "nbtool_config.h"
47#endif 47#endif
48 48
49#else 49#else
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/md4.h> 52#include <sys/md4.h>
53#include <lib/libkern/libkern.h> 53#include <lib/libkern/libkern.h>
54 54
55#endif /* !_KERNEL && !_STANDALONE */ 55#endif /* !_KERNEL && !_STANDALONE */
56 56
57#if !HAVE_MD4_H 57#if !HAVE_MD4_H
58 58
59typedef unsigned char *POINTER; 59typedef unsigned char *POINTER;
60typedef u_int16_t UINT2; 60typedef uint16_t UINT2;
61typedef u_int32_t UINT4; 61typedef uint32_t UINT4;
62 62
63/* 63/*
64 * Constants for MD4Transform routine. 64 * Constants for MD4Transform routine.
65 */ 65 */
66#define S11 3 66#define S11 3
67#define S12 7 67#define S12 7
68#define S13 11 68#define S13 11
69#define S14 19 69#define S14 19
70#define S21 3 70#define S21 3
71#define S22 5 71#define S22 5
72#define S23 9 72#define S23 9
73#define S24 13 73#define S24 13
74#define S31 3 74#define S31 3

cvs diff -r1.2 -r1.2.18.1 src/common/lib/libc/md/md5c.c (expand / switch to unified diff)

--- src/common/lib/libc/md/md5c.c 2005/12/24 08:34:10 1.2
+++ src/common/lib/libc/md/md5c.c 2008/03/23 00:12:45 1.2.18.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md5c.c,v 1.2 2005/12/24 08:34:10 matt Exp $ */ 1/* md5c.c,v 1.2 2005/12/24 08:34:10 matt Exp */
2 2
3/* 3/*
4 * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest 4 * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org> 5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
6 * for portability and formatting. 6 * for portability and formatting.
7 */ 7 */
8 8
9/* 9/*
10 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 10 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
11 * rights reserved. 11 * rights reserved.
12 * 12 *
13 * License to copy and use this software is granted provided that it 13 * License to copy and use this software is granted provided that it
14 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest 14 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
@@ -26,46 +26,46 @@ @@ -26,46 +26,46 @@
26 * without express or implied warranty of any kind. 26 * without express or implied warranty of any kind.
27 * 27 *
28 * These notices must be retained in any copies of any part of this 28 * These notices must be retained in any copies of any part of this
29 * documentation and/or software. 29 * documentation and/or software.
30 */ 30 */
31 31
32#if defined(_KERNEL) || defined(_STANDALONE) 32#if defined(_KERNEL) || defined(_STANDALONE)
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/md5.h> 34#include <sys/md5.h>
35#include <lib/libkern/libkern.h> 35#include <lib/libkern/libkern.h>
36#else 36#else
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38#if defined(LIBC_SCCS) && !defined(lint) 38#if defined(LIBC_SCCS) && !defined(lint)
39__RCSID("$NetBSD: md5c.c,v 1.2 2005/12/24 08:34:10 matt Exp $"); 39__RCSID("md5c.c,v 1.2 2005/12/24 08:34:10 matt Exp");
40#endif /* LIBC_SCCS and not lint */ 40#endif /* LIBC_SCCS and not lint */
41#include "namespace.h" 41#include "namespace.h"
42#include <sys/types.h> 42#include <sys/types.h>
43#include <assert.h> 43#include <assert.h>
44#include <string.h> 44#include <string.h>
45#include <md5.h> 45#include <md5.h>
46#endif /* _KERNEL || _STANDALONE */ 46#endif /* _KERNEL || _STANDALONE */
47 47
48#if HAVE_NBTOOL_CONFIG_H 48#if HAVE_NBTOOL_CONFIG_H
49#include "nbtool_config.h" 49#include "nbtool_config.h"
50#endif 50#endif
51 51
52#if !HAVE_MD5_H 52#if !HAVE_MD5_H
53 53
54#define ZEROIZE(d, l) memset((d), 0, (l)) 54#define ZEROIZE(d, l) memset((d), 0, (l))
55 55
56typedef unsigned char *POINTER; 56typedef unsigned char *POINTER;
57typedef u_int16_t UINT2; 57typedef uint16_t UINT2;
58typedef u_int32_t UINT4; 58typedef uint32_t UINT4;
59 59
60/* 60/*
61 * Constants for MD5Transform routine. 61 * Constants for MD5Transform routine.
62 */ 62 */
63#define S11 7 63#define S11 7
64#define S12 12 64#define S12 12
65#define S13 17 65#define S13 17
66#define S14 22 66#define S14 22
67#define S21 5 67#define S21 5
68#define S22 9 68#define S22 9
69#define S23 14 69#define S23 14
70#define S24 20 70#define S24 20
71#define S31 4 71#define S31 4

cvs diff -r1.2 -r1.2.4.1 src/common/lib/libc/string/memchr.c (expand / switch to unified diff)

--- src/common/lib/libc/string/memchr.c 2007/06/04 18:19:27 1.2
+++ src/common/lib/libc/string/memchr.c 2008/03/23 00:12:45 1.2.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: memchr.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ 1/* memchr.c,v 1.2 2007/06/04 18:19:27 christos Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek. 8 * Chris Torek.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,39 +27,40 @@ @@ -27,39 +27,40 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#if defined(LIBC_SCCS) && !defined(lint) 36#if defined(LIBC_SCCS) && !defined(lint)
37#if 0 37#if 0
38static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93"; 38static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93";
39#else 39#else
40__RCSID("$NetBSD: memchr.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); 40__RCSID("memchr.c,v 1.2 2007/06/04 18:19:27 christos Exp");
41#endif 41#endif
42#endif /* LIBC_SCCS and not lint */ 42#endif /* LIBC_SCCS and not lint */
43 43
44#if !defined(_KERNEL) && !defined(_STANDALONE) 44#if !defined(_KERNEL) && !defined(_STANDALONE)
45#include <assert.h> 45#include <assert.h>
46#include <string.h> 46#include <string.h>
47#else 47#else
48#include <lib/libkern/libkern.h> 48#include <lib/libkern/libkern.h>
49#endif 49#endif
50 50
51void * 51void *
52memchr(const void *s, int c, size_t n) 52memchr(const void *s, int c, size_t n)
53{ 53{
54 _DIAGASSERT(s != NULL); 54 _DIAGASSERT(s != NULL);
55 55
56 if (n != 0) { 56 if (n != 0) {
57 const unsigned char *p = s; 57 const unsigned char *p = s;
 58 const unsigned char cmp = c;
58 59
59 do { 60 do {
60 if (*p++ == c) 61 if (*p++ == cmp)
61 return __UNCONST(p - 1); 62 return __UNCONST(p - 1);
62 } while (--n != 0); 63 } while (--n != 0);
63 } 64 }
64 return NULL; 65 return NULL;
65} 66}

cvs diff -r1.2 -r1.2.4.1 src/common/lib/libc/string/strchr.c (expand / switch to unified diff)

--- src/common/lib/libc/string/strchr.c 2007/06/04 18:19:27 1.2
+++ src/common/lib/libc/string/strchr.c 2008/03/23 00:12:45 1.2.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: strchr.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ 1/* strchr.c,v 1.2 2007/06/04 18:19:27 christos Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,44 +24,45 @@ @@ -24,44 +24,45 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34#if 0 34#if 0
35static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93"; 35static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93";
36#else 36#else
37__RCSID("$NetBSD: strchr.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); 37__RCSID("strchr.c,v 1.2 2007/06/04 18:19:27 christos Exp");
38#endif 38#endif
39#endif /* LIBC_SCCS and not lint */ 39#endif /* LIBC_SCCS and not lint */
40 40
41#if !defined(_KERNEL) && !defined(_STANDALONE) 41#if !defined(_KERNEL) && !defined(_STANDALONE)
42#include "namespace.h" 42#include "namespace.h"
43#include <assert.h> 43#include <assert.h>
44#include <string.h> 44#include <string.h>
45#else 45#else
46#include <lib/libkern/libkern.h> 46#include <lib/libkern/libkern.h>
47#endif 47#endif
48 48
49char * 49char *
50#ifdef INDEX 50#ifdef INDEX
51index(const char *p, int ch) 51index(const char *p, int ch)
52#else 52#else
53strchr(const char *p, int ch) 53strchr(const char *p, int ch)
54#endif 54#endif
55{ 55{
 56 const char cmp = ch;
56 _DIAGASSERT(p != NULL); 57 _DIAGASSERT(p != NULL);
57 58
58 for (;; ++p) { 59 for (;; ++p) {
59 if (*p == ch) { 60 if (*p == cmp) {
60 /* LINTED const cast-away */ 61 /* LINTED const cast-away */
61 return(__UNCONST(p)); 62 return(__UNCONST(p));
62 } 63 }
63 if (!*p) 64 if (!*p)
64 return((char *)NULL); 65 return((char *)NULL);
65 } 66 }
66 /* NOTREACHED */ 67 /* NOTREACHED */
67} 68}

cvs diff -r1.3 -r1.3.4.1 src/common/lib/libc/string/strrchr.c (expand / switch to unified diff)

--- src/common/lib/libc/string/strrchr.c 2007/06/04 18:19:28 1.3
+++ src/common/lib/libc/string/strrchr.c 2008/03/23 00:12:45 1.3.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: strrchr.c,v 1.3 2007/06/04 18:19:28 christos Exp $ */ 1/* strrchr.c,v 1.3 2007/06/04 18:19:28 christos Exp */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1993 4 * Copyright (c) 1988, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,46 +24,46 @@ @@ -24,46 +24,46 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34#if 0 34#if 0
35static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93"; 35static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
36#else 36#else
37__RCSID("$NetBSD: strrchr.c,v 1.3 2007/06/04 18:19:28 christos Exp $"); 37__RCSID("strrchr.c,v 1.3 2007/06/04 18:19:28 christos Exp");
38#endif 38#endif
39#endif /* LIBC_SCCS and not lint */ 39#endif /* LIBC_SCCS and not lint */
40 40
41#if !defined(_KERNEL) && !defined(_STANDALONE) 41#if !defined(_KERNEL) && !defined(_STANDALONE)
42#include <assert.h> 42#include <assert.h>
43#include <string.h> 43#include <string.h>
44#else 44#else
45#include <lib/libkern/libkern.h> 45#include <lib/libkern/libkern.h>
46#endif 46#endif
47 47
48char * 48char *
49#ifdef RINDEX 49#ifdef RINDEX
50rindex(const char *p, int ch) 50rindex(const char *p, int ch)
51#else 51#else
52strrchr(const char *p, int ch) 52strrchr(const char *p, int ch)
53#endif 53#endif
54{ 54{
55 char *save, c; 55 char *save;
 56 const char c = ch;
56 57
57 _DIAGASSERT(p != NULL); 58 _DIAGASSERT(p != NULL);
58 c = ch; 
59 59
60 for (save = NULL;; ++p) { 60 for (save = NULL;; ++p) {
61 if (*p == c) { 61 if (*p == c) {
62 /* LINTED const cast-away */ 62 /* LINTED const cast-away */
63 save = __UNCONST(p); 63 save = __UNCONST(p);
64 } 64 }
65 if (!*p) 65 if (!*p)
66 return(save); 66 return(save);
67 } 67 }
68 /* NOTREACHED */ 68 /* NOTREACHED */
69} 69}

cvs diff -r1.5.2.1 -r1.5.2.2 src/common/lib/libprop/prop_array.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_array.3 2008/01/09 01:21:35 1.5.2.1
+++ src/common/lib/libprop/prop_array.3 2008/03/23 00:12:45 1.5.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_array.3,v 1.5.2.1 2008/01/09 01:21:35 matt Exp $ 1.\" prop_array.3,v 1.5.2.1 2008/01/09 01:21:35 matt Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -110,76 +110,93 @@ @@ -110,76 +110,93 @@
110.\" 110.\"
111.Ft bool 111.Ft bool
112.Fn prop_array_equals "prop_array_t array1" "prop_array_t array2" 112.Fn prop_array_equals "prop_array_t array1" "prop_array_t array2"
113.Sh DESCRIPTION 113.Sh DESCRIPTION
114The 114The
115.Nm prop_array 115.Nm prop_array
116family of functions operate on the array property collection object type. 116family of functions operate on the array property collection object type.
117An array is an ordered set; an iterated array will return objects in the 117An array is an ordered set; an iterated array will return objects in the
118same order with which they were stored. 118same order with which they were stored.
119.Bl -tag -width "xxxxx" 119.Bl -tag -width "xxxxx"
120.It Fn prop_array_create "void" 120.It Fn prop_array_create "void"
121Create an empty array. 121Create an empty array.
122The array initially has no capacity. 122The array initially has no capacity.
 123Returns
 124.Dv NULL
 125on failure.
123.It Fn prop_array_create_with_capacity "unsigned int capacity" 126.It Fn prop_array_create_with_capacity "unsigned int capacity"
124Create an array with the capacity to store 127Create an array with the capacity to store
125.Fa capacity 128.Fa capacity
126objects. 129objects.
 130Returns
 131.Dv NULL
 132on failure.
127.It Fn prop_array_copy "prop_array_t array" 133.It Fn prop_array_copy "prop_array_t array"
128Copy an array. 134Copy an array.
129The new array has an initial capacity equal to the number of objects stored 135The new array has an initial capacity equal to the number of objects stored
130in the array being copied. 136in the array being copied.
131The new array contains references to the original array's objects, not 137The new array contains references to the original array's objects, not
132copies of those objects 138copies of those objects
133.Pq i.e. a shallow copy is made . 139.Pq i.e. a shallow copy is made .
134If the original array is immutable, the resulting array is also immutable. 140If the original array is immutable, the resulting array is also immutable.
 141Returns
 142.Dv NULL
 143on failure.
135.It Fn prop_array_copy_mutable "prop_array_t array" 144.It Fn prop_array_copy_mutable "prop_array_t array"
136Like 145Like
137.Fn prop_array_copy , 146.Fn prop_array_copy ,
138except the resulting array is always mutable. 147except the resulting array is always mutable.
139.It Fn prop_array_capacity "prop_array_t array" 148.It Fn prop_array_capacity "prop_array_t array"
140Returns the total capacity of the array, including objects already stored 149Returns the total capacity of the array, including objects already stored
141in the array. 150in the array.
 151If the supplied object isn't an array, zero is returned.
142.It Fn prop_array_count "prop_array_t array" 152.It Fn prop_array_count "prop_array_t array"
143Returns the number of objects stored in the array. 153Returns the number of objects stored in the array.
 154If the supplied object isn't an array, zero is returned.
144.It Fn prop_array_ensure_capacity "prop_array_t array" "unsigned int capacity" 155.It Fn prop_array_ensure_capacity "prop_array_t array" "unsigned int capacity"
145Ensure that the array has a total capacity of 156Ensure that the array has a total capacity of
146.Fa capacity , 157.Fa capacity ,
147including objects already stored in the array. 158including objects already stored in the array.
148Returns 159Returns
149.Dv true 160.Dv true
150if the capacity of the array is greater or equal to 161if the capacity of the array is greater or equal to
151.Fa capacity 162.Fa capacity
152or if expansion of the array's capacity was successful 163or if expansion of the array's capacity was successful
153and 164and
154.Dv false 165.Dv false
155otherwise. 166otherwise.
156.It Fn prop_array_iterator "prop_array_t array" 167.It Fn prop_array_iterator "prop_array_t array"
157Create an iterator for the array. 168Create an iterator for the array.
158The array is retained by the iterator. 169The array is retained by the iterator.
159An array iterator returns the object references stored in the array. 170An array iterator returns the object references stored in the array.
160Storing to or removing from the array invalidates any active iterators for 171Storing to or removing from the array invalidates any active iterators for
161the array. 172the array.
 173Returns
 174.Dv NULL
 175on failure.
162.It Fn prop_array_make_immutable "prop_array_t array" 176.It Fn prop_array_make_immutable "prop_array_t array"
163Make 177Make
164.Fa array 178.Fa array
165immutable. 179immutable.
166.It Fn prop_array_mutable "prop_array_t array" 180.It Fn prop_array_mutable "prop_array_t array"
167Returns 181Returns
168.Dv true 182.Dv true
169if the array is mutable. 183if the array is mutable.
170.It Fn prop_array_get "prop_array_t array" "unsigned int index" 184.It Fn prop_array_get "prop_array_t array" "unsigned int index"
171Return the object stored at the array index 185Return the object stored at the array index
172.Fa index . 186.Fa index .
 187Returns
 188.Dv NULL
 189on failure.
173.It Fn prop_array_set "prop_array_t array" "unsigned int index" \ 190.It Fn prop_array_set "prop_array_t array" "unsigned int index" \
174 "prop_object_t obj" 191 "prop_object_t obj"
175Store a reference to the object 192Store a reference to the object
176.Fa obj 193.Fa obj
177at the array index 194at the array index
178.Fa index . 195.Fa index .
179This function is not allowed to create holes in the array; 196This function is not allowed to create holes in the array;
180the caller must either be setting the object just beyond the existing 197the caller must either be setting the object just beyond the existing
181count or replacing an already existing object reference. 198count or replacing an already existing object reference.
182The object will be retained by the array. 199The object will be retained by the array.
183If an existing object reference is being replaced, that object will be 200If an existing object reference is being replaced, that object will be
184released. 201released.
185Returns 202Returns
@@ -188,35 +205,46 @@ if storing the object was successful and @@ -188,35 +205,46 @@ if storing the object was successful and
188.Dv false 205.Dv false
189otherwise. 206otherwise.
190.It Fn prop_array_add "prop_array_t array" "prop_object_t obj" 207.It Fn prop_array_add "prop_array_t array" "prop_object_t obj"
191Add a reference to the object 208Add a reference to the object
192.Fa obj 209.Fa obj
193to the array, appending to the end and growing the array's capacity if 210to the array, appending to the end and growing the array's capacity if
194necessary. 211necessary.
195The object will be retained by the array. 212The object will be retained by the array.
196Returns 213Returns
197.Dv true 214.Dv true
198if storing the object was successful and 215if storing the object was successful and
199.Dv false 216.Dv false
200otherwise. 217otherwise.
 218.Pp
 219During expansion, array's capacity is augmented by the
 220.Dv EXPAND_STEP
 221constant, as defined in
 222.Pa libprop/prop_array.c
 223file, e.g.
 224.Pp
 225#define EXPAND_STEP 16
201.It Fn prop_array_remove "prop_array_t array" "unsigned int index" 226.It Fn prop_array_remove "prop_array_t array" "unsigned int index"
202Remove the reference to the object stored at array index 227Remove the reference to the object stored at array index
203.Fa index . 228.Fa index .
204The object will be released and the array compacted following 229The object will be released and the array compacted following
205the removal. 230the removal.
206.It Fn prop_array_equals "prop_array_t array1" "prop_array_t array2" 231.It Fn prop_array_equals "prop_array_t array1" "prop_array_t array2"
207Returns 232Returns
208.Dv true 233.Dv true
209if the two arrays are equivalent. 234if the two arrays are equivalent.
 235If at least one of the supplied objects isn't an array,
 236.Dv false
 237is returned.
210Note: Objects contained in the array are compared by value, not by reference. 238Note: Objects contained in the array are compared by value, not by reference.
211.It Fn prop_array_externalize "prop_array_t array" 239.It Fn prop_array_externalize "prop_array_t array"
212Externalizes an array, returning a NUL-terminated buffer containing 240Externalizes an array, returning a NUL-terminated buffer containing
213the XML representation of the array. 241the XML representation of the array.
214The caller is responsible for freeing the returned buffer. 242The caller is responsible for freeing the returned buffer.
215If converting to the external representation fails for any reason, 243If converting to the external representation fails for any reason,
216.Dv NULL 244.Dv NULL
217is returned. 245is returned.
218.Pp 246.Pp
219In user space, the buffer is allocated using 247In user space, the buffer is allocated using
220.Xr malloc 3 . 248.Xr malloc 3 .
221In the kernel, the buffer is allocated using 249In the kernel, the buffer is allocated using
222.Xr malloc 9 250.Xr malloc 9
@@ -235,26 +263,29 @@ Externalizes an array and writes it to t @@ -235,26 +263,29 @@ Externalizes an array and writes it to t
235.Fa path . 263.Fa path .
236The file is saved with the mode 264The file is saved with the mode
237.Dv 0666 265.Dv 0666
238as modified by the process's file creation mask 266as modified by the process's file creation mask
239.Pq see Xr umask 3 267.Pq see Xr umask 3
240and is written atomically. 268and is written atomically.
241Returns 269Returns
242.Dv false 270.Dv false
243if externalizing or writing the array fails for any reason. 271if externalizing or writing the array fails for any reason.
244.It Fn prop_array_internalize_from_file "const char *path" 272.It Fn prop_array_internalize_from_file "const char *path"
245Reads the XML property list contained in the file specified by 273Reads the XML property list contained in the file specified by
246.Fa path , 274.Fa path ,
247internalizes it, and returns the corresponding array. 275internalizes it, and returns the corresponding array.
 276Returns
 277.Dv NULL
 278on failure.
248.El 279.El
249.Sh SEE ALSO 280.Sh SEE ALSO
250.Xr prop_bool 3 , 281.Xr prop_bool 3 ,
251.Xr prop_data 3 , 282.Xr prop_data 3 ,
252.Xr prop_dictionary 3 , 283.Xr prop_dictionary 3 ,
253.Xr prop_number 3 , 284.Xr prop_number 3 ,
254.Xr prop_object 3 , 285.Xr prop_object 3 ,
255.Xr prop_string 3 , 286.Xr prop_string 3 ,
256.Xr proplib 3 287.Xr proplib 3
257.Sh HISTORY 288.Sh HISTORY
258The 289The
259.Nm proplib 290.Nm proplib
260property container object library first appeared in 291property container object library first appeared in

cvs diff -r1.3 -r1.3.2.1 src/common/lib/libprop/prop_bool.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_bool.3 2007/08/16 16:30:59 1.3
+++ src/common/lib/libprop/prop_bool.3 2008/03/23 00:12:45 1.3.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_bool.3,v 1.3 2007/08/16 16:30:59 thorpej Exp $ 1.\" prop_bool.3,v 1.3 2007/08/16 16:30:59 thorpej Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -55,28 +55,34 @@ @@ -55,28 +55,34 @@
55.\" 55.\"
56.Ft bool 56.Ft bool
57.Fn prop_bool_true "prop_bool_t bool" 57.Fn prop_bool_true "prop_bool_t bool"
58.Sh DESCRIPTION 58.Sh DESCRIPTION
59The 59The
60.Nm prop_bool 60.Nm prop_bool
61family of functions operate on a boolean value property object type. 61family of functions operate on a boolean value property object type.
62.Bl -tag -width "xxxxx" 62.Bl -tag -width "xxxxx"
63.It Fn prop_bool_create "bool val" 63.It Fn prop_bool_create "bool val"
64Create a boolean value object with the value 64Create a boolean value object with the value
65.Fa val . 65.Fa val .
66.It Fn prop_bool_copy "prop_bool_t bool" 66.It Fn prop_bool_copy "prop_bool_t bool"
67Copy a boolean value object. 67Copy a boolean value object.
 68If the supplied object isn't a boolean,
 69.Dv NULL
 70is returned.
68.It Fn prop_bool_true "prop_bool_t bool" 71.It Fn prop_bool_true "prop_bool_t bool"
69Returns the value of the boolean value object. 72Returns the value of the boolean value object.
 73If the supplied object isn't a boolean,
 74.Dv false
 75is returned.
70.El 76.El
71.Sh SEE ALSO 77.Sh SEE ALSO
72.Xr prop_array 3 , 78.Xr prop_array 3 ,
73.Xr prop_data 3 , 79.Xr prop_data 3 ,
74.Xr prop_dictionary 3 , 80.Xr prop_dictionary 3 ,
75.Xr prop_number 3 , 81.Xr prop_number 3 ,
76.Xr prop_object 3 , 82.Xr prop_object 3 ,
77.Xr prop_string 3 , 83.Xr prop_string 3 ,
78.Xr proplib 3 84.Xr proplib 3
79.Sh HISTORY 85.Sh HISTORY
80The 86The
81.Nm proplib 87.Nm proplib
82property container object library first appeared in 88property container object library first appeared in

cvs diff -r1.3 -r1.3.2.1 src/common/lib/libprop/prop_ingest.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_ingest.3 2007/08/16 16:31:00 1.3
+++ src/common/lib/libprop/prop_ingest.3 2008/03/23 00:12:45 1.3.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_ingest.3,v 1.3 2007/08/16 16:31:00 thorpej Exp $ 1.\" prop_ingest.3,v 1.3 2007/08/16 16:31:00 thorpej Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd August 19, 2006 37.Dd January 21, 2008
38.Dt PROP_INGEST 3 38.Dt PROP_INGEST 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm prop_ingest_context_alloc , 41.Nm prop_ingest_context_alloc ,
42.Nm prop_ingest_context_free , 42.Nm prop_ingest_context_free ,
43.Nm prop_ingest_context_error , 43.Nm prop_ingest_context_error ,
44.Nm prop_ingest_context_type , 44.Nm prop_ingest_context_type ,
45.Nm prop_ingest_context_key , 45.Nm prop_ingest_context_key ,
46.Nm prop_ingest_context_private , 46.Nm prop_ingest_context_private ,
47.Nm prop_dictionary_ingest 47.Nm prop_dictionary_ingest
48.Nd Ingest a dictionary into an arbitrary binary format 48.Nd Ingest a dictionary into an arbitrary binary format
49.Sh SYNOPSIS 49.Sh SYNOPSIS
50.In prop/proplib.h 50.In prop/proplib.h
@@ -135,26 +135,29 @@ if the value of the object is invalid to @@ -135,26 +135,29 @@ if the value of the object is invalid to
135otherwise. 135otherwise.
136.Pp 136.Pp
137The ingest context contains several pieces of information that are 137The ingest context contains several pieces of information that are
138useful during the ingest process. 138useful during the ingest process.
139The context also provides specific error information should the ingest 139The context also provides specific error information should the ingest
140fail. 140fail.
141.Bl -tag -width "xxxxx" 141.Bl -tag -width "xxxxx"
142.It Fn prop_ingest_context_alloc "void *private" 142.It Fn prop_ingest_context_alloc "void *private"
143Allocate an ingest context. 143Allocate an ingest context.
144The argument 144The argument
145.Fa private 145.Fa private
146may be used to pass application-specific context to the ingest handlers. 146may be used to pass application-specific context to the ingest handlers.
147Note that an ingest context can be re-used to perform multiple ingests. 147Note that an ingest context can be re-used to perform multiple ingests.
 148Returns
 149.Dv NULL
 150on failure.
148.It Fn prop_ingest_context_free "prop_ingest_context_t ctx" 151.It Fn prop_ingest_context_free "prop_ingest_context_t ctx"
149Free an ingest context. 152Free an ingest context.
150.It Fn prop_ingest_context_error "prop_ingest_context_t ctx" 153.It Fn prop_ingest_context_error "prop_ingest_context_t ctx"
151Returns the code indicating the error encountered during ingest. 154Returns the code indicating the error encountered during ingest.
152The following error codes are defined: 155The following error codes are defined:
153.Pp 156.Pp
154.Bl -tag -width "PROP_INGEST_ERROR_HANDLER_FAILED" -compact 157.Bl -tag -width "PROP_INGEST_ERROR_HANDLER_FAILED" -compact
155.It Dv PROP_INGEST_ERROR_NO_ERROR 158.It Dv PROP_INGEST_ERROR_NO_ERROR
156No error was encountered during ingest. 159No error was encountered during ingest.
157.It Dv PROP_INGEST_ERROR_NO_KEY 160.It Dv PROP_INGEST_ERROR_NO_KEY
158A non-optional key was not found in the dictionary. 161A non-optional key was not found in the dictionary.
159.It Dv PROP_INGEST_ERROR_WRONG_TYPE 162.It Dv PROP_INGEST_ERROR_WRONG_TYPE
160An object in the dictionary was not the same type specifed in the rules. 163An object in the dictionary was not the same type specifed in the rules.

cvs diff -r1.2 -r1.2.4.1 src/common/lib/libprop/prop_copyin_ioctl.9 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_copyin_ioctl.9 2007/04/22 11:23:29 1.2
+++ src/common/lib/libprop/prop_copyin_ioctl.9 2008/03/23 00:12:45 1.2.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_copyin_ioctl.9,v 1.2 2007/04/22 11:23:29 yamt Exp $ 1.\" prop_copyin_ioctl.9,v 1.2 2007/04/22 11:23:29 yamt Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -58,32 +58,62 @@ @@ -58,32 +58,62 @@
58.Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \ 58.Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \
59 "const u_long cmd" "prop_dictionary_t dict" 59 "const u_long cmd" "prop_dictionary_t dict"
60.Sh DESCRIPTION 60.Sh DESCRIPTION
61The 61The
62.Nm prop_array_copyin_ioctl , 62.Nm prop_array_copyin_ioctl ,
63.Nm prop_array_copyout_ioctl , 63.Nm prop_array_copyout_ioctl ,
64.Nm prop_dictionary_copyin_ioctl , 64.Nm prop_dictionary_copyin_ioctl ,
65and 65and
66.Nm prop_dictionary_copyout_ioctl 66.Nm prop_dictionary_copyout_ioctl
67functions implement the kernel side of a protocol for sending property lists 67functions implement the kernel side of a protocol for sending property lists
68to and from the kernel using 68to and from the kernel using
69.Xr ioctl 2 . 69.Xr ioctl 2 .
70.Pp 70.Pp
71A kernel ioctl routine receivig or returning a property list will be passed a 71A kernel ioctl routine receiving or returning a property list will be passed a
72pointer to a 72pointer to a
73.Vt struct plistref . 73.Vt struct plistref .
74This structure encapsulates the reference to the property list in externalized 74This structure encapsulates the reference to the property list in externalized
75form. 75form.
 76.Sh RETURN VALUES
 77If successful, functions return zero. Otherwise, an error number will be returned to indicate the error.
 78.Sh ERRORS
 79.Fn prop_array_copyin_ioctl
 80and
 81.Fn prop_dictionary_copyin_ioctl
 82will fail if:
 83.Bl -tag -width Er
 84.It Bq Er EFAULT
 85Bad address
 86.It Bq Er EIO
 87Input/output error
 88.It Bq Er ENOMEM
 89Cannot allocate memory
 90.It Bq Er ENOTSUP
 91Not supported
 92.El
76.Pp 93.Pp
 94.Fn prop_array_copyout_ioctl
 95and
 96.Fn prop_dictionary_copyout_ioctl
 97will fail if:
 98.Bl -tag -width Er
 99.It Bq Er EFAULT
 100Bad address
 101.It Bq Er ENOMEM
 102Cannot allocate memory
 103.It Bq Er ENOTSUP
 104Not supported
 105.El
 106.Sh EXAMPLES
77The following 107The following
78.Pq simplified 108.Pq simplified
79example demonstrates using 109example demonstrates using
80.Fn prop_dictionary_copyin_ioctl 110.Fn prop_dictionary_copyin_ioctl
81and 111and
82.Fn prop_dictionary_copyout_ioctl 112.Fn prop_dictionary_copyout_ioctl
83in an ioctl routine: 113in an ioctl routine:
84.Bd -literal 114.Bd -literal
85extern prop_dictionary_t fooprops; 115extern prop_dictionary_t fooprops;
86 116
87int 117int
88fooioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) 118fooioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
89{ 119{

cvs diff -r1.4 -r1.4.2.1 src/common/lib/libprop/prop_data.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_data.3 2007/08/16 16:31:00 1.4
+++ src/common/lib/libprop/prop_data.3 2008/03/23 00:12:45 1.4.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_data.3,v 1.4 2007/08/16 16:31:00 thorpej Exp $ 1.\" prop_data.3,v 1.4 2007/08/16 16:31:00 thorpej Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -72,60 +72,83 @@ @@ -72,60 +72,83 @@
72.Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2" 72.Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2"
73.Ft bool 73.Ft bool
74.Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len" 74.Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len"
75.Sh DESCRIPTION 75.Sh DESCRIPTION
76The 76The
77.Nm prop_data 77.Nm prop_data
78family of functions operate on an opaque data value property object type. 78family of functions operate on an opaque data value property object type.
79.Bl -tag -width "xxxxx" 79.Bl -tag -width "xxxxx"
80.It Fn prop_data_create_data "const void *blob" "size_t len" 80.It Fn prop_data_create_data "const void *blob" "size_t len"
81Create a data object that contains a copy of 81Create a data object that contains a copy of
82.Fa blob 82.Fa blob
83with size 83with size
84.Fa len . 84.Fa len .
 85Returns
 86.Dv NULL
 87on failure.
85.It Fn prop_data_create_data_nocopy "const void *blob" "size_t len" 88.It Fn prop_data_create_data_nocopy "const void *blob" "size_t len"
86Create a data object that contains a reference to 89Create a data object that contains a reference to
87.Fa blob 90.Fa blob
88with size 91with size
89.Fa len . 92.Fa len .
 93Returns
 94.Dv NULL
 95on failure.
90.It Fn prop_data_copy "prop_data_t data" 96.It Fn prop_data_copy "prop_data_t data"
91Copy a data object. 97Copy a data object.
92If the the data object being copied is an external data reference, 98If the data object being copied is an external data reference,
93then the copy also references the same external data. 99then the copy also references the same external data.
 100Returns
 101.Dv NULL
 102on failure.
94.It Fn prop_data_size "prop_data_t data" 103.It Fn prop_data_size "prop_data_t data"
95Returns the size of the data object. 104Returns the size of the data object.
 105If the supplied object isn't a data object, zero is returned.
96.It Fn prop_data_data "prop_data_t data" 106.It Fn prop_data_data "prop_data_t data"
97Returns a copy of the data object's contents. 107Returns a copy of the data object's contents.
98The caller is responsible for freeing the returned buffer. 108The caller is responsible for freeing the returned buffer.
 109If the supplied object isn't a data object or
 110if the data container is empty,
 111.Dv NULL
 112is returned.
99.Pp 113.Pp
100In user space, the buffer is allocated using 114In user space, the buffer is allocated using
101.Xr malloc 3 . 115.Xr malloc 3 .
102In the kernel, the buffer is allocated using 116In the kernel, the buffer is allocated using
103.Xr malloc 9 117.Xr malloc 9
104using the malloc type 118using the malloc type
105.Dv M_TEMP . 119.Dv M_TEMP .
106.It Fn prop_data_data_nocopy "prop_data_t data" 120.It Fn prop_data_data_nocopy "prop_data_t data"
107Returns an immutable reference to the contents of the data object. 121Returns an immutable reference to the contents of the data object.
 122If the supplied object isn't a data object,
 123.Dv NULL
 124is returned.
108.It Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2" 125.It Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2"
109Returns 126Returns
110.Dv true 127.Dv true
111if the two data objects are equivalent. 128if the two data objects are equivalent.
 129If at least one of the supplied objects isn't a data object,
 130.Dv false
 131is returned.
112.It Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len" 132.It Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len"
113Returns 133Returns
114.Dv true 134.Dv true
115if the data object's value is equivalent to 135if the data object's value is equivalent to
116.Fa blob 136.Fa blob
117with size 137with size
118.Fa len . 138.Fa len .
 139If the supplied object isn't a data object,
 140.Dv false
 141is returned.
119.El 142.El
120.Sh SEE ALSO 143.Sh SEE ALSO
121.Xr prop_array 3 , 144.Xr prop_array 3 ,
122.Xr prop_bool 3 , 145.Xr prop_bool 3 ,
123.Xr prop_dictionary 3 , 146.Xr prop_dictionary 3 ,
124.Xr prop_number 3 , 147.Xr prop_number 3 ,
125.Xr prop_object 3 , 148.Xr prop_object 3 ,
126.Xr prop_string 3 , 149.Xr prop_string 3 ,
127.Xr proplib 3 150.Xr proplib 3
128.Sh HISTORY 151.Sh HISTORY
129The 152The
130.Nm proplib 153.Nm proplib
131property container object library first appeared in 154property container object library first appeared in

cvs diff -r1.4 -r1.4.2.1 src/common/lib/libprop/prop_string.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_string.3 2007/08/16 16:31:00 1.4
+++ src/common/lib/libprop/prop_string.3 2008/03/23 00:12:45 1.4.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_string.3,v 1.4 2007/08/16 16:31:00 thorpej Exp $ 1.\" prop_string.3,v 1.4 2007/08/16 16:31:00 thorpej Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd April 22, 2006 37.Dd January 21, 2008
38.Dt PROP_STRING 3 38.Dt PROP_STRING 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm prop_string , 41.Nm prop_string ,
42.Nm prop_string_create , 42.Nm prop_string_create ,
43.Nm prop_string_create_cstring , 43.Nm prop_string_create_cstring ,
44.Nm prop_string_create_cstring_nocopy , 44.Nm prop_string_create_cstring_nocopy ,
45.Nm prop_string_copy , 45.Nm prop_string_copy ,
46.Nm prop_string_copy_mutable , 46.Nm prop_string_copy_mutable ,
47.Nm prop_string_size , 47.Nm prop_string_size ,
48.Nm prop_string_mutable , 48.Nm prop_string_mutable ,
49.Nm prop_string_cstring , 49.Nm prop_string_cstring ,
50.Nm prop_string_cstring_nocopy , 50.Nm prop_string_cstring_nocopy ,
@@ -81,57 +81,83 @@ @@ -81,57 +81,83 @@
81.Fn prop_string_append_cstring "prop_string_t string" "const char *cstring" 81.Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
82.\" 82.\"
83.Ft bool 83.Ft bool
84.Fn prop_string_equals "prop_string_t str1" "prop_string_t str2" 84.Fn prop_string_equals "prop_string_t str1" "prop_string_t str2"
85.Ft bool 85.Ft bool
86.Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring" 86.Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring"
87.Sh DESCRIPTION 87.Sh DESCRIPTION
88The 88The
89.Nm prop_string 89.Nm prop_string
90family of functions operate on a string value property object type. 90family of functions operate on a string value property object type.
91.Bl -tag -width "xxxxx" 91.Bl -tag -width "xxxxx"
92.It Fn prop_string_create "void" 92.It Fn prop_string_create "void"
93Create an empty mutable string. 93Create an empty mutable string.
 94Returns
 95.Dv NULL
 96on failure.
94.It Fn prop_string_create_cstring "const char *cstring" 97.It Fn prop_string_create_cstring "const char *cstring"
95Create a mutable string that contains a copy of 98Create a mutable string that contains a copy of
96.Fa cstring . 99.Fa cstring .
 100Returns
 101.Dv NULL
 102on failure.
97.It Fn prop_string_create_cstring_nocopy "const char *cstring" 103.It Fn prop_string_create_cstring_nocopy "const char *cstring"
98Create an immutable string that contains a reference to 104Create an immutable string that contains a reference to
99.Fa cstring . 105.Fa cstring .
 106Returns
 107.Dv NULL
 108on failure.
100.It Fn prop_string_copy "prop_string_t string" 109.It Fn prop_string_copy "prop_string_t string"
101Copy a string. 110Copy a string.
102If the the string being copied is an immutable external C string reference, 111If the the string being copied is an immutable external C string reference,
103then the copy is also immutable and references the same external C string. 112then the copy is also immutable and references the same external C string.
 113Returns
 114.Dv NULL
 115on failure.
104.It Fn prop_string_copy_mutable "prop_string_t string" 116.It Fn prop_string_copy_mutable "prop_string_t string"
105Copy a string, always creating a mutable copy. 117Copy a string, always creating a mutable copy.
 118Returns
 119.Dv NULL
 120on failure.
106.It Fn prop_string_size "prop_string_t string" 121.It Fn prop_string_size "prop_string_t string"
107Returns the size of the string, not including the terminating NUL. 122Returns the size of the string, not including the terminating NUL.
 123If the supplied object isn't a string, zero is returned.
108.It Fn prop_string_mutable "prop_string_t string" 124.It Fn prop_string_mutable "prop_string_t string"
109Returns 125Returns
110.Dv true 126.Dv true
111if the string is mutable. 127if the string is mutable.
 128If the supplied object isn't a string,
 129.Dv false
 130is returned.
112.It Fn prop_string_cstring "prop_string_t string" 131.It Fn prop_string_cstring "prop_string_t string"
113Returns a copy of the string's contents as a C string. 132Returns a copy of the string's contents as a C string.
114The caller is responsible for freeing the returned buffer. 133The caller is responsible for freeing the returned buffer.
115.Pp 134.Pp
116In user space, the buffer is allocated using 135In user space, the buffer is allocated using
117.Xr malloc 3 . 136.Xr malloc 3 .
118In the kernel, the buffer is allocated using 137In the kernel, the buffer is allocated using
119.Xr malloc 9 138.Xr malloc 9
120using the malloc type 139using the malloc type
121.Dv M_TEMP . 140.Dv M_TEMP .
 141.Pp
 142Returns
 143.Dv NULL
 144on failure.
122.It Fn prop_string_cstring_nocopy "prop_string_t string" 145.It Fn prop_string_cstring_nocopy "prop_string_t string"
123Returns an immutable reference to the contents of the string as a 146Returns an immutable reference to the contents of the string as a
124C string. 147C string.
 148If the supplied object isn't a string,
 149.Dv NULL
 150is returned.
125.It Fn prop_string_append "prop_string_t str1" "prop_string_t str2" 151.It Fn prop_string_append "prop_string_t str1" "prop_string_t str2"
126Append the contents of 152Append the contents of
127.Fa str2 153.Fa str2
128to 154to
129.Fa str1 , 155.Fa str1 ,
130which must be mutable. 156which must be mutable.
131Returns 157Returns
132.Dv true 158.Dv true
133upon success and 159upon success and
134.Dv false 160.Dv false
135otherwise. 161otherwise.
136.It Fn prop_string_append_cstring "prop_string_t string" "const char *cstring" 162.It Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
137Append the C string 163Append the C string

cvs diff -r1.8.2.1 -r1.8.2.2 src/common/lib/libprop/prop_data.c (expand / switch to unified diff)

--- src/common/lib/libprop/prop_data.c 2007/11/06 23:07:24 1.8.2.1
+++ src/common/lib/libprop/prop_data.c 2008/03/23 00:12:45 1.8.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: prop_data.c,v 1.8.2.1 2007/11/06 23:07:24 matt Exp $ */ 1/* prop_data.c,v 1.8.2.1 2007/11/06 23:07:24 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 The NetBSD Foundation, Inc. 4 * Copyright (c) 2006 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -118,54 +118,54 @@ _prop_data_externalize(struct _prop_obje @@ -118,54 +118,54 @@ _prop_data_externalize(struct _prop_obje
118 118
119 if (_prop_object_externalize_start_tag(ctx, "data") == false) 119 if (_prop_object_externalize_start_tag(ctx, "data") == false)
120 return (false); 120 return (false);
121 121
122 for (src = pd->pd_immutable, srclen = pd->pd_size; 122 for (src = pd->pd_immutable, srclen = pd->pd_size;
123 srclen > 2; srclen -= 3) { 123 srclen > 2; srclen -= 3) {
124 input[0] = *src++; 124 input[0] = *src++;
125 input[1] = *src++; 125 input[1] = *src++;
126 input[2] = *src++; 126 input[2] = *src++;
127 127
128 output[0] = (uint32_t)input[0] >> 2; 128 output[0] = (uint32_t)input[0] >> 2;
129 output[1] = ((uint32_t)(input[0] & 0x03) << 4) + 129 output[1] = ((uint32_t)(input[0] & 0x03) << 4) +
130 ((uint32_t)input[1] >> 4); 130 ((uint32_t)input[1] >> 4);
131 output[2] = ((u_int32_t)(input[1] & 0x0f) << 2) + 131 output[2] = ((uint32_t)(input[1] & 0x0f) << 2) +
132 ((uint32_t)input[2] >> 6); 132 ((uint32_t)input[2] >> 6);
133 output[3] = input[2] & 0x3f; 133 output[3] = input[2] & 0x3f;
134 _PROP_ASSERT(output[0] < 64); 134 _PROP_ASSERT(output[0] < 64);
135 _PROP_ASSERT(output[1] < 64); 135 _PROP_ASSERT(output[1] < 64);
136 _PROP_ASSERT(output[2] < 64); 136 _PROP_ASSERT(output[2] < 64);
137 _PROP_ASSERT(output[3] < 64); 137 _PROP_ASSERT(output[3] < 64);
138 138
139 if (_prop_object_externalize_append_char(ctx, 139 if (_prop_object_externalize_append_char(ctx,
140 _prop_data_base64[output[0]]) == false || 140 _prop_data_base64[output[0]]) == false ||
141 _prop_object_externalize_append_char(ctx, 141 _prop_object_externalize_append_char(ctx,
142 _prop_data_base64[output[1]]) == false || 142 _prop_data_base64[output[1]]) == false ||
143 _prop_object_externalize_append_char(ctx, 143 _prop_object_externalize_append_char(ctx,
144 _prop_data_base64[output[2]]) == false || 144 _prop_data_base64[output[2]]) == false ||
145 _prop_object_externalize_append_char(ctx, 145 _prop_object_externalize_append_char(ctx,
146 _prop_data_base64[output[3]]) == false) 146 _prop_data_base64[output[3]]) == false)
147 return (false); 147 return (false);
148 } 148 }
149 149
150 if (srclen != 0) { 150 if (srclen != 0) {
151 input[0] = input[1] = input[2] = '\0'; 151 input[0] = input[1] = input[2] = '\0';
152 for (i = 0; i < srclen; i++) 152 for (i = 0; i < srclen; i++)
153 input[i] = *src++; 153 input[i] = *src++;
154 154
155 output[0] = (uint32_t)input[0] >> 2; 155 output[0] = (uint32_t)input[0] >> 2;
156 output[1] = ((uint32_t)(input[0] & 0x03) << 4) + 156 output[1] = ((uint32_t)(input[0] & 0x03) << 4) +
157 ((uint32_t)input[1] >> 4); 157 ((uint32_t)input[1] >> 4);
158 output[2] = ((u_int32_t)(input[1] & 0x0f) << 2) + 158 output[2] = ((uint32_t)(input[1] & 0x0f) << 2) +
159 ((uint32_t)input[2] >> 6); 159 ((uint32_t)input[2] >> 6);
160 _PROP_ASSERT(output[0] < 64); 160 _PROP_ASSERT(output[0] < 64);
161 _PROP_ASSERT(output[1] < 64); 161 _PROP_ASSERT(output[1] < 64);
162 _PROP_ASSERT(output[2] < 64); 162 _PROP_ASSERT(output[2] < 64);
163 163
164 if (_prop_object_externalize_append_char(ctx, 164 if (_prop_object_externalize_append_char(ctx,
165 _prop_data_base64[output[0]]) == false || 165 _prop_data_base64[output[0]]) == false ||
166 _prop_object_externalize_append_char(ctx, 166 _prop_object_externalize_append_char(ctx,
167 _prop_data_base64[output[1]]) == false || 167 _prop_data_base64[output[1]]) == false ||
168 _prop_object_externalize_append_char(ctx, 168 _prop_object_externalize_append_char(ctx,
169 srclen == 1 ? _prop_data_pad64 169 srclen == 1 ? _prop_data_pad64
170 : _prop_data_base64[output[2]]) == false || 170 : _prop_data_base64[output[2]]) == false ||
171 _prop_object_externalize_append_char(ctx, 171 _prop_object_externalize_append_char(ctx,

cvs diff -r1.8.2.2 -r1.8.2.3 src/common/lib/libprop/prop_dictionary.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_dictionary.3 2008/01/09 01:21:35 1.8.2.2
+++ src/common/lib/libprop/prop_dictionary.3 2008/03/23 00:12:45 1.8.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_dictionary.3,v 1.8.2.2 2008/01/09 01:21:35 matt Exp $ 1.\" prop_dictionary.3,v 1.8.2.2 2008/01/09 01:21:35 matt Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd January 4, 2008 37.Dd January 21, 2008
38.Dt PROP_DICTIONARY 3 38.Dt PROP_DICTIONARY 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm prop_dictionary , 41.Nm prop_dictionary ,
42.Nm prop_dictionary_create , 42.Nm prop_dictionary_create ,
43.Nm prop_dictionary_create_with_capacity , 43.Nm prop_dictionary_create_with_capacity ,
44.Nm prop_dictionary_copy , 44.Nm prop_dictionary_copy ,
45.Nm prop_dictionary_copy_mutable , 45.Nm prop_dictionary_copy_mutable ,
46.Nm prop_dictionary_count , 46.Nm prop_dictionary_count ,
47.Nm prop_dictionary_ensure_capacity , 47.Nm prop_dictionary_ensure_capacity ,
48.Nm prop_dictionary_iterator , 48.Nm prop_dictionary_iterator ,
49.Nm prop_dictionary_all_keys , 49.Nm prop_dictionary_all_keys ,
50.Nm prop_dictionary_make_immutable , 50.Nm prop_dictionary_make_immutable ,
@@ -132,30 +132,36 @@ @@ -132,30 +132,36 @@
132 "const char *path" 132 "const char *path"
133.Ft prop_dictionary_t 133.Ft prop_dictionary_t
134.Fn prop_dictionary_internalize_from_file "const char *path" 134.Fn prop_dictionary_internalize_from_file "const char *path"
135.\" 135.\"
136.Sh DESCRIPTION 136.Sh DESCRIPTION
137The 137The
138.Nm prop_dictionary 138.Nm prop_dictionary
139family of functions operate on the dictionary property collection object type. 139family of functions operate on the dictionary property collection object type.
140A dictionary is an unordered set of objects stored as key-value pairs. 140A dictionary is an unordered set of objects stored as key-value pairs.
141.Bl -tag -width "xxxxx" 141.Bl -tag -width "xxxxx"
142.It Fn prop_dictionary_create "void" 142.It Fn prop_dictionary_create "void"
143Create an empty dictionary. 143Create an empty dictionary.
144The dictionary initially has no capacity. 144The dictionary initially has no capacity.
 145Returns
 146.Dv NULL
 147on failure.
145.It Fn prop_dictionary_create_with_capacity "unsigned int capacity" 148.It Fn prop_dictionary_create_with_capacity "unsigned int capacity"
146Create a dictionary with the capacity to store 149Create a dictionary with the capacity to store
147.Fa capacity 150.Fa capacity
148objects. 151objects.
 152Returns
 153.Dv NULL
 154on failure.
149.It Fn prop_dictionary_copy "prop_dictionary_t dict" 155.It Fn prop_dictionary_copy "prop_dictionary_t dict"
150Copy a dictionary. 156Copy a dictionary.
151The new dictionary has an initial capacity equal to the number of objects 157The new dictionary has an initial capacity equal to the number of objects
152stored in the dictionary being copied. 158stored in the dictionary being copied.
153The new dictionary contains references to the original dictionary's objects, 159The new dictionary contains references to the original dictionary's objects,
154not copies of those objects 160not copies of those objects
155.Pq i.e. a shallow copy is made . 161.Pq i.e. a shallow copy is made .
156If the original dictionary is immutable, the resulting dictionary is also 162If the original dictionary is immutable, the resulting dictionary is also
157immutable. 163immutable.
158.It Fn prop_dictionary_copy_mutable "prop_dictionary_t dict" 164.It Fn prop_dictionary_copy_mutable "prop_dictionary_t dict"
159Like 165Like
160.Fn prop_dictionary_copy , 166.Fn prop_dictionary_copy ,
161except the resulting dictionary is always mutable. 167except the resulting dictionary is always mutable.
@@ -163,42 +169,51 @@ except the resulting dictionary is alway @@ -163,42 +169,51 @@ except the resulting dictionary is alway
163Returns the number of objects stored in the dictionary. 169Returns the number of objects stored in the dictionary.
164.It Fn prop_dictionary_ensure_capacity "prop_dictionary_t dict" 170.It Fn prop_dictionary_ensure_capacity "prop_dictionary_t dict"
165Ensure that the dictionary has a total capacity of 171Ensure that the dictionary has a total capacity of
166.Fa capacity , 172.Fa capacity ,
167including objects already stored in the dictionary. 173including objects already stored in the dictionary.
168Returns 174Returns
169.Dv true 175.Dv true
170if the capacity of the dictionary is greater or equal to 176if the capacity of the dictionary is greater or equal to
171.Fa capacity 177.Fa capacity
172or if the expansion of the dictionary's capacity was successful 178or if the expansion of the dictionary's capacity was successful
173and 179and
174.Dv false 180.Dv false
175otherwise. 181otherwise.
 182If the supplied object isn't a dictionary,
 183.Dv false
 184is returned.
176.It Fn prop_dictionary_iterator "prop_dictionary_t dict" 185.It Fn prop_dictionary_iterator "prop_dictionary_t dict"
177Create an iterator for the dictionary. 186Create an iterator for the dictionary.
178The dictionary is retained by the iterator. 187The dictionary is retained by the iterator.
179A dictionary iterator returns the key symbols used to look up objects stored 188A dictionary iterator returns the key symbols used to look up objects stored
180in the dictionary; to get the object itself, a dictionary lookup using this 189in the dictionary; to get the object itself, a dictionary lookup using this
181key symbol must be performed. 190key symbol must be performed.
182Storing to or removing from the dictionary invalidates any active iterators for 191Storing to or removing from the dictionary invalidates any active iterators for
183the dictionary. 192the dictionary.
 193Returns
 194.Dv NULL
 195on failure.
184.It Fn prop_dictionary_all_keys "prop_dictionary_t dict" 196.It Fn prop_dictionary_all_keys "prop_dictionary_t dict"
185Return an array of all of the dictionary key symbols 197Return an array of all of the dictionary key symbols
186.Pq prop_dictionary_keysym_t 198.Pq prop_dictionary_keysym_t
187in the dictionary. 199in the dictionary.
188This provides a way to iterate over the items in the dictionary while 200This provides a way to iterate over the items in the dictionary while
189retaining the ability to mutate the dictionary; instead of iterating 201retaining the ability to mutate the dictionary; instead of iterating
190over the dictionary itself, iterate over the array of keys. 202over the dictionary itself, iterate over the array of keys.
191The caller is responsible for releasing the array. 203The caller is responsible for releasing the array.
 204Returns
 205.Dv NULL
 206on failure.
192.It Fn prop_dictionary_make_immutable "prop_dictionary_t dict" 207.It Fn prop_dictionary_make_immutable "prop_dictionary_t dict"
193Make 208Make
194.Fa dict 209.Fa dict
195immutable. 210immutable.
196.It Fn prop_dictionary_mutable "prop_dictionary_t dict" 211.It Fn prop_dictionary_mutable "prop_dictionary_t dict"
197Returns 212Returns
198.Dv true 213.Dv true
199if the dictionary is mutable. 214if the dictionary is mutable.
200.It Fn prop_dictionary_get "prop_dictionary_t dict" "const char *key" 215.It Fn prop_dictionary_get "prop_dictionary_t dict" "const char *key"
201Return the object stored in the dictionary with the key 216Return the object stored in the dictionary with the key
202.Fa key . 217.Fa key .
203If no object is stored with the specified key, 218If no object is stored with the specified key,
204.Dv NULL 219.Dv NULL
@@ -290,26 +305,29 @@ Externalizes a dictionary and writes it  @@ -290,26 +305,29 @@ Externalizes a dictionary and writes it
290.Fa path . 305.Fa path .
291The file is saved with the mode 306The file is saved with the mode
292.Dv 0666 307.Dv 0666
293as modified by the process's file creation mask 308as modified by the process's file creation mask
294.Pq see Xr umask 3 309.Pq see Xr umask 3
295and is written atomically. 310and is written atomically.
296Returns 311Returns
297.Dv false 312.Dv false
298if externalizing or writing the dictionary fails for any reason. 313if externalizing or writing the dictionary fails for any reason.
299.It Fn prop_dictionary_internalize_from_file "const char *path" 314.It Fn prop_dictionary_internalize_from_file "const char *path"
300Reads the XML property list contained in the file specified by 315Reads the XML property list contained in the file specified by
301.Fa path , 316.Fa path ,
302internalizes it, and returns the corresponding array. 317internalizes it, and returns the corresponding array.
 318Returns
 319.Dv NULL
 320on failure.
303.El 321.El
304.Sh SEE ALSO 322.Sh SEE ALSO
305.Xr prop_array 3 , 323.Xr prop_array 3 ,
306.Xr prop_bool 3 , 324.Xr prop_bool 3 ,
307.Xr prop_data 3 , 325.Xr prop_data 3 ,
308.Xr prop_number 3 , 326.Xr prop_number 3 ,
309.Xr prop_object 3 , 327.Xr prop_object 3 ,
310.Xr prop_string 3 , 328.Xr prop_string 3 ,
311.Xr proplib 3 329.Xr proplib 3
312.Sh HISTORY 330.Sh HISTORY
313The 331The
314.Nm proplib 332.Nm proplib
315property container object library first appeared in 333property container object library first appeared in

cvs diff -r1.19.2.1 -r1.19.2.2 src/common/lib/libprop/prop_dictionary.c (expand / switch to unified diff)

--- src/common/lib/libprop/prop_dictionary.c 2007/11/06 23:07:25 1.19.2.1
+++ src/common/lib/libprop/prop_dictionary.c 2008/03/23 00:12:45 1.19.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: prop_dictionary.c,v 1.19.2.1 2007/11/06 23:07:25 matt Exp $ */ 1/* prop_dictionary.c,v 1.19.2.1 2007/11/06 23:07:25 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -686,26 +686,40 @@ prop_dictionary_copy_mutable(prop_dictio @@ -686,26 +686,40 @@ prop_dictionary_copy_mutable(prop_dictio
686 prop_dictionary_t pd; 686 prop_dictionary_t pd;
687 687
688 if (! prop_object_is_dictionary(opd)) 688 if (! prop_object_is_dictionary(opd))
689 return (NULL); 689 return (NULL);
690 690
691 pd = prop_dictionary_copy(opd); 691 pd = prop_dictionary_copy(opd);
692 if (pd != NULL) 692 if (pd != NULL)
693 pd->pd_flags &= ~PD_F_IMMUTABLE; 693 pd->pd_flags &= ~PD_F_IMMUTABLE;
694 694
695 return (pd); 695 return (pd);
696} 696}
697 697
698/* 698/*
 699 * prop_dictionary_make_immutable --
 700 * Set the immutable flag on that dictionary.
 701 */
 702void
 703prop_dictionary_make_immutable(prop_dictionary_t pd)
 704{
 705
 706 _PROP_RWLOCK_WRLOCK(pd->pd_rwlock);
 707 if (prop_dictionary_is_immutable(pd) == false)
 708 pd->pd_flags |= PD_F_IMMUTABLE;
 709 _PROP_RWLOCK_UNLOCK(pd->pd_rwlock);
 710}
 711
 712/*
699 * prop_dictionary_count -- 713 * prop_dictionary_count --
700 * Return the number of objects stored in the dictionary. 714 * Return the number of objects stored in the dictionary.
701 */ 715 */
702unsigned int 716unsigned int
703prop_dictionary_count(prop_dictionary_t pd) 717prop_dictionary_count(prop_dictionary_t pd)
704{ 718{
705 unsigned int rv; 719 unsigned int rv;
706 720
707 if (! prop_object_is_dictionary(pd)) 721 if (! prop_object_is_dictionary(pd))
708 return (0); 722 return (0);
709 723
710 _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); 724 _PROP_RWLOCK_RDLOCK(pd->pd_rwlock);
711 rv = pd->pd_count; 725 rv = pd->pd_count;

cvs diff -r1.7 -r1.7.2.1 src/common/lib/libprop/prop_number.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_number.3 2007/08/16 16:31:00 1.7
+++ src/common/lib/libprop/prop_number.3 2008/03/23 00:12:45 1.7.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_number.3,v 1.7 2007/08/16 16:31:00 thorpej Exp $ 1.\" prop_number.3,v 1.7 2007/08/16 16:31:00 thorpej Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd October 11, 2006 37.Dd January 21, 2008
38.Dt PROP_NUMBER 3 38.Dt PROP_NUMBER 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm prop_number , 41.Nm prop_number ,
42.Nm prop_number_create_integer , 42.Nm prop_number_create_integer ,
43.Nm prop_number_create_unsigned_integer , 43.Nm prop_number_create_unsigned_integer ,
44.Nm prop_number_copy , 44.Nm prop_number_copy ,
45.Nm prop_number_size , 45.Nm prop_number_size ,
46.Nm prop_number_unsigned , 46.Nm prop_number_unsigned ,
47.Nm prop_number_integer_value , 47.Nm prop_number_integer_value ,
48.Nm prop_number_unsigned_integer_value , 48.Nm prop_number_unsigned_integer_value ,
49.Nm prop_number_equals , 49.Nm prop_number_equals ,
50.Nm prop_number_equals_integer , 50.Nm prop_number_equals_integer ,
@@ -121,57 +121,90 @@ then the number is signed. @@ -121,57 +121,90 @@ then the number is signed.
121If the first two characters of the number are 121If the first two characters of the number are
122.Sq 0x 122.Sq 0x
123then the number is unsigned. 123then the number is unsigned.
124.It 124.It
125If the number value fits into the range of a signed number then the 125If the number value fits into the range of a signed number then the
126number is signed. 126number is signed.
127.It 127.It
128In all other cases, the number is unsigned. 128In all other cases, the number is unsigned.
129.El 129.El
130.Bl -tag -width "xxxxx" 130.Bl -tag -width "xxxxx"
131.It Fn prop_number_create_integer "int64_t val" 131.It Fn prop_number_create_integer "int64_t val"
132Create a numeric value object with the signed value 132Create a numeric value object with the signed value
133.Fa val . 133.Fa val .
 134Returns
 135.Dv NULL
 136on failure.
134.It Fn prop_number_create_unsigned_integer "uint64_t val" 137.It Fn prop_number_create_unsigned_integer "uint64_t val"
135Create a numeric value object with the unsigned value 138Create a numeric value object with the unsigned value
136.Fa val . 139.Fa val .
 140Returns
 141.Dv NULL
 142on failure.
137.It Fn prop_number_copy "prop_number_t number" 143.It Fn prop_number_copy "prop_number_t number"
138Copy a numeric value object. 144Copy a numeric value object.
 145If the supplied object isn't a numeric value,
 146.Dv NULL
 147is returned.
139.It Fn prop_number_size "prop_number_t number" 148.It Fn prop_number_size "prop_number_t number"
140Returns 8, 16, 32, or 64, representing the number of bits required to 149Returns 8, 16, 32, or 64, representing the number of bits required to
141hold the value of the object. 150hold the value of the object.
 151If the supplied object isn't a numeric value,
 152.Dv NULL
 153is returned.
142.It Fn prop_number_unsigned "prop_number_t number" 154.It Fn prop_number_unsigned "prop_number_t number"
143Returns 155Returns
144.Dv true 156.Dv true
145if the numeric value object has an unsigned value. 157if the numeric value object has an unsigned value.
146.It Fn prop_number_integer_value "prop_number_t number" 158.It Fn prop_number_integer_value "prop_number_t number"
147Returns the signed integer value of the numeric value object. 159Returns the signed integer value of the numeric value object.
 160If the supplied object isn't a numeric value, zero is returned. Thus,
 161it is not possible to distinguish between ``not a prop_number_t''
 162and ``prop_number_t has a value of 0''.
148.It Fn prop_number_unsigned_integer_value "prop_number_t number" 163.It Fn prop_number_unsigned_integer_value "prop_number_t number"
149Returns the unsigned integer value of the numeric value object. 164Returns the unsigned integer value of the numeric value object.
 165If the supplied object isn't a numeric value, zero is returned. Thus,
 166it is not possible to distinguish between ``not a prop_number_t''
 167and ``prop_number_t has a value of 0''.
150.It Fn prop_number_equals "prop_number_t num1" "prop_number_t num2" 168.It Fn prop_number_equals "prop_number_t num1" "prop_number_t num2"
151Returns 169Returns
152.Dv true 170.Dv true
153if the two numeric value objects are equivalent. 171if the two numeric value objects are equivalent.
 172If at least one of the supplied objects isn't a numeric value,
 173.Dv false
 174is returned.
154.It Fn prop_number_equals_integer "prop_number_t number" "int64_t val" 175.It Fn prop_number_equals_integer "prop_number_t number" "int64_t val"
155Returns 176Returns
156.Dv true 177.Dv true
157if the object's value is equivalent to the signed value 178if the object's value is equivalent to the signed value
158.Fa val . 179.Fa val .
 180If the supplied object isn't a numerical value or if
 181.Fa val
 182exceeds
 183.Dv INT64_MAX ,
 184.Dv false
 185is returned.
159.It Fn prop_number_equals_unsigned_integer "prop_number_t number" \ 186.It Fn prop_number_equals_unsigned_integer "prop_number_t number" \
160 "uint64_t val" 187 "uint64_t val"
161Returns 188Returns
162.Dv true 189.Dv true
163if the object's value is equivalent to the unsigned value 190if the object's value is equivalent to the unsigned value
164.Fa val . 191.Fa val .
 192If the supplied object isn't a numerical value or if
 193.Fa val
 194exceeds
 195.Dv INT64_MAX ,
 196.Dv false
 197is returned.
165.El 198.El
166.Sh SEE ALSO 199.Sh SEE ALSO
167.Xr prop_array 3 , 200.Xr prop_array 3 ,
168.Xr prop_bool 3 , 201.Xr prop_bool 3 ,
169.Xr prop_data 3 , 202.Xr prop_data 3 ,
170.Xr prop_dictionary 3 , 203.Xr prop_dictionary 3 ,
171.Xr prop_object 3 , 204.Xr prop_object 3 ,
172.Xr prop_string 3 , 205.Xr prop_string 3 ,
173.Xr proplib 3 206.Xr proplib 3
174.Sh HISTORY 207.Sh HISTORY
175The 208The
176.Nm proplib 209.Nm proplib
177property container object library first appeared in 210property container object library first appeared in

cvs diff -r1.15.2.1 -r1.15.2.2 src/common/lib/libprop/prop_object.c (expand / switch to unified diff)

--- src/common/lib/libprop/prop_object.c 2007/11/06 23:07:26 1.15.2.1
+++ src/common/lib/libprop/prop_object.c 2008/03/23 00:12:45 1.15.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: prop_object.c,v 1.15.2.1 2007/11/06 23:07:26 matt Exp $ */ 1/* prop_object.c,v 1.15.2.1 2007/11/06 23:07:26 matt Exp */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -837,59 +837,56 @@ _prop_object_externalize_file_dirname(co @@ -837,59 +837,56 @@ _prop_object_externalize_file_dirname(co
837/* 837/*
838 * _prop_object_externalize_write_file -- 838 * _prop_object_externalize_write_file --
839 * Write an externalized dictionary to the specified file. 839 * Write an externalized dictionary to the specified file.
840 * The file is written atomically from the caller's perspective, 840 * The file is written atomically from the caller's perspective,
841 * and the mode set to 0666 modified by the caller's umask. 841 * and the mode set to 0666 modified by the caller's umask.
842 */ 842 */
843bool 843bool
844_prop_object_externalize_write_file(const char *fname, const char *xml, 844_prop_object_externalize_write_file(const char *fname, const char *xml,
845 size_t len) 845 size_t len)
846{ 846{
847 char tname[PATH_MAX]; 847 char tname[PATH_MAX];
848 int fd; 848 int fd;
849 int save_errno; 849 int save_errno;
 850 mode_t myumask;
850 851
851 if (len > SSIZE_MAX) { 852 if (len > SSIZE_MAX) {
852 errno = EFBIG; 853 errno = EFBIG;
853 return (false); 854 return (false);
854 } 855 }
855 856
856 /* 857 /*
857 * Get the directory name where the file is to be written 858 * Get the directory name where the file is to be written
858 * and create the temporary file. 859 * and create the temporary file.
859 * 
860 * We don't use mkstemp() because mkstemp() always creates the 
861 * file with mode 0600. We do, however, use mktemp() safely. 
862 */ 860 */
863 again: 
864 _prop_object_externalize_file_dirname(fname, tname); 861 _prop_object_externalize_file_dirname(fname, tname);
865 if (strlcat(tname, "/.plistXXXXXX", sizeof(tname)) >= sizeof(tname)) { 862 if (strlcat(tname, "/.plistXXXXXX", sizeof(tname)) >= sizeof(tname)) {
866 errno = ENAMETOOLONG; 863 errno = ENAMETOOLONG;
867 return (false); 864 return (false);
868 } 865 }
869 if (mktemp(tname) == NULL) 866 if ((fd = mkstemp(tname)) == -1)
870 return (false); 867 return (false);
871 if ((fd = open(tname, O_CREAT|O_RDWR|O_EXCL, 0666)) == -1) { 
872 if (errno == EEXIST) 
873 goto again; 
874 return (false); 
875 } 
876 868
877 if (write(fd, xml, len) != (ssize_t)len) 869 if (write(fd, xml, len) != (ssize_t)len)
878 goto bad; 870 goto bad;
879 871
880 if (fsync(fd) == -1) 872 if (fsync(fd) == -1)
881 goto bad; 873 goto bad;
882 874
 875 myumask = umask(0);
 876 (void)umask(myumask);
 877 if (fchmod(fd, 0666 & ~myumask) == -1)
 878 goto bad;
 879
883 (void) close(fd); 880 (void) close(fd);
884 fd = -1; 881 fd = -1;
885 882
886 if (rename(tname, fname) == -1) 883 if (rename(tname, fname) == -1)
887 goto bad; 884 goto bad;
888 885
889 return (true); 886 return (true);
890 887
891 bad: 888 bad:
892 save_errno = errno; 889 save_errno = errno;
893 if (fd != -1) 890 if (fd != -1)
894 (void) close(fd); 891 (void) close(fd);
895 (void) unlink(tname); 892 (void) unlink(tname);

cvs diff -r1.3 -r1.3.4.1 src/common/lib/libprop/prop_send_ioctl.3 (expand / switch to unified diff)

--- src/common/lib/libprop/prop_send_ioctl.3 2007/05/10 22:15:47 1.3
+++ src/common/lib/libprop/prop_send_ioctl.3 2008/03/23 00:12:45 1.3.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: prop_send_ioctl.3,v 1.3 2007/05/10 22:15:47 xtraeme Exp $ 1.\" prop_send_ioctl.3,v 1.3 2007/05/10 22:15:47 xtraeme Exp
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" 24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE. 35.\" POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd May 11, 2007 37.Dd January 21, 2008
38.Dt PROP_SEND_IOCTL 3 38.Dt PROP_SEND_IOCTL 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm prop_array_send_ioctl , 41.Nm prop_array_send_ioctl ,
42.Nm prop_array_recv_ioctl , 42.Nm prop_array_recv_ioctl ,
43.Nm prop_dictionary_send_ioctl , 43.Nm prop_dictionary_send_ioctl ,
44.Nm prop_dictionary_recv_ioctl , 44.Nm prop_dictionary_recv_ioctl ,
45.Nm prop_dictionary_sendrecv_ioctl 45.Nm prop_dictionary_sendrecv_ioctl
46.Nd Send and receive propertly lists to and from the kernel using ioctl 46.Nd Send and receive propertly lists to and from the kernel using ioctl
47.Sh SYNOPSIS 47.Sh SYNOPSIS
48.In prop/proplib.h 48.In prop/proplib.h
49.Ft int 49.Ft int
50.Fn prop_array_send_ioctl "prop_array_t array" "int fd" "unsigned long cmd" 50.Fn prop_array_send_ioctl "prop_array_t array" "int fd" "unsigned long cmd"
@@ -59,27 +59,55 @@ @@ -59,27 +59,55 @@
59.Fn prop_dictionary_sendrecv_ioctl "prop_dictionary_t dict" "int fd" \ 59.Fn prop_dictionary_sendrecv_ioctl "prop_dictionary_t dict" "int fd" \
60 "unsigned long cmd" "prop_dictionary_t *dictp" 60 "unsigned long cmd" "prop_dictionary_t *dictp"
61.Sh DESCRIPTION 61.Sh DESCRIPTION
62The 62The
63.Nm prop_array_send_ioctl , 63.Nm prop_array_send_ioctl ,
64.Nm prop_array_recv_ioctl , 64.Nm prop_array_recv_ioctl ,
65.Nm prop_dictionary_send_ioctl , 65.Nm prop_dictionary_send_ioctl ,
66.Nm prop_dictionary_recv_ioctl , 66.Nm prop_dictionary_recv_ioctl ,
67and 67and
68.Nm prop_dictionary_sendrecv_ioctl 68.Nm prop_dictionary_sendrecv_ioctl
69functions implement the user space side of a protocol for sending property 69functions implement the user space side of a protocol for sending property
70lists to and from the kernel using 70lists to and from the kernel using
71.Xr ioctl 2 . 71.Xr ioctl 2 .
 72.Sh RETURN VALUES
 73If successful, functions return zero. Otherwise, an error number is returned to indicate the error.
 74.Sh ERRORS
 75.Fn prop_array_send_ioctl
 76and
 77.Fn prop_dictionary_send_ioctl
 78will fail if:
 79.Bl -tag -width Er
 80.It Bq Er ENOMEM
 81Cannot allocate memory
 82.It Bq Er ENOTSUP
 83Not supported
 84.El
 85.Pp
 86.Fn prop_array_recv_ioctl
 87and
 88.Fn prop_dictionary_recv_ioctl
 89will fail if:
 90.Bl -tag -width Er
 91.It Bq Er EIO
 92Input/output error
 93.It Bq Er ENOTSUP
 94Not supported
 95.El
72.Pp 96.Pp
 97In addition to these,
 98.Xr ioctl 2
 99errors may be returned.
 100.Sh EXAMPLES
73The following 101The following
74.Pq simplified 102.Pq simplified
75example demonstrates using 103example demonstrates using
76.Fn prop_dictionary_send_ioctl 104.Fn prop_dictionary_send_ioctl
77and 105and
78.Fn prop_dictionary_recv_ioctl 106.Fn prop_dictionary_recv_ioctl
79in an application: 107in an application:
80.Bd -literal 108.Bd -literal
81void 109void
82foo_setprops(prop_dictionary_t dict) 110foo_setprops(prop_dictionary_t dict)
83{ 111{
84 int fd; 112 int fd;
85 113