Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src New files for Userland support of UCB RISC-V (both 32-bit an...
details: https://anonhg.NetBSD.org/src/rev/9c582554cafa
branches: trunk
changeset: 332402:9c582554cafa
user: matt <matt%NetBSD.org@localhost>
date: Fri Sep 19 17:36:24 2014 +0000
description:
New files for Userland support of UCB RISC-V (both 32-bit and 64-bit)
diffstat:
common/lib/libc/arch/riscv/atomic/Makefile.inc | 28 +
common/lib/libc/arch/riscv/atomic/atomic_add_32.S | 93 +++
common/lib/libc/arch/riscv/atomic/atomic_add_64.S | 77 ++
common/lib/libc/arch/riscv/atomic/atomic_and_32.S | 62 ++
common/lib/libc/arch/riscv/atomic/atomic_and_64.S | 54 ++
common/lib/libc/arch/riscv/atomic/atomic_cas_32.S | 69 ++
common/lib/libc/arch/riscv/atomic/atomic_cas_64.S | 68 ++
common/lib/libc/arch/riscv/atomic/atomic_nand_32.S | 69 ++
common/lib/libc/arch/riscv/atomic/atomic_nand_64.S | 61 ++
common/lib/libc/arch/riscv/atomic/atomic_op_asm.h | 57 ++
common/lib/libc/arch/riscv/atomic/atomic_or_32.S | 63 ++
common/lib/libc/arch/riscv/atomic/atomic_or_64.S | 55 ++
common/lib/libc/arch/riscv/atomic/atomic_sub_32.S | 95 +++
common/lib/libc/arch/riscv/atomic/atomic_sub_64.S | 79 ++
common/lib/libc/arch/riscv/atomic/atomic_swap_32.S | 59 ++
common/lib/libc/arch/riscv/atomic/atomic_swap_64.S | 55 ++
common/lib/libc/arch/riscv/atomic/atomic_xor_32.S | 63 ++
common/lib/libc/arch/riscv/atomic/atomic_xor_64.S | 55 ++
common/lib/libc/arch/riscv/atomic/membar_ops.S | 63 ++
common/lib/libc/arch/riscv/string/ffs.c | 12 +
compat/riscv64/rv32/Makefile | 5 +
compat/riscv64/rv32/bsd.rv32.mk | 21 +
distrib/sets/lists/base/ad.riscv | 325 ++++++++++++
distrib/sets/lists/comp/ad.riscv | 559 +++++++++++++++++++++
distrib/sets/lists/debug/ad.riscv | 163 ++++++
etc/etc.riscv/MAKEDEV.conf | 17 +
etc/etc.riscv/ttys | 7 +
etc/mtree/NetBSD.dist.riscv64 | 15 +
lib/csu/arch/riscv/Makefile.inc | 5 +
lib/csu/arch/riscv/crt0.S | 44 +
lib/csu/arch/riscv/crtbegin.h | 35 +
lib/csu/arch/riscv/crtend.S | 48 +
lib/csu/arch/riscv/crti.S | 41 +
lib/csu/arch/riscv/crtn.S | 3 +
lib/libc/arch/riscv/Makefile.inc | 9 +
lib/libc/arch/riscv/SYS.h | 73 ++
lib/libc/arch/riscv/gdtoa/Makefile.inc | 3 +
lib/libc/arch/riscv/gdtoa/arith.h | 3 +
lib/libc/arch/riscv/gdtoa/gd_qnan.h | 5 +
lib/libc/arch/riscv/gen/Makefile.inc | 29 +
lib/libc/arch/riscv/gen/__setjmp14.S | 115 ++++
lib/libc/arch/riscv/gen/__sigsetjmp14.S | 21 +
lib/libc/arch/riscv/gen/_lwp.c | 72 ++
lib/libc/arch/riscv/gen/_setjmp.S | 132 ++++
lib/libc/arch/riscv/gen/flt_rounds.c | 52 +
lib/libc/arch/riscv/gen/fpgetmask.c | 55 ++
lib/libc/arch/riscv/gen/fpgetround.c | 51 +
lib/libc/arch/riscv/gen/fpgetsticky.c | 51 +
lib/libc/arch/riscv/gen/fpsetmask.c | 55 ++
lib/libc/arch/riscv/gen/fpsetround.c | 51 +
lib/libc/arch/riscv/gen/fpsetsticky.c | 51 +
lib/libc/arch/riscv/gen/makecontext.c | 83 +++
lib/libc/arch/riscv/gen/nanf.c | 15 +
lib/libc/arch/riscv/gen/resumecontext.c | 54 ++
lib/libc/arch/riscv/gen/swapcontext.S | 61 ++
lib/libc/arch/riscv/genassym.cf | 85 +++
lib/libc/arch/riscv/net/Makefile.inc | 1 +
lib/libc/arch/riscv/stdlib/Makefile.inc | 1 +
lib/libc/arch/riscv/string/Makefile.inc | 1 +
lib/libc/arch/riscv/strlib | 1 +
lib/libc/arch/riscv/sys/__clone.S | 98 +++
lib/libc/arch/riscv/sys/__sigaction14_sigtramp.c | 79 ++
lib/libc/arch/riscv/sys/__sigtramp2.S | 55 ++
lib/libc/arch/riscv/sys/__syscall.S | 19 +
lib/libc/arch/riscv/sys/__vfork14.S | 58 ++
lib/libc/arch/riscv/sys/brk.S | 69 ++
lib/libc/arch/riscv/sys/cerror.S | 63 ++
lib/libc/arch/riscv/sys/exect.S | 9 +
lib/libc/arch/riscv/sys/fork.S | 45 +
lib/libc/arch/riscv/sys/getcontext.S | 48 +
lib/libc/arch/riscv/sys/pipe.S | 50 +
lib/libc/arch/riscv/sys/ptrace.S | 75 ++
lib/libc/arch/riscv/sys/sbrk.S | 53 +
lib/libc/arch/riscv/sys/shmat.S | 5 +
lib/libc/arch/riscv/sys/syscall.S | 3 +
lib/libc/compat/arch/riscv/Makefile.inc | 1 +
lib/libkvm/kvm_riscv.c | 126 ++++
lib/libm/arch/riscv/e_sqrt.S | 10 +
lib/libm/arch/riscv/e_sqrtf.S | 10 +
lib/libm/arch/riscv/fenv.c | 279 ++++++++++
lib/libm/arch/riscv/lrint.S | 18 +
lib/libm/arch/riscv/lrintf.S | 18 +
lib/libm/arch/riscv/s_copysign.S | 10 +
lib/libm/arch/riscv/s_copysignf.S | 10 +
lib/libm/arch/riscv/s_fabs.S | 10 +
lib/libm/arch/riscv/s_fabsf.S | 10 +
lib/libm/arch/riscv/s_fma.S | 10 +
lib/libm/arch/riscv/s_fmaf.S | 10 +
lib/libm/arch/riscv/s_fmax.S | 15 +
lib/libm/arch/riscv/s_fmaxf.S | 10 +
lib/libm/arch/riscv/s_fmin.S | 15 +
lib/libm/arch/riscv/s_fminf.S | 10 +
lib/libpthread/arch/riscv/pthread_md.h | 47 +
libexec/ld.elf_so/arch/riscv/Makefile.inc | 15 +
libexec/ld.elf_so/arch/riscv/mdreloc.c | 370 +++++++++++++
libexec/ld.elf_so/arch/riscv/rtld_start.S | 114 ++++
sys/arch/riscv/Makefile | 5 +
sys/arch/riscv/conf/majors.riscv | 41 +
sys/arch/riscv/include/Makefile | 24 +
sys/arch/riscv/include/ansi.h | 3 +
sys/arch/riscv/include/aout_machdep.h | 40 +
sys/arch/riscv/include/asm.h | 259 +++++++++
sys/arch/riscv/include/bswap.h | 11 +
sys/arch/riscv/include/bus.h | 8 +
sys/arch/riscv/include/byte_swap.h | 97 +++
sys/arch/riscv/include/cdefs.h | 8 +
sys/arch/riscv/include/cpu.h | 149 +++++
sys/arch/riscv/include/cpu_counter.h | 88 +++
sys/arch/riscv/include/db_machdep.h | 124 ++++
sys/arch/riscv/include/disklabel.h | 68 ++
sys/arch/riscv/include/elf_machdep.h | 128 ++++
sys/arch/riscv/include/endian.h | 3 +
sys/arch/riscv/include/endian_machdep.h | 3 +
sys/arch/riscv/include/fenv.h | 35 +
sys/arch/riscv/include/float.h | 58 ++
sys/arch/riscv/include/frame.h | 52 +
sys/arch/riscv/include/ieee.h | 3 +
sys/arch/riscv/include/ieeefp.h | 44 +
sys/arch/riscv/include/insn.h | 276 ++++++++++
sys/arch/riscv/include/int_const.h | 20 +
sys/arch/riscv/include/int_fmtio.h | 216 ++++++++
sys/arch/riscv/include/int_limits.h | 3 +
sys/arch/riscv/include/int_mwgwtypes.h | 3 +
sys/arch/riscv/include/int_types.h | 3 +
sys/arch/riscv/include/intr.h | 159 +++++
sys/arch/riscv/include/kcore.h | 40 +
sys/arch/riscv/include/limits.h | 3 +
sys/arch/riscv/include/lock.h | 124 ++++
sys/arch/riscv/include/locore.h | 187 +++++++
sys/arch/riscv/include/math.h | 3 +
sys/arch/riscv/include/mcontext.h | 168 ++++++
sys/arch/riscv/include/mutex.h | 140 +++++
sys/arch/riscv/include/netbsd32_machdep.h | 62 ++
sys/arch/riscv/include/param.h | 108 ++++
sys/arch/riscv/include/pcb.h | 46 +
sys/arch/riscv/include/pmap.h | 175 ++++++
sys/arch/riscv/include/pmc.h | 3 +
sys/arch/riscv/include/proc.h | 70 ++
sys/arch/riscv/include/profile.h | 91 +++
sys/arch/riscv/include/pte.h | 286 ++++++++++
sys/arch/riscv/include/ptrace.h | 50 +
sys/arch/riscv/include/reg.h | 115 ++++
sys/arch/riscv/include/rwlock.h | 56 ++
sys/arch/riscv/include/setjmp.h | 74 ++
sys/arch/riscv/include/signal.h | 39 +
sys/arch/riscv/include/sysarch.h | 3 +
sys/arch/riscv/include/sysreg.h | 192 +++++++
sys/arch/riscv/include/types.h | 107 ++++
sys/arch/riscv/include/vmparam.h | 179 ++++++
sys/arch/riscv/include/wchar_limits.h | 3 +
sys/lib/libkern/arch/riscv/Makefile.inc | 3 +
tests/lib/libc/arch/riscv/exec_prot_support.c | 41 +
tests/lib/libc/arch/riscv/return_one.S | 11 +
usr.bin/xlint/arch/riscv32/targparam.h | 54 ++
usr.bin/xlint/arch/riscv64/targparam.h | 54 ++
155 files changed, 9920 insertions(+), 0 deletions(-)
diffs (truncated from 10540 to 300 lines):
diff -r 2d134c70ab13 -r 9c582554cafa common/lib/libc/arch/riscv/atomic/Makefile.inc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/arch/riscv/atomic/Makefile.inc Fri Sep 19 17:36:24 2014 +0000
@@ -0,0 +1,28 @@
+# $NetBSD: Makefile.inc,v 1.1 2014/09/19 17:36:24 matt Exp $
+
+.for op in add and cas nand or sub swap xor
+sizes=32
+.if "${MLIBDIR}" != ""
+.if ${COMMON_MACHINE_ARCH} == "riscv64"
+sizes+=64
+.endif
+.elif ${MACHINE_ARCH} == "riscv64"
+sizes+=64
+.endif
+.for sz in ${sizes}
+SRCS.atomic+= atomic_${op}_${sz}.S
+.endfor
+.for sz in 8 16
+SRCS.atomic+= atomic_${op}_${sz}_cas.c
+.endfor
+.endfor
+SRCS.atomic+= membar_ops.S
+SRCS.atomic+= atomic_cas_by_cas32.c
+
+.if defined(LIB) && (${LIB} != "kern" && ${LIB} != "rump")
+
+SRCS.atomic+= atomic_init_cas.c
+
+.endif #LIB
+
+SRCS+= ${SRCS.atomic}
diff -r 2d134c70ab13 -r 9c582554cafa common/lib/libc/arch/riscv/atomic/atomic_add_32.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/arch/riscv/atomic/atomic_add_32.S Fri Sep 19 17:36:24 2014 +0000
@@ -0,0 +1,93 @@
+/* $NetBSD: atomic_add_32.S,v 1.1 2014/09/19 17:36:24 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 "atomic_op_asm.h"
+
+ENTRY_NP(_atomic_inc_32)
+ li a1, 1
+ENTRY_NP(_atomic_add_32)
+ amoadd.w.aq v0, a1, 0(a0)
+ ret
+END(_atomic_add_32)
+END(_atomic_inc_32)
+
+ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32)
+ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32)
+STRONG_ALIAS(_atomic_add_int,_atomic_add_32)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32)
+STRONG_ALIAS(_atomic_add_long,_atomic_add_32)
+ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32)
+STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32)
+#endif
+CRT_ALIAS(__sync_fetch_and_add_4,_atomic_add_32)
+CRT_ALIAS(__atomic_fetch_add_4,_atomic_add_32)
+
+ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32)
+ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32)
+STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32)
+STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32)
+ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32)
+STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32)
+#endif
+
+ENTRY_NP(_atomic_inc_32_nv)
+ li a1, 1
+ENTRY_NP(_atomic_add_32_nv)
+ amoadd.w.aq v0, a1, 0(a0) /* update memory and get old value */
+ INT_ADD v0, v0, a1 /* turn into new value */
+ ret
+END(_atomic_add_32_nv)
+END(_atomic_inc_32_nv)
+
+ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv)
+ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv)
+STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv)
+STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv)
+ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv)
+STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv)
+#endif
+CRT_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv)
+CRT_ALIAS(__atomic_add_fetch_4,_atomic_add_32_nv)
+
+ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv)
+ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv)
+STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv)
+STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv)
+ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv)
+STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv)
+#endif
diff -r 2d134c70ab13 -r 9c582554cafa common/lib/libc/arch/riscv/atomic/atomic_add_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/arch/riscv/atomic/atomic_add_64.S Fri Sep 19 17:36:24 2014 +0000
@@ -0,0 +1,77 @@
+/* $NetBSD: atomic_add_64.S,v 1.1 2014/09/19 17:36:24 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 "atomic_op_asm.h"
+
+ENTRY_NP(_atomic_inc_64)
+ li a1, 1
+ENTRY_NP(_atomic_add_64)
+ amoadd.d.aq v0, a1, 0(a0)
+ ret
+END(_atomic_add_64)
+END(_atomic_inc_64)
+
+ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
+ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64)
+STRONG_ALIAS(_atomic_add_long,_atomic_add_64)
+ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64)
+STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64)
+CRT_ALIAS(__sync_fetch_and_add_8,_atomic_add_64)
+CRT_ALIAS(__atomic_fetch_add_8,_atomic_add_64)
+
+ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64)
+ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64)
+STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64)
+ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64)
+STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64)
+
+ENTRY_NP(_atomic_inc_64_nv)
+ li a1, 1
+ENTRY_NP(_atomic_add_64_nv)
+ amoadd.d.aq v0, a1, 0(a0) /* update memory and get old value */
+ LONG_ADD v0, v0, a1 /* turn into new value */
+ ret
+END(_atomic_add_64_nv)
+END(_atomic_inc_64_nv)
+
+ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv)
+ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64_nv)
+STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv)
+ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv)
+STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv)
+CRT_ALIAS(__sync_add_and_fetch_8,_atomic_add_64_nv)
+CRT_ALIAS(__atomic_add_fetch_8,_atomic_add_64_nv)
+
+ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv)
+ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv)
+STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv)
+ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv)
+STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv)
diff -r 2d134c70ab13 -r 9c582554cafa common/lib/libc/arch/riscv/atomic/atomic_and_32.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/arch/riscv/atomic/atomic_and_32.S Fri Sep 19 17:36:24 2014 +0000
@@ -0,0 +1,62 @@
+/* $NetBSD: atomic_and_32.S,v 1.1 2014/09/19 17:36:24 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 "atomic_op_asm.h"
+
+ENTRY_NP(_atomic_and_32)
+ amoand.w.aq v0, a1, 0(a0)
+ ret
+END(_atomic_and_32)
+
+ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32)
+ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32)
+STRONG_ALIAS(_atomic_and_uint,_atomic_and_32)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32)
+STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32)
+#endif
+CRT_ALIAS(__sync_fetch_and_and_4,_atomic_and_32)
+CRT_ALIAS(__atomic_fetch_and_4,_atomic_and_32)
+
+ENTRY_NP(_atomic_and_32_nv)
+ amoand.w.aq v0, a1, 0(a0) /* update memory and get old value */
+ and v0, v0, a1 /* turn into new value */
+ ret
+END(_atomic_and_32_nv)
+ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
+ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv)
+STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv)
+#ifndef _LP64
+ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv)
+STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv)
+#endif
+CRT_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv)
+CRT_ALIAS(__atomic_and_fetch_4,_atomic_and_32_nv)
diff -r 2d134c70ab13 -r 9c582554cafa common/lib/libc/arch/riscv/atomic/atomic_and_64.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/arch/riscv/atomic/atomic_and_64.S Fri Sep 19 17:36:24 2014 +0000
@@ -0,0 +1,54 @@
+/* $NetBSD: atomic_and_64.S,v 1.1 2014/09/19 17:36:24 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
Home |
Main Index |
Thread Index |
Old Index