summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2015-03-19 13:53:47 +0000
committerandrew <andrew@FreeBSD.org>2015-03-19 13:53:47 +0000
commit0c72282747e49fc0753ced46a2a4cd43aea47717 (patch)
treea985d3c5d75467caa5308f28df85fb64dbe133b4
parentab82d6c5f8b333c56da5c09c5bb1d0caedd858d5 (diff)
downloadFreeBSD-src-0c72282747e49fc0753ced46a2a4cd43aea47717.zip
FreeBSD-src-0c72282747e49fc0753ced46a2a4cd43aea47717.tar.gz
Start to import support for the AArch64 architecture from ARM. This change
only adds support for kernel-toolchain, however it is expected further changes to add kernel and userland support will be committed as they are reviewed. As our copy of binutils is too old the devel/aarch64-binutils port needs to be installed to pull in a linker. To build either TARGET needs to be set to arm64, or TARGET_ARCH set to aarch64. The latter is set so uname -p will return aarch64 as existing third party software expects this. Differential Revision: https://reviews.freebsd.org/D2005 Relnotes: Yes Sponsored by: The FreeBSD Foundation
-rw-r--r--Makefile4
-rw-r--r--Makefile.inc12
-rw-r--r--etc/etc.aarch64/ttys49
-rw-r--r--lib/csu/aarch64/Makefile44
-rw-r--r--lib/csu/aarch64/crt1.c89
-rw-r--r--lib/csu/aarch64/crti.S48
-rw-r--r--lib/csu/aarch64/crtn.S44
-rw-r--r--lib/libc/aarch64/Makefile.inc5
-rw-r--r--lib/libthr/arch/aarch64/Makefile.inc2
-rw-r--r--lib/msun/aarch64/Makefile.inc4
-rw-r--r--lib/msun/aarch64/fenv.h245
-rw-r--r--share/mk/bsd.endian.mk3
-rw-r--r--share/mk/src.opts.mk7
13 files changed, 540 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index e89a5b1..ee0772d 100644
--- a/Makefile
+++ b/Makefile
@@ -165,10 +165,10 @@ _MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=$
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
-_TARGET_ARCH= ${TARGET:S/pc98/i386/}
+_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/}
+_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/aarch64/arm64/}
.endif
.if defined(TARGET) && !defined(_TARGET)
_TARGET=${TARGET}
diff --git a/Makefile.inc1 b/Makefile.inc1
index 1be3920..22d9a01 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -149,7 +149,7 @@ SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
.endif
-KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
+KNOWN_ARCHES?= aarch64/arm64 amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else
diff --git a/etc/etc.aarch64/ttys b/etc/etc.aarch64/ttys
new file mode 100644
index 0000000..b6fd9ed
--- /dev/null
+++ b/etc/etc.aarch64/ttys
@@ -0,0 +1,49 @@
+#
+# $FreeBSD$
+# @(#)ttys 5.1 (Berkeley) 4/17/89
+#
+# This file specifies various information about terminals on the system.
+# It is used by several different programs. Common entries for the
+# various columns include:
+#
+# name The name of the terminal device.
+#
+# getty The program to start running on the terminal. Typically a
+# getty program, as the name implies. Other common entries
+# include none, when no getty is needed, and xdm, to start the
+# X Window System.
+#
+# type The initial terminal type for this port. For hardwired
+# terminal lines, this will contain the type of terminal used.
+# For virtual consoles, the correct type is typically xterm.
+# Other common values include dialup for incoming modem ports, and
+# unknown when the terminal type cannot be predetermined.
+#
+# status Must be on or off. If on, init will run the getty program on
+# the specified port. If the word "secure" appears, this tty
+# allows root login.
+#
+# name getty type status comments
+#
+# If console is marked "insecure", then init will ask for the root password
+# when going to single-user mode.
+console none unknown off secure
+#
+ttyv0 "/usr/libexec/getty Pc" xterm off secure
+# Virtual terminals
+ttyv1 "/usr/libexec/getty Pc" xterm off secure
+ttyv2 "/usr/libexec/getty Pc" xterm off secure
+ttyv3 "/usr/libexec/getty Pc" xterm off secure
+ttyv4 "/usr/libexec/getty Pc" xterm off secure
+ttyv5 "/usr/libexec/getty Pc" xterm off secure
+ttyv6 "/usr/libexec/getty Pc" xterm off secure
+ttyv7 "/usr/libexec/getty Pc" xterm off secure
+#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
+# Serial terminals
+# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
+ttyu0 "/usr/libexec/getty std.9600" vt100 on secure
+ttyu1 "/usr/libexec/getty std.9600" dialup off secure
+ttyu2 "/usr/libexec/getty std.9600" dialup off secure
+ttyu3 "/usr/libexec/getty std.9600" dialup off secure
+# Dumb console
+dcons "/usr/libexec/getty std.9600" vt100 off secure
diff --git a/lib/csu/aarch64/Makefile b/lib/csu/aarch64/Makefile
new file mode 100644
index 0000000..bf4c7b1
--- /dev/null
+++ b/lib/csu/aarch64/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../common
+
+SRCS= crt1.c crti.S crtn.S
+OBJS= ${SRCS:N*.h:R:S/$/.o/g}
+OBJS+= Scrt1.o gcrt1.o
+CFLAGS+= -I${.CURDIR}/../common \
+ -I${.CURDIR}/../../libc/include
+
+all: ${OBJS}
+
+CLEANFILES= ${OBJS}
+CLEANFILES+= crt1.s gcrt1.s Scrt1.s
+
+# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
+# directly compiled to .o files.
+
+crt1.s: crt1.c
+ ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
+ sed ${SED_FIX_NOTE} ${.TARGET}
+
+crt1.o: crt1.s
+ ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s
+
+gcrt1.s: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
+ sed ${SED_FIX_NOTE} ${.TARGET}
+
+gcrt1.o: gcrt1.s
+ ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
+
+Scrt1.s: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
+ sed ${SED_FIX_NOTE} ${.TARGET}
+
+Scrt1.o: Scrt1.s
+ ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
+
+realinstall:
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
+.include <bsd.lib.mk>
diff --git a/lib/csu/aarch64/crt1.c b/lib/csu/aarch64/crt1.c
new file mode 100644
index 0000000..6518e8d
--- /dev/null
+++ b/lib/csu/aarch64/crt1.c
@@ -0,0 +1,89 @@
+/* LINTLIBRARY */
+/*-
+ * Copyright 1996-1998 John D. Polstra.
+ * Copyright 2014 Andrew Turner.
+ * Copyright 2014-2015 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 ``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 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#ifndef __GNUC__
+#error "GCC is needed to compile this file"
+#endif
+#endif /* lint */
+
+#include <stdlib.h>
+
+#include "libc_private.h"
+#include "crtbrand.c"
+#include "ignore_init.c"
+
+#ifdef GCRT
+extern void _mcleanup(void);
+extern void monstartup(void *, void *);
+extern int eprol;
+extern int etext;
+#endif
+
+void __start(int, char **, char **, void (*)(void));
+
+/* The entry function. */
+__asm(" .text \n"
+" .align 0 \n"
+" .globl _start \n"
+" _start: \n"
+" mov x3, x2 \n" /* cleanup */
+" ldr x0, [sp] \n" /* Load argc */
+" add x1, sp, #8 \n" /* load argv */
+" add x2, x1, x0, lsl #3 \n" /* env is after argv */
+" add x2, x2, #8 \n" /* argv is null terminated */
+" b __start ");
+
+
+/* The entry function. */
+void
+__start(int argc, char *argv[], char *env[], void (*cleanup)(void))
+{
+
+ handle_argv(argc, argv, env);
+
+ if (&_DYNAMIC != NULL)
+ atexit(cleanup);
+ else
+ _init_tls();
+
+#ifdef GCRT
+ atexit(_mcleanup);
+ monstartup(&eprol, &etext);
+__asm__("eprol:");
+#endif
+
+ handle_static_init(argc, argv, env);
+ exit(main(argc, argv, env));
+}
diff --git a/lib/csu/aarch64/crti.S b/lib/csu/aarch64/crti.S
new file mode 100644
index 0000000..13e3b74
--- /dev/null
+++ b/lib/csu/aarch64/crti.S
@@ -0,0 +1,48 @@
+/*-
+ * Copyright 2001 David E. O'Brien
+ * Copyright 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 ``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 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>
+__FBSDID("$FreeBSD$");
+
+ .section .init,"ax",@progbits
+ .align 4
+ .globl _init
+ .type _init,@function
+_init:
+ sub sp, sp, #16
+ str lr, [sp]
+
+ .section .fini,"ax",@progbits
+ .align 4
+ .globl _fini
+ .type _fini,@function
+_fini:
+ sub sp, sp, #16
+ str lr, [sp]
+
diff --git a/lib/csu/aarch64/crtn.S b/lib/csu/aarch64/crtn.S
new file mode 100644
index 0000000..ebb59b7
--- /dev/null
+++ b/lib/csu/aarch64/crtn.S
@@ -0,0 +1,44 @@
+/*-
+ * Copyright 2001 David E. O'Brien
+ * Copyright 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 ``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 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>
+__FBSDID("$FreeBSD$");
+
+ .section .init,"ax",@progbits
+ ldr lr, [sp]
+ add sp, sp, #16
+ ret
+
+
+ .section .fini,"ax",@progbits
+ ldr lr, [sp]
+ add sp, sp, #16
+ ret
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/aarch64/Makefile.inc b/lib/libc/aarch64/Makefile.inc
new file mode 100644
index 0000000..8cbf181
--- /dev/null
+++ b/lib/libc/aarch64/Makefile.inc
@@ -0,0 +1,5 @@
+# $FreeBSD$
+#
+# Machine dependent definitions for the arm 64-bit architecture.
+#
+
diff --git a/lib/libthr/arch/aarch64/Makefile.inc b/lib/libthr/arch/aarch64/Makefile.inc
new file mode 100644
index 0000000..b720e3d
--- /dev/null
+++ b/lib/libthr/arch/aarch64/Makefile.inc
@@ -0,0 +1,2 @@
+# $FreeBSD$
+
diff --git a/lib/msun/aarch64/Makefile.inc b/lib/msun/aarch64/Makefile.inc
new file mode 100644
index 0000000..286a608
--- /dev/null
+++ b/lib/msun/aarch64/Makefile.inc
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+LDBL_PREC = 113
+
diff --git a/lib/msun/aarch64/fenv.h b/lib/msun/aarch64/fenv.h
new file mode 100644
index 0000000..077e525
--- /dev/null
+++ b/lib/msun/aarch64/fenv.h
@@ -0,0 +1,245 @@
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
+ * 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 _FENV_H_
+#define _FENV_H_
+
+#include <sys/_types.h>
+
+#ifndef __fenv_static
+#define __fenv_static static
+#endif
+
+typedef __uint64_t fenv_t;
+typedef __uint64_t fexcept_t;
+
+/* Exception flags */
+#define FE_INVALID 0x00000001
+#define FE_DIVBYZERO 0x00000002
+#define FE_OVERFLOW 0x00000004
+#define FE_UNDERFLOW 0x00000008
+#define FE_INEXACT 0x00000010
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
+ FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/*
+ * Rounding modes
+ *
+ * We can't just use the hardware bit values here, because that would
+ * make FE_UPWARD and FE_DOWNWARD negative, which is not allowed.
+ */
+#define FE_TONEAREST 0x0
+#define FE_UPWARD 0x1
+#define FE_DOWNWARD 0x2
+#define FE_TOWARDZERO 0x3
+#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
+ FE_UPWARD | FE_TOWARDZERO)
+#define _ROUND_SHIFT 22
+
+__BEGIN_DECLS
+
+/* Default floating-point environment */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
+
+/* We need to be able to map status flag positions to mask flag positions */
+#define _FPUSW_SHIFT 8
+#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
+
+#define __mrs_fpcr(__r) __asm __volatile("mrs %0, fpcr" : : "r" (__r))
+#define __msr_fpcr(__r) __asm __volatile("msr fpcr, %0" : "=r" (*(__r)))
+
+#define __mrs_fpsr(__r) __asm __volatile("mrs %0, fpsr" : : "r" (__r))
+#define __msr_fpsr(__r) __asm __volatile("msr fpsr, %0" : "=r" (*(__r)))
+
+__fenv_static __inline int
+feclearexcept(int __excepts)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ __r &= ~__excepts;
+ __msr_fpsr(__r);
+ return (0);
+}
+
+__fenv_static inline int
+fegetexceptflag(fexcept_t *__flagp, int __excepts)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ *__flagp = __r & __excepts;
+ return (0);
+}
+
+__fenv_static inline int
+fesetexceptflag(const fexcept_t *__flagp, int __excepts)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ __r &= ~__excepts;
+ __r |= *__flagp & __excepts;
+ __msr_fpsr(__r);
+ return (0);
+}
+
+__fenv_static inline int
+feraiseexcept(int __excepts)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ __r |= __excepts;
+ __msr_fpsr(__r);
+ return (0);
+}
+
+__fenv_static inline int
+fetestexcept(int __excepts)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ return (__r & __excepts);
+}
+
+__fenv_static inline int
+fegetround(void)
+{
+ fenv_t __r;
+
+ __mrs_fpcr(&__r);
+ return ((__r >> _ROUND_SHIFT) & _ROUND_MASK);
+}
+
+__fenv_static inline int
+fesetround(int __round)
+{
+ fenv_t __r;
+
+ if (__round & ~_ROUND_MASK)
+ return (-1);
+ __mrs_fpcr(&__r);
+ __r &= ~(_ROUND_MASK << _ROUND_SHIFT);
+ __r |= __round << _ROUND_SHIFT;
+ __msr_fpcr(__r);
+ return (0);
+}
+
+__fenv_static inline int
+fegetenv(fenv_t *__envp)
+{
+
+ __mrs_fpcr(&__r);
+ *__envp = __r & _ENABLE_MASK;
+
+ __mrs_fpsr(&__r);
+ *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT));
+
+ return (0);
+}
+
+__fenv_static inline int
+feholdexcept(fenv_t *__envp)
+{
+ fenv_t __r;
+
+ __mrs_fpcr(&__r);
+ *__envp = __r & _ENABLE_MASK;
+ __r &= ~(_ENABLE_MASK);
+ __msr_fpcr(__r);
+
+ __mrs_fpsr(&__r);
+ *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT));
+ r &= ~(_ENABLE_MASK);
+ __msr_fpsr(__r);
+ return (0);
+}
+
+__fenv_static inline int
+fesetenv(const fenv_t *__envp)
+{
+
+ __msr_fpcr((*__envp) & _ENABLE_MASK);
+ __msr_fpsr((*__envp) & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT));
+ return (0);
+}
+
+__fenv_static inline int
+feupdateenv(const fenv_t *__envp)
+{
+ fexcept_t __r;
+
+ __mrs_fpsr(&__r);
+ fesetenv(__envp);
+ feraiseexcept(__r & FE_ALL_EXCEPT);
+ return (0);
+}
+
+#if __BSD_VISIBLE
+
+/* We currently provide no external definitions of the functions below. */
+
+static inline int
+feenableexcept(int __mask)
+{
+ fenv_t __old_r, __new_r;
+
+ __mrs_fpcr(&__old_r);
+ __new_r = __old_r | ((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
+ __msr_fpcr(__new_r);
+ return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static inline int
+fedisableexcept(int __mask)
+{
+ fenv_t __old_r, __new_r;
+
+ __mrs_fpcr(&__old_r);
+ __new_r = __old_r & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
+ __msr_fpcr(__new_r);
+ return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static inline int
+fegetexcept(void)
+{
+ fenv_t __r;
+
+ __mrs_fpcr(&__r);
+ return ((__r & _ENABLE_MASK) >> _FPUSW_SHIFT);
+}
+
+#endif /* __BSD_VISIBLE */
+
+__END_DECLS
+
+#endif /* !_FENV_H_ */
diff --git a/share/mk/bsd.endian.mk b/share/mk/bsd.endian.mk
index c82c37f..2d1a53e 100644
--- a/share/mk/bsd.endian.mk
+++ b/share/mk/bsd.endian.mk
@@ -1,6 +1,7 @@
# $FreeBSD$
-.if ${MACHINE_ARCH} == "amd64" || \
+.if ${MACHINE_ARCH} == "aarch64" || \
+ ${MACHINE_ARCH} == "amd64" || \
${MACHINE_ARCH} == "i386" || \
(${MACHINE} == "arm" && ${MACHINE_ARCH:Marm*eb*} == "") || \
${MACHINE_ARCH:Mmips*el} != ""
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index fca992b..b6ea715 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -215,8 +215,8 @@ __TT=${MACHINE}
# If the compiler is not C++11 capable, disable clang and use gcc instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
-.elif ${__T} == "amd64" || ${__T} == "i386"
-# On x86, clang is enabled, and will be installed as the default cc.
+.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
+# On x86 and arm64, clang is enabled, and will be installed as the default cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
@@ -233,6 +233,9 @@ __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.endif
+.if ${__T} == "aarch64"
+BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB
+.endif
.include <bsd.mkopt.mk>
OpenPOWER on IntegriCloud