Author: andrew
Date: Mon Mar 23 11:54:56 2015
New Revision: 280364
URL: https://svnweb.freebsd.org/changeset/base/280364

Log:
  Add the start of the arm64 machine headers. This is the subset needed to
  start getting userland libraries building.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/arm64/
  head/sys/arm64/include/
  head/sys/arm64/include/_align.h   (contents, props changed)
  head/sys/arm64/include/_inttypes.h   (contents, props changed)
  head/sys/arm64/include/_limits.h   (contents, props changed)
  head/sys/arm64/include/_stdint.h   (contents, props changed)
  head/sys/arm64/include/_types.h   (contents, props changed)
  head/sys/arm64/include/asm.h   (contents, props changed)
  head/sys/arm64/include/atomic.h   (contents, props changed)
  head/sys/arm64/include/cpu.h   (contents, props changed)
  head/sys/arm64/include/cpufunc.h   (contents, props changed)
  head/sys/arm64/include/elf.h   (contents, props changed)
  head/sys/arm64/include/endian.h   (contents, props changed)
  head/sys/arm64/include/exec.h   (contents, props changed)
  head/sys/arm64/include/float.h   (contents, props changed)
  head/sys/arm64/include/ieeefp.h   (contents, props changed)
  head/sys/arm64/include/param.h   (contents, props changed)
  head/sys/arm64/include/pcb.h   (contents, props changed)
  head/sys/arm64/include/pcpu.h   (contents, props changed)
  head/sys/arm64/include/pmap.h   (contents, props changed)
  head/sys/arm64/include/pmc_mdep.h   (contents, props changed)
  head/sys/arm64/include/proc.h   (contents, props changed)
  head/sys/arm64/include/profile.h   (contents, props changed)
  head/sys/arm64/include/pte.h   (contents, props changed)
  head/sys/arm64/include/reloc.h   (contents, props changed)
  head/sys/arm64/include/runq.h   (contents, props changed)
  head/sys/arm64/include/setjmp.h   (contents, props changed)
  head/sys/arm64/include/signal.h   (contents, props changed)
  head/sys/arm64/include/stdarg.h   (contents, props changed)
  head/sys/arm64/include/ucontext.h   (contents, props changed)
  head/sys/arm64/include/vdso.h   (contents, props changed)
  head/sys/arm64/include/vm.h   (contents, props changed)
  head/sys/arm64/include/vmparam.h   (contents, props changed)

Added: head/sys/arm64/include/_align.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/_align.h     Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * 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 REGENTS 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 REGENTS 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.
+ *
+ *     from: @(#)param.h       5.8 (Berkeley) 6/28/91
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__ALIGN_H_
+#define        _MACHINE__ALIGN_H_
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...).   The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define        _ALIGNBYTES     (sizeof(long long) - 1)
+#define        _ALIGN(p)       (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+
+#endif /* !_MACHINE__ALIGN_H_ */

Added: head/sys/arm64/include/_inttypes.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/_inttypes.h  Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,213 @@
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ *     From: $NetBSD: int_fmtio.h,v 1.4 2008/04/28 20:23:36 martin Exp $
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__INTTYPES_H_
+#define        _MACHINE__INTTYPES_H_
+
+/*
+ * Macros for format specifiers.
+ */
+
+/* fprintf(3) macros for signed integers. */
+
+#define        PRId8           "d"     /* int8_t */
+#define        PRId16          "d"     /* int16_t */
+#define        PRId32          "d"     /* int32_t */
+#define        PRId64          "ld"    /* int64_t */
+#define        PRIdLEAST8      "d"     /* int_least8_t */
+#define        PRIdLEAST16     "d"     /* int_least16_t */
+#define        PRIdLEAST32     "d"     /* int_least32_t */
+#define        PRIdLEAST64     "ld"    /* int_least64_t */
+#define        PRIdFAST8       "d"     /* int_fast8_t */
+#define        PRIdFAST16      "d"     /* int_fast16_t */
+#define        PRIdFAST32      "d"     /* int_fast32_t */
+#define        PRIdFAST64      "ld"    /* int_fast64_t */
+#define        PRIdMAX         "jd"    /* intmax_t */
+#define        PRIdPTR         "ld"    /* intptr_t */
+
+#define        PRIi8           "i"     /* int8_t */
+#define        PRIi16          "i"     /* int16_t */
+#define        PRIi32          "i"     /* int32_t */
+#define        PRIi64          "li"    /* int64_t */
+#define        PRIiLEAST8      "i"     /* int_least8_t  */
+#define        PRIiLEAST16     "i"     /* int_least16_t */
+#define        PRIiLEAST32     "i"     /* int_least32_t */
+#define        PRIiLEAST64     "li"    /* int_least64_t */
+#define        PRIiFAST8       "i"     /* int_fast8_t */
+#define        PRIiFAST16      "i"     /* int_fast16_t */
+#define        PRIiFAST32      "i"     /* int_fast32_t */
+#define        PRIiFAST64      "li"    /* int_fast64_t */
+#define        PRIiMAX         "ji"    /* intmax_t */
+#define        PRIiPTR         "li"    /* intptr_t */
+
+/* fprintf(3) macros for unsigned integers. */
+
+#define        PRIo8           "o"     /* uint8_t */
+#define        PRIo16          "o"     /* uint16_t */
+#define        PRIo32          "o"     /* uint32_t */
+#define        PRIo64          "lo"    /* uint64_t */
+#define        PRIoLEAST8      "o"     /* uint_least8_t */
+#define        PRIoLEAST16     "o"     /* uint_least16_t */
+#define        PRIoLEAST32     "o"     /* uint_least32_t */
+#define        PRIoLEAST64     "lo"    /* uint_least64_t */
+#define        PRIoFAST8       "o"     /* uint_fast8_t */
+#define        PRIoFAST16      "o"     /* uint_fast16_t */
+#define        PRIoFAST32      "o"     /* uint_fast32_t */
+#define        PRIoFAST64      "lo"    /* uint_fast64_t */
+#define        PRIoMAX         "jo"    /* uintmax_t */
+#define        PRIoPTR         "lo"    /* uintptr_t */
+
+#define        PRIu8           "u"     /* uint8_t */
+#define        PRIu16          "u"     /* uint16_t */
+#define        PRIu32          "u"     /* uint32_t */
+#define        PRIu64          "lu"    /* uint64_t */
+#define        PRIuLEAST8      "u"     /* uint_least8_t */
+#define        PRIuLEAST16     "u"     /* uint_least16_t */
+#define        PRIuLEAST32     "u"     /* uint_least32_t */
+#define        PRIuLEAST64     "lu"    /* uint_least64_t */
+#define        PRIuFAST8       "u"     /* uint_fast8_t */
+#define        PRIuFAST16      "u"     /* uint_fast16_t */
+#define        PRIuFAST32      "u"     /* uint_fast32_t */
+#define        PRIuFAST64      "lu"    /* uint_fast64_t */
+#define        PRIuMAX         "ju"    /* uintmax_t */
+#define        PRIuPTR         "lu"    /* uintptr_t */
+
+#define        PRIx8           "x"     /* uint8_t */
+#define        PRIx16          "x"     /* uint16_t */
+#define        PRIx32          "x"     /* uint32_t */
+#define        PRIx64          "lx"    /* uint64_t */
+#define        PRIxLEAST8      "x"     /* uint_least8_t */
+#define        PRIxLEAST16     "x"     /* uint_least16_t */
+#define        PRIxLEAST32     "x"     /* uint_least32_t */
+#define        PRIxLEAST64     "lx"    /* uint_least64_t */
+#define        PRIxFAST8       "x"     /* uint_fast8_t */
+#define        PRIxFAST16      "x"     /* uint_fast16_t */
+#define        PRIxFAST32      "x"     /* uint_fast32_t */
+#define        PRIxFAST64      "lx"    /* uint_fast64_t */
+#define        PRIxMAX         "jx"    /* uintmax_t */
+#define        PRIxPTR         "lx"    /* uintptr_t */
+
+#define        PRIX8           "X"     /* uint8_t */
+#define        PRIX16          "X"     /* uint16_t */
+#define        PRIX32          "X"     /* uint32_t */
+#define        PRIX64          "lX"    /* uint64_t */
+#define        PRIXLEAST8      "X"     /* uint_least8_t */
+#define        PRIXLEAST16     "X"     /* uint_least16_t */
+#define        PRIXLEAST32     "X"     /* uint_least32_t */
+#define        PRIXLEAST64     "lX"    /* uint_least64_t */
+#define        PRIXFAST8       "X"     /* uint_fast8_t */
+#define        PRIXFAST16      "X"     /* uint_fast16_t */
+#define        PRIXFAST32      "X"     /* uint_fast32_t */
+#define        PRIXFAST64      "lX"    /* uint_fast64_t */
+#define        PRIXMAX         "jX"    /* uintmax_t */
+#define        PRIXPTR         "lX"    /* uintptr_t */
+
+/* fscanf(3) macros for signed integers. */
+
+#define        SCNd8           "hhd"   /* int8_t */
+#define        SCNd16          "hd"    /* int16_t */
+#define        SCNd32          "d"     /* int32_t */
+#define        SCNd64          "ld"    /* int64_t */
+#define        SCNdLEAST8      "hhd"   /* int_least8_t */
+#define        SCNdLEAST16     "hd"    /* int_least16_t */
+#define        SCNdLEAST32     "d"     /* int_least32_t */
+#define        SCNdLEAST64     "ld"    /* int_least64_t */
+#define        SCNdFAST8       "d"     /* int_fast8_t */
+#define        SCNdFAST16      "d"     /* int_fast16_t */
+#define        SCNdFAST32      "d"     /* int_fast32_t */
+#define        SCNdFAST64      "ld"    /* int_fast64_t */
+#define        SCNdMAX         "jd"    /* intmax_t */
+#define        SCNdPTR         "ld"    /* intptr_t */
+
+#define        SCNi8           "hhi"   /* int8_t */
+#define        SCNi16          "hi"    /* int16_t */
+#define        SCNi32          "i"     /* int32_t */
+#define        SCNi64          "li"    /* int64_t */
+#define        SCNiLEAST8      "hhi"   /* int_least8_t */
+#define        SCNiLEAST16     "hi"    /* int_least16_t */
+#define        SCNiLEAST32     "i"     /* int_least32_t */
+#define        SCNiLEAST64     "li"    /* int_least64_t */
+#define        SCNiFAST8       "i"     /* int_fast8_t */
+#define        SCNiFAST16      "i"     /* int_fast16_t */
+#define        SCNiFAST32      "i"     /* int_fast32_t */
+#define        SCNiFAST64      "li"    /* int_fast64_t */
+#define        SCNiMAX         "ji"    /* intmax_t */
+#define        SCNiPTR         "li"    /* intptr_t */
+
+/* fscanf(3) macros for unsigned integers. */
+
+#define        SCNo8           "hho"   /* uint8_t */
+#define        SCNo16          "ho"    /* uint16_t */
+#define        SCNo32          "o"     /* uint32_t */
+#define        SCNo64          "lo"    /* uint64_t */
+#define        SCNoLEAST8      "hho"   /* uint_least8_t */
+#define        SCNoLEAST16     "ho"    /* uint_least16_t */
+#define        SCNoLEAST32     "o"     /* uint_least32_t */
+#define        SCNoLEAST64     "lo"    /* uint_least64_t */
+#define        SCNoFAST8       "o"     /* uint_fast8_t */
+#define        SCNoFAST16      "o"     /* uint_fast16_t */
+#define        SCNoFAST32      "o"     /* uint_fast32_t */
+#define        SCNoFAST64      "lo"    /* uint_fast64_t */
+#define        SCNoMAX         "jo"    /* uintmax_t */
+#define        SCNoPTR         "lo"    /* uintptr_t */
+
+#define        SCNu8           "hhu"   /* uint8_t */
+#define        SCNu16          "hu"    /* uint16_t */
+#define        SCNu32          "u"     /* uint32_t */
+#define        SCNu64          "lu"    /* uint64_t */
+#define        SCNuLEAST8      "hhu"   /* uint_least8_t */
+#define        SCNuLEAST16     "hu"    /* uint_least16_t */
+#define        SCNuLEAST32     "u"     /* uint_least32_t */
+#define        SCNuLEAST64     "lu"    /* uint_least64_t */
+#define        SCNuFAST8       "u"     /* uint_fast8_t */
+#define        SCNuFAST16      "u"     /* uint_fast16_t */
+#define        SCNuFAST32      "u"     /* uint_fast32_t */
+#define        SCNuFAST64      "lu"    /* uint_fast64_t */
+#define        SCNuMAX         "ju"    /* uintmax_t */
+#define        SCNuPTR         "lu"    /* uintptr_t */
+
+#define        SCNx8           "hhx"   /* uint8_t */
+#define        SCNx16          "hx"    /* uint16_t */
+#define        SCNx32          "x"     /* uint32_t */
+#define        SCNx64          "lx"    /* uint64_t */
+#define        SCNxLEAST8      "hhx"   /* uint_least8_t */
+#define        SCNxLEAST16     "hx"    /* uint_least16_t */
+#define        SCNxLEAST32     "x"     /* uint_least32_t */
+#define        SCNxLEAST64     "lx"    /* uint_least64_t */
+#define        SCNxFAST8       "x"     /* uint_fast8_t */
+#define        SCNxFAST16      "x"     /* uint_fast16_t */
+#define        SCNxFAST32      "x"     /* uint_fast32_t */
+#define        SCNxFAST64      "lx"    /* uint_fast64_t */
+#define        SCNxMAX         "jx"    /* uintmax_t */
+#define        SCNxPTR         "lx"    /* uintptr_t */
+
+#endif /* !_MACHINE__INTTYPES_H_ */

Added: head/sys/arm64/include/_limits.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/_limits.h    Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 1988, 1993
+ *     The Regents of the University of California.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *     @(#)limits.h    8.3 (Berkeley) 1/4/94
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__LIMITS_H_
+#define        _MACHINE__LIMITS_H_
+
+/*
+ * According to ANSI (section 2.2.4.2), the values below must be usable by
+ * #if preprocessing directives.  Additionally, the expression must have the
+ * same type as would an expression that is an object of the corresponding
+ * type converted according to the integral promotions.  The subtraction for
+ * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
+ * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
+ */
+
+#define        __CHAR_BIT      8               /* number of bits in a char */
+
+#define        __SCHAR_MAX     0x7f            /* max value for a signed char 
*/
+#define        __SCHAR_MIN     (-0x7f - 1)     /* min value for a signed char 
*/
+
+#define        __UCHAR_MAX     0xff            /* max value for an unsigned 
char */
+
+#define        __USHRT_MAX     0xffff          /* max value for an unsigned 
short */
+#define        __SHRT_MAX      0x7fff          /* max value for a short */
+#define        __SHRT_MIN      (-0x7fff - 1)   /* min value for a short */
+
+#define        __UINT_MAX      0xffffffff      /* max value for an unsigned 
int */
+#define        __INT_MAX       0x7fffffff      /* max value for an int */
+#define        __INT_MIN       (-0x7fffffff - 1)       /* min value for an int 
*/
+
+#define        __ULONG_MAX     0xffffffffffffffffUL    /* max for an unsigned 
long */
+#define        __LONG_MAX      0x7fffffffffffffffL     /* max for a long */
+#define        __LONG_MIN      (-0x7fffffffffffffffL - 1) /* min for a long */
+
+/* Long longs have the same size but not the same type as longs. */
+                       /* max for an unsigned long long */
+#define        __ULLONG_MAX    0xffffffffffffffffULL
+#define        __LLONG_MAX     0x7fffffffffffffffLL    /* max for a long long 
*/
+#define        __LLONG_MIN     (-0x7fffffffffffffffLL - 1) /* min for a long 
long */
+
+#define        __SSIZE_MAX     __LONG_MAX      /* max value for a ssize_t */
+
+#define        __SIZE_T_MAX    __ULONG_MAX     /* max value for a size_t */
+
+#define        __OFF_MAX       __LONG_MAX      /* max value for an off_t */
+#define        __OFF_MIN       __LONG_MIN      /* min value for an off_t */
+
+/* Quads and longs are the same size.  Ensure they stay in sync. */
+#define        __UQUAD_MAX     (__ULONG_MAX)   /* max value for a uquad_t */
+#define        __QUAD_MAX      (__LONG_MAX)    /* max value for a quad_t */
+#define        __QUAD_MIN      (__LONG_MIN)    /* min value for a quad_t */
+
+#define        __LONG_BIT      64
+#define        __WORD_BIT      32
+
+/* Minimum signal stack size. */
+#define        __MINSIGSTKSZ   (1024 * 4)
+
+#endif /* !_MACHINE__LIMITS_H_ */

Added: head/sys/arm64/include/_stdint.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/_stdint.h    Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,158 @@
+/*-
+ * Copyright (c) 2001, 2002 Mike Barcroft <[email protected]>
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__STDINT_H_
+#define        _MACHINE__STDINT_H_
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+
+#define        INT8_C(c)               (c)
+#define        INT16_C(c)              (c)
+#define        INT32_C(c)              (c)
+#define        INT64_C(c)              (c ## L)
+
+#define        UINT8_C(c)              (c)
+#define        UINT16_C(c)             (c)
+#define        UINT32_C(c)             (c ## U)
+#define        UINT64_C(c)             (c ## UL)
+
+#define        INTMAX_C(c)             INT64_C(c)
+#define        UINTMAX_C(c)            UINT64_C(c)
+
+#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.2.1 Limits of exact-width integer types
+ */
+/* Minimum values of exact-width signed integer types. */
+#define        INT8_MIN        (-0x7f-1)
+#define        INT16_MIN       (-0x7fff-1)
+#define        INT32_MIN       (-0x7fffffff-1)
+#define        INT64_MIN       (-0x7fffffffffffffffL-1)
+
+/* Maximum values of exact-width signed integer types. */
+#define        INT8_MAX        0x7f
+#define        INT16_MAX       0x7fff
+#define        INT32_MAX       0x7fffffff
+#define        INT64_MAX       0x7fffffffffffffffL
+
+/* Maximum values of exact-width unsigned integer types. */
+#define        UINT8_MAX       0xff
+#define        UINT16_MAX      0xffff
+#define        UINT32_MAX      0xffffffffU
+#define        UINT64_MAX      0xffffffffffffffffUL
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.2.2  Limits of minimum-width integer types
+ */
+/* Minimum values of minimum-width signed integer types. */
+#define        INT_LEAST8_MIN  INT8_MIN
+#define        INT_LEAST16_MIN INT16_MIN
+#define        INT_LEAST32_MIN INT32_MIN
+#define        INT_LEAST64_MIN INT64_MIN
+
+/* Maximum values of minimum-width signed integer types. */
+#define        INT_LEAST8_MAX  INT8_MAX
+#define        INT_LEAST16_MAX INT16_MAX
+#define        INT_LEAST32_MAX INT32_MAX
+#define        INT_LEAST64_MAX INT64_MAX
+
+/* Maximum values of minimum-width unsigned integer types. */
+#define        UINT_LEAST8_MAX  UINT8_MAX
+#define        UINT_LEAST16_MAX UINT16_MAX
+#define        UINT_LEAST32_MAX UINT32_MAX
+#define        UINT_LEAST64_MAX UINT64_MAX
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.2.3  Limits of fastest minimum-width integer types
+ */
+/* Minimum values of fastest minimum-width signed integer types. */
+#define        INT_FAST8_MIN   INT32_MIN
+#define        INT_FAST16_MIN  INT32_MIN
+#define        INT_FAST32_MIN  INT32_MIN
+#define        INT_FAST64_MIN  INT64_MIN
+
+/* Maximum values of fastest minimum-width signed integer types. */
+#define        INT_FAST8_MAX   INT32_MAX
+#define        INT_FAST16_MAX  INT32_MAX
+#define        INT_FAST32_MAX  INT32_MAX
+#define        INT_FAST64_MAX  INT64_MAX
+
+/* Maximum values of fastest minimum-width unsigned integer types. */
+#define        UINT_FAST8_MAX  UINT32_MAX
+#define        UINT_FAST16_MAX UINT32_MAX
+#define        UINT_FAST32_MAX UINT32_MAX
+#define        UINT_FAST64_MAX UINT64_MAX
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.2.4  Limits of integer types capable of holding object pointers
+ */
+#define        INTPTR_MIN      INT64_MIN
+#define        INTPTR_MAX      INT64_MAX
+#define        UINTPTR_MAX     UINT64_MAX
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.2.5  Limits of greatest-width integer types
+ */
+#define        INTMAX_MIN      INT64_MIN
+#define        INTMAX_MAX      INT64_MAX
+#define        UINTMAX_MAX     UINT64_MAX
+
+/*
+ * ISO/IEC 9899:1999
+ * 7.18.3  Limits of other integer types
+ */
+/* Limits of ptrdiff_t. */
+#define        PTRDIFF_MIN     INT64_MIN       
+#define        PTRDIFF_MAX     INT64_MAX
+
+/* Limits of sig_atomic_t. */
+#define        SIG_ATOMIC_MIN  INT32_MIN
+#define        SIG_ATOMIC_MAX  INT32_MAX
+
+/* Limit of size_t. */
+#define        SIZE_MAX        UINT64_MAX
+
+/* Limits of wint_t. */
+#define        WINT_MIN        INT32_MIN
+#define        WINT_MAX        INT32_MAX
+
+#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
+
+#endif /* !_MACHINE__STDINT_H_ */

Added: head/sys/arm64/include/_types.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/_types.h     Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,114 @@
+/*-
+ * Copyright (c) 2002 Mike Barcroft <[email protected]>
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  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.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ *
+ *     From: @(#)ansi.h        8.2 (Berkeley) 1/4/94
+ *     From: @(#)types.h       8.3 (Berkeley) 1/5/94
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__TYPES_H_
+#define        _MACHINE__TYPES_H_
+
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
+/*
+ * Basic types upon which most other types are built.
+ */
+typedef        signed char             __int8_t;
+typedef        unsigned char           __uint8_t;
+typedef        short                   __int16_t;
+typedef        unsigned short          __uint16_t;
+typedef        int                     __int32_t;
+typedef        unsigned int            __uint32_t;
+typedef        long                    __int64_t;
+typedef        unsigned long           __uint64_t;
+
+/*
+ * Standard type definitions.
+ */
+typedef        __int32_t       __clock_t;              /* clock()... */
+typedef        __int64_t       __critical_t;
+typedef        double          __double_t;
+typedef        float           __float_t;
+typedef        __int64_t       __intfptr_t;
+typedef        __int64_t       __intmax_t;
+typedef        __int64_t       __intptr_t;
+typedef        __int32_t       __int_fast8_t;
+typedef        __int32_t       __int_fast16_t;
+typedef        __int32_t       __int_fast32_t;
+typedef        __int64_t       __int_fast64_t;
+typedef        __int8_t        __int_least8_t;
+typedef        __int16_t       __int_least16_t;
+typedef        __int32_t       __int_least32_t;
+typedef        __int64_t       __int_least64_t;
+typedef        __int64_t       __ptrdiff_t;            /* ptr1 - ptr2 */
+typedef        __int64_t       __register_t;
+typedef        __int64_t       __segsz_t;              /* segment size (in 
pages) */
+typedef        __uint64_t      __size_t;               /* sizeof() */
+typedef        __int64_t       __ssize_t;              /* byte count or error 
*/
+typedef        __int64_t       __time_t;               /* time()... */
+typedef        __uint64_t      __uintfptr_t;
+typedef        __uint64_t      __uintmax_t;
+typedef        __uint64_t      __uintptr_t;
+typedef        __uint32_t      __uint_fast8_t;
+typedef        __uint32_t      __uint_fast16_t;
+typedef        __uint32_t      __uint_fast32_t;
+typedef        __uint64_t      __uint_fast64_t;
+typedef        __uint8_t       __uint_least8_t;
+typedef        __uint16_t      __uint_least16_t;
+typedef        __uint32_t      __uint_least32_t;
+typedef        __uint64_t      __uint_least64_t;
+typedef        __uint64_t      __u_register_t;
+typedef        __uint64_t      __vm_offset_t;
+typedef        __int64_t       __vm_ooffset_t;
+typedef        __uint64_t      __vm_paddr_t;
+typedef        __uint64_t      __vm_pindex_t;
+typedef        __uint64_t      __vm_size_t;
+typedef        unsigned int    ___wchar_t;
+
+#define        __WCHAR_MIN     __UINT_MIN      /* min value for a wchar_t */
+#define        __WCHAR_MAX     __UINT_MAX      /* max value for a wchar_t */
+
+/*
+ * Unusual type definitions.
+ */
+#ifdef __GNUCLIKE_BUILTIN_VARARGS
+typedef __builtin_va_list      __va_list;      /* internally known to gcc */
+#else
+typedef        char *                  __va_list;
+#endif /* __GNUCLIKE_BUILTIN_VARARGS */
+#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \
+    && !defined(__NO_GNUC_VA_LIST)
+#define        __GNUC_VA_LIST
+typedef __va_list              __gnuc_va_list; /* compatibility w/GNU headers*/
+#endif
+
+#endif /* !_MACHINE__TYPES_H_ */

Added: head/sys/arm64/include/asm.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/asm.h        Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 2014 Andrew Turner
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_ASM_H_
+#define        _MACHINE_ASM_H_
+
+#undef __FBSDID
+#if !defined(lint) && !defined(STRIP_FBSDID)
+#define        __FBSDID(s)     .ident s
+#else
+#define        __FBSDID(s)     /* nothing */
+#endif
+
+#define        _C_LABEL(x)     x
+
+#define        ENTRY(sym)                                              \
+       .text; .globl sym; .align 2; sym:
+#define        EENTRY(sym)                                             \
+       .globl  sym; sym:
+#define        END(sym) .size sym, . - sym
+#define        EEND(sym)
+
+#define        WEAK_REFERENCE(sym, alias)                              \
+       .weak alias;                                            \
+       .set alias,sym
+
+#define        UINT64_C(x)     (x)
+
+#if defined(PIC)
+#define        PIC_SYM(x,y)    x ## @ ## y
+#else
+#define        PIC_SYM(x,y)    x
+#endif
+
+/*
+ * Sets the trap fault handler. The exception handler will return to the
+ * address in the handler register on a data abort or the xzr register to
+ * clear the handler. The tmp parameter should be a register able to hold
+ * the temporary data.
+ */
+#define        SET_FAULT_HANDLER(handler, tmp)                                 
\
+       ldr     tmp, [x18, #PC_CURTHREAD];      /* Load curthread */    \
+       ldr     tmp, [tmp, #TD_PCB];            /* Load the pcb */      \
+       str     handler, [tmp, #PCB_ONFAULT]    /* Set the handler */
+
+#endif /* _MACHINE_ASM_H_ */

Added: head/sys/arm64/include/atomic.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/atomic.h     Mon Mar 23 11:54:56 2015        
(r280364)
@@ -0,0 +1,574 @@
+/*-
+ * Copyright (c) 2013 Andrew Turner <[email protected]>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef        _MACHINE_ATOMIC_H_
+#define        _MACHINE_ATOMIC_H_
+
+#define        isb()  __asm __volatile("isb" : : : "memory")
+#define        dsb()  __asm __volatile("dsb sy" : : : "memory")
+#define        dmb()  __asm __volatile("dmb sy" : : : "memory")
+
+#define        mb()   dmb()
+#define        wmb()  dmb()
+#define        rmb()  dmb()
+
+static __inline void
+atomic_add_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %w0, [%2]      \n"
+           "   add     %w0, %w0, %w3  \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc"
+       );
+}
+
+static __inline void
+atomic_clear_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %w0, [%2]      \n"
+           "   bic     %w0, %w0, %w3  \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc"
+       );
+}
+
+static __inline int
+atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: mov     %w1, #1        \n"
+           "   ldxr    %w0, [%2]      \n"
+           "   cmp     %w0, %w3       \n"
+           "   b.ne    2f             \n"
+           "   stxr    %w1, %w4, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           "2:"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (cmpval), "+r" (newval)
+           : : "cc"
+       );
+
+       return (!res);
+}
+
+static __inline uint32_t
+atomic_fetchadd_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp, ret;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %w4, [%2]      \n"
+           "   add     %w0, %w4, %w3  \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val), "=&r"(ret) : : "cc"
+       );
+
+       return (ret);
+}
+
+static __inline uint32_t
+atomic_readandclear_32(volatile uint32_t *p)
+{
+       uint32_t tmp, ret;
+       int res;
+
+       __asm __volatile(
+           "   mov     %w0, #0        \n"
+           "1: ldxr    %w3, [%2]      \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "=&r"(ret) : : "cc"
+       );
+
+       return (ret);
+}
+
+static __inline void
+atomic_set_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %w0, [%2]      \n"
+           "   orr     %w0, %w0, %w3  \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc"
+       );
+}
+
+static __inline void
+atomic_subtract_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %w0, [%2]      \n"
+           "   sub     %w0, %w0, %w3  \n"
+           "   stxr    %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc"
+       );
+}
+
+#define        atomic_add_int          atomic_add_32
+#define        atomic_clear_int        atomic_clear_32
+#define        atomic_cmpset_int       atomic_cmpset_32
+#define        atomic_fetchadd_int     atomic_fetchadd_32
+#define        atomic_readandclear_int atomic_readandclear_32
+#define        atomic_set_int          atomic_set_32
+#define        atomic_subtract_int     atomic_subtract_32
+
+
+static __inline void
+atomic_add_acq_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldaxr   %w0, [%2]      \n"
+           "   add     %w0, %w0, %w3  \n"
+           "   stlxr   %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           "2:"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc", "memory"
+       );
+}
+
+static __inline void
+atomic_clear_acq_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldaxr   %w0, [%2]      \n"
+           "   bic     %w0, %w0, %w3  \n"
+           "   stlxr   %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc", "memory"
+       );
+}
+
+static __inline int
+atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: mov     %w1, #1        \n"
+           "   ldaxr   %w0, [%2]      \n"
+           "   cmp     %w0, %w3       \n"
+           "   b.ne    2f             \n"
+           "   stlxr   %w1, %w4, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           "2:"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (cmpval), "+r" (newval)
+           : : "cc", "memory"
+       );
+
+       return (!res);
+}
+
+static __inline uint32_t
+atomic_load_acq_32(volatile uint32_t *p)
+{
+       uint32_t ret;
+
+       ret = *p;
+       dmb();
+
+       return (ret);
+}
+
+static __inline void
+atomic_set_acq_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldaxr   %w0, [%2]      \n"
+           "   orr     %w0, %w0, %w3  \n"
+           "   stlxr   %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc", "memory"
+       );
+}
+
+static __inline void
+atomic_subtract_acq_32(volatile uint32_t *p, uint32_t val)
+{
+       uint32_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldaxr   %w0, [%2]      \n"
+           "   sub     %w0, %w0, %w3  \n"
+           "   stlxr   %w1, %w0, [%2] \n"
+            "   cbnz   %w1, 1b        \n"
+           : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc", "memory"
+       );
+}
+
+static __inline void
+atomic_store_rel_32(volatile uint32_t *p, uint32_t val)
+{
+
+       dmb();
+       *p = val;
+}
+
+#define        atomic_add_acq_int      atomic_add_acq_32
+#define        atomic_clear_acq_int    atomic_add_acq_32
+#define        atomic_cmpset_acq_int   atomic_cmpset_acq_32
+#define        atomic_load_acq_int     atomic_load_acq_32
+#define        atomic_set_acq_int      atomic_set_acq_32
+#define        atomic_subtract_acq_int atomic_subtract_acq_32
+
+/* The atomic functions currently are both acq and rel, we should fix this. */
+#define        atomic_add_rel_32       atomic_add_acq_32
+#define        atomic_clear_rel_32     atomic_add_acq_32
+#define        atomic_cmpset_rel_32    atomic_cmpset_acq_32
+#define        atomic_set_rel_32       atomic_set_acq_32
+#define        atomic_subtract_rel_32  atomic_subtract_acq_32
+
+#define        atomic_add_rel_int      atomic_add_rel_32
+#define        atomic_clear_rel_int    atomic_add_rel_32
+#define        atomic_cmpset_rel_int   atomic_cmpset_rel_32
+#define        atomic_set_rel_int      atomic_set_rel_32
+#define        atomic_subtract_rel_int atomic_subtract_rel_32
+#define        atomic_store_rel_int    atomic_store_rel_32
+
+
+static __inline void
+atomic_add_64(volatile uint64_t *p, uint64_t val)
+{
+       uint64_t tmp;
+       int res;
+
+       __asm __volatile(
+           "1: ldxr    %0, [%2]      \n"

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to