···11+/* $OpenBSD: DEFS.h,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+33+/*-
44+ * Copyright (c) 1990 The Regents of the University of California.
55+ * All rights reserved.
66+ *
77+ * This code is derived from software contributed to Berkeley by
88+ * William Jolitz.
99+ *
1010+ * Redistribution and use in source and binary forms, with or without
1111+ * modification, are permitted provided that the following conditions
1212+ * are met:
1313+ * 1. Redistributions of source code must retain the above copyright
1414+ * notice, this list of conditions and the following disclaimer.
1515+ * 2. Redistributions in binary form must reproduce the above copyright
1616+ * notice, this list of conditions and the following disclaimer in the
1717+ * documentation and/or other materials provided with the distribution.
1818+ * 3. Neither the name of the University nor the names of its contributors
1919+ * may be used to endorse or promote products derived from this software
2020+ * without specific prior written permission.
2121+ *
2222+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2323+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2424+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2525+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2626+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2727+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2828+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2929+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3030+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3131+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3232+ * SUCH DAMAGE.
3333+ *
3434+ * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
3535+ * $NetBSD: SYS.h,v 1.5 2002/06/03 18:30:32 fvdl Exp $
3636+ */
3737+3838+#include <machine/asm.h>
3939+4040+/*
4141+ * We define a hidden alias with the prefix "_libc_" for each global symbol
4242+ * that may be used internally. By referencing _libc_x instead of x, other
4343+ * parts of libc prevent overriding by the application and avoid unnecessary
4444+ * relocations.
4545+ */
4646+#define _HIDDEN(x) _libc_##x
4747+#define _HIDDEN_ALIAS(x,y) \
4848+ STRONG_ALIAS(_HIDDEN(x),y); \
4949+ .hidden _HIDDEN(x)
5050+#define _HIDDEN_FALIAS(x,y) \
5151+ _HIDDEN_ALIAS(x,y); \
5252+ .type _HIDDEN(x),@function
5353+5454+/*
5555+ * For functions implemented in ASM that aren't syscalls.
5656+ * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names
5757+ * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names
5858+ */
5959+#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x))
6060+#define END_WEAK(x) END_STRONG(x); .weak x
6161+
···11+/* $OpenBSD: SYS.h,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * This code is derived from software contributed to Berkeley by
99+ * William Jolitz.
1010+ *
1111+ * Redistribution and use in source and binary forms, with or without
1212+ * modification, are permitted provided that the following conditions
1313+ * are met:
1414+ * 1. Redistributions of source code must retain the above copyright
1515+ * notice, this list of conditions and the following disclaimer.
1616+ * 2. Redistributions in binary form must reproduce the above copyright
1717+ * notice, this list of conditions and the following disclaimer in the
1818+ * documentation and/or other materials provided with the distribution.
1919+ * 3. Neither the name of the University nor the names of its contributors
2020+ * may be used to endorse or promote products derived from this software
2121+ * without specific prior written permission.
2222+ *
2323+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2424+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2525+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2626+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2727+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2828+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2929+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3030+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3131+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3232+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3333+ * SUCH DAMAGE.
3434+ *
3535+ * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
3636+ */
3737+3838+#include "DEFS.h"
3939+#include <sys/syscall.h>
4040+#include <arm64/swi.h>
4141+4242+#define SYSENTRY(x) \
4343+ .weak _C_LABEL(x); \
4444+ _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x); \
4545+ ENTRY(_thread_sys_ ## x)
4646+#define SYSENTRY_HIDDEN(x) \
4747+ ENTRY(_thread_sys_ ## x)
4848+#define __END_HIDDEN(x) \
4949+ END(_thread_sys_ ## x); \
5050+ _HIDDEN_FALIAS(x, _thread_sys_ ## x); \
5151+ END(_HIDDEN(x))
5252+#define __END(x) \
5353+ __END_HIDDEN(x); END(x)
5454+5555+#define SYSTRAP(x) \
5656+ ldr x8, =SYS_ ## x; \
5757+ svc 0
5858+5959+#define CERROR _C_LABEL(__cerror)
6060+6161+#define _SYSCALL_NOERROR(x,y) \
6262+ SYSENTRY(x); \
6363+ SYSTRAP(y)
6464+#define _SYSCALL_HIDDEN_NOERROR(x,y) \
6565+ SYSENTRY_HIDDEN(x); \
6666+ SYSTRAP(y)
6767+6868+#define _SYSCALL(x, y) \
6969+ _SYSCALL_NOERROR(x,y); \
7070+ bcs CERROR
7171+#define _SYSCALL_HIDDEN(x, y) \
7272+ _SYSCALL_HIDDEN_NOERROR(x,y); \
7373+ bcs CERROR
7474+7575+#define SYSCALL_NOERROR(x) \
7676+ _SYSCALL_NOERROR(x,x)
7777+7878+#define SYSCALL(x) \
7979+ _SYSCALL(x,x)
8080+8181+8282+#define PSEUDO_NOERROR(x,y) \
8383+ _SYSCALL_NOERROR(x,y); \
8484+ ret; \
8585+ __END(x)
8686+8787+#define PSEUDO(x,y) \
8888+ _SYSCALL(x,y); \
8989+ ret; \
9090+ __END(x)
9191+#define PSEUDO_HIDDEN(x,y) \
9292+ _SYSCALL_HIDDEN(x,y); \
9393+ ret; \
9494+ __END_HIDDEN(x)
9595+9696+#define RSYSCALL_NOERROR(x) \
9797+ PSEUDO_NOERROR(x,x)
9898+9999+#define RSYSCALL(x) \
100100+ PSEUDO(x,x)
101101+#define RSYSCALL_HIDDEN(x) \
102102+ PSEUDO_HIDDEN(x,x)
103103+#define SYSCALL_END(x) \
104104+ __END(x)
105105+#define SYSCALL_END_HIDDEN(x) \
106106+ __END_HIDDEN(x)
107107+108108+ .globl CERROR
···11+/* $OpenBSD: strtold.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*-
33+ * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ */
2727+2828+/*
2929+ * Machine-dependent glue to integrate David Gay's gdtoa
3030+ * package into libc for architectures where a long double
3131+ * uses quad precision, such as sparc64.
3232+ */
3333+3434+#include <float.h>
3535+3636+#include "gdtoaimp.h"
3737+3838+long double
3939+strtold(const char * __restrict s, char ** __restrict sp)
4040+{
4141+ long double result;
4242+4343+ strtorQ(s, sp, FLT_ROUNDS, &result);
4444+ return result;
4545+}
4646+DEF_STRONG(strtold);
···11+/* $OpenBSD: _setjmp.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*-
33+ * Copyright (c) 2014 Andrew Turner
44+ * Copyright (c) 2014 The FreeBSD Foundation
55+ * All rights reserved.
66+ *
77+ * Portions of this software were developed by Andrew Turner
88+ * under sponsorship from the FreeBSD Foundation
99+ *
1010+ * Redistribution and use in source and binary forms, with or without
1111+ * modification, are permitted provided that the following conditions
1212+ * are met:
1313+ * 1. Redistributions of source code must retain the above copyright
1414+ * notice, this list of conditions and the following disclaimer.
1515+ * 2. Redistributions in binary form must reproduce the above copyright
1616+ * notice, this list of conditions and the following disclaimer in the
1717+ * documentation and/or other materials provided with the distribution.
1818+ *
1919+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2020+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2121+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2222+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2323+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2424+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2525+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2727+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2828+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2929+ * SUCH DAMAGE.
3030+ *
3131+ */
3232+3333+#include "DEFS.h"
3434+#include <machine/setjmp.h>
3535+3636+ENTRY(_setjmp)
3737+ /* Store the magic value and stack pointer */
3838+ ldr x8, .Lmagic
3939+ mov x9, sp
4040+ stp x8, x9, [x0], #16
4141+4242+ /* Store the general purpose registers and lr */
4343+ stp x19, x20, [x0], #16
4444+ stp x21, x22, [x0], #16
4545+ stp x23, x24, [x0], #16
4646+ stp x25, x26, [x0], #16
4747+ stp x27, x28, [x0], #16
4848+ stp x29, x30, [x0], #16
4949+5050+#ifndef _STANDALONE
5151+ /* Store the vfp registers */
5252+ stp d8, d9, [x0], #16
5353+ stp d10, d11, [x0], #16
5454+ stp d12, d13, [x0], #16
5555+ stp d14, d15, [x0]
5656+#endif
5757+5858+ /* Return value */
5959+ mov x0, #0
6060+ ret
6161+ .align 3
6262+.Lmagic:
6363+ .quad _JB_MAGIC__SETJMP
6464+END_STRONG(_setjmp)
6565+6666+ENTRY(_longjmp)
6767+ /* Check the magic value */
6868+ ldr x8, [x0], #8
6969+ ldr x9, .Lmagic
7070+ cmp x8, x9
7171+ b.ne botch
7272+7373+ /* Restore the stack pointer */
7474+ ldr x8, [x0], #8
7575+ mov sp, x8
7676+7777+ /* Restore the general purpose registers and lr */
7878+ ldp x19, x20, [x0], #16
7979+ ldp x21, x22, [x0], #16
8080+ ldp x23, x24, [x0], #16
8181+ ldp x25, x26, [x0], #16
8282+ ldp x27, x28, [x0], #16
8383+ ldp x29, x30, [x0], #16
8484+8585+#ifndef _STANDALONE
8686+ /* Restore the vfp registers */
8787+ ldp d8, d9, [x0], #16
8888+ ldp d10, d11, [x0], #16
8989+ ldp d12, d13, [x0], #16
9090+ ldp d14, d15, [x0]
9191+#endif
9292+9393+ /* Load the return value */
9494+ mov x0, x1
9595+ ret
9696+9797+botch:
9898+ bl _HIDDEN(abort)
9999+END_STRONG(_longjmp)
+42
lib/libc/arch/aarch64/gen/byte_swap_2.S
···11+/* $OpenBSD: byte_swap_2.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: byte_swap_2.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */
33+44+/*-
55+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
66+ * All rights reserved.
77+ *
88+ * This code is derived from software contributed to The NetBSD Foundation
99+ * by Charles M. Hannum.
1010+ *
1111+ * Redistribution and use in source and binary forms, with or without
1212+ * modification, are permitted provided that the following conditions
1313+ * are met:
1414+ * 1. Redistributions of source code must retain the above copyright
1515+ * notice, this list of conditions and the following disclaimer.
1616+ * 2. Redistributions in binary form must reproduce the above copyright
1717+ * notice, this list of conditions and the following disclaimer in the
1818+ * documentation and/or other materials provided with the distribution.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2121+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2222+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2323+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2424+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2525+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2626+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2727+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2828+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2929+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3030+ * POSSIBILITY OF SUCH DAMAGE.
3131+ */
3232+3333+#include <machine/asm.h>
3434+3535+_ENTRY(_C_LABEL(__bswap16))
3636+_ENTRY(_C_LABEL(ntohs))
3737+_ENTRY(_C_LABEL(htons))
3838+_PROF_PROLOGUE
3939+ and w8, w0, #0xffff
4040+ ubfx w0, w0, #8, #8
4141+ bfi w0, w8, #8, #16
4242+ ret
+40
lib/libc/arch/aarch64/gen/byte_swap_4.S
···11+/* $OpenBSD: byte_swap_4.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: byte_swap_4.S,v 1.2 2003/04/05 23:08:51 bjh21 Exp $ */
33+44+/*-
55+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
66+ * All rights reserved.
77+ *
88+ * This code is derived from software contributed to The NetBSD Foundation
99+ * by Neil A. Carson
1010+ *
1111+ * Redistribution and use in source and binary forms, with or without
1212+ * modification, are permitted provided that the following conditions
1313+ * are met:
1414+ * 1. Redistributions of source code must retain the above copyright
1515+ * notice, this list of conditions and the following disclaimer.
1616+ * 2. Redistributions in binary form must reproduce the above copyright
1717+ * notice, this list of conditions and the following disclaimer in the
1818+ * documentation and/or other materials provided with the distribution.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2121+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2222+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2323+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2424+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2525+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2626+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2727+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2828+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2929+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3030+ * POSSIBILITY OF SUCH DAMAGE.
3131+ */
3232+3333+#include <machine/asm.h>
3434+3535+_ENTRY(_C_LABEL(__bswap32))
3636+_ENTRY(_C_LABEL(ntohl))
3737+_ENTRY(_C_LABEL(htonl))
3838+_PROF_PROLOGUE
3939+ rev w0, w0
4040+ ret
···11+/* $OpenBSD: fabs.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+/*
2323+ * fabs(d) returns the absolute value of d.
2424+ */
2525+double
2626+fabs(double d)
2727+{
2828+ struct ieee_double *p = (struct ieee_double *)&d;
2929+3030+ p->dbl_sign = 0;
3131+3232+ return(d);
3333+}
3434+3535+__strong_alias(fabsl, fabs);
+77
lib/libc/arch/aarch64/gen/flt_rounds.c
···11+/* $OpenBSD: flt_rounds.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: flt_rounds.c,v 1.1 2000/12/29 20:13:48 bjh21 Exp $ */
33+44+/*
55+ * Copyright (c) 1996 Mark Brinicombe
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. All advertising materials mentioning features or use of this software
1717+ * must display the following acknowledgement:
1818+ * This product includes software developed by Mark Brinicombe
1919+ * for the NetBSD Project.
2020+ * 4. The name of the author may not be used to endorse or promote products
2121+ * derived from this software without specific prior written permission
2222+ *
2323+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2424+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2525+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2626+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2727+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2828+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2929+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3030+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3131+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3232+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333+ */
3434+3535+#include <sys/types.h>
3636+#include <ieeefp.h>
3737+#include <float.h>
3838+3939+static const int map[] = {
4040+ 1, /* round to nearest */
4141+ 2, /* round to positive infinity */
4242+ 3, /* round to negative infinity */
4343+ 0 /* round to zero */
4444+};
4545+4646+/*
4747+ * Return the current FP rounding mode
4848+ *
4949+ * Returns:
5050+ * 0 - round to zero
5151+ * 1 - round to nearest
5252+ * 2 - round to postive infinity
5353+ * 3 - round to negative infinity
5454+ *
5555+ * ok all we need to do is get the current FP rounding mode
5656+ * index our map table and return the appropriate value.
5757+ *
5858+ * HOWEVER:
5959+ * The ARM FPA codes the rounding mode into the actual FP instructions
6060+ * so there is no such thing as a global rounding mode.
6161+ * The default is round to nearest if rounding is not explicitly specified.
6262+ * FP instructions generated by GCC will not explicitly specify a rounding
6363+ * mode.
6464+ *
6565+ * So the best we can do it to return the rounding mode FP instructions
6666+ * use if rounding is not specified which is round to nearest.
6767+ *
6868+ * This could change in the future with new floating point emulators or
6969+ * soft float FP libraries.
7070+ */
7171+7272+int
7373+__flt_rounds()
7474+{
7575+ return(map[fpgetround()]);
7676+}
7777+DEF_STRONG(__flt_rounds);
+45
lib/libc/arch/aarch64/gen/fpclassifyl.c
···11+/* $OpenBSD: fpclassifyl.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__fpclassifyl(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ if (p->ext_exp == 0) {
2828+ if (p->ext_frach == 0 && p->ext_frachm == 0 &&
2929+ p->ext_fraclm == 0 && p->ext_fracl == 0)
3030+ return FP_ZERO;
3131+ else
3232+ return FP_SUBNORMAL;
3333+ }
3434+3535+ if (p->ext_exp == EXT_EXP_INFNAN) {
3636+ if (p->ext_frach == 0 && p->ext_frachm == 0 &&
3737+ p->ext_fraclm == 0 && p->ext_fracl == 0)
3838+ return FP_INFINITE;
3939+ else
4040+ return FP_NAN;
4141+ }
4242+4343+ return FP_NORMAL;
4444+}
4545+DEF_STRONG(__fpclassifyl);
+48
lib/libc/arch/aarch64/gen/fpgetmask.c
···11+/* $OpenBSD: fpgetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpgetmask,fpgetmask);
3636+#endif
3737+3838+#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
3939+4040+fp_except
4141+fpgetmask(void)
4242+{
4343+ fp_except mask;
4444+4545+ __asm __volatile("mrs %x0, fpcr" : "=&r"(mask));
4646+4747+ return ((mask >> 8) & FP_X_MASK);
4848+}
+46
lib/libc/arch/aarch64/gen/fpgetround.c
···11+/* $OpenBSD: fpgetround.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpgetround,fpgetround);
3636+#endif
3737+3838+fp_rnd
3939+fpgetround(void)
4040+{
4141+ uint32_t fpscr;
4242+4343+ __asm __volatile("mrs %x0, fpcr" : "=&r"(fpscr));
4444+4545+ return ((fpscr >> 22) & 3);
4646+}
+48
lib/libc/arch/aarch64/gen/fpgetsticky.c
···11+/* $OpenBSD: fpgetsticky.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpgetsticky,fpgetsticky);
3636+#endif
3737+3838+#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
3939+4040+fp_except
4141+fpgetsticky(void)
4242+{
4343+ fp_except old;
4444+4545+ __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
4646+4747+ return (old & FP_X_MASK);
4848+}
+51
lib/libc/arch/aarch64/gen/fpsetmask.c
···11+/* $OpenBSD: fpsetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpsetmask,fpsetmask);
3636+#endif
3737+3838+#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
3939+4040+fp_except
4141+fpsetmask(fp_except mask)
4242+{
4343+ fp_except old, new;
4444+4545+ __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
4646+ mask = (mask & FP_X_MASK) << 8;
4747+ new = (old & ~(FP_X_MASK << 8)) | mask;
4848+ __asm __volatile("msr fpcr, %x0" : : "r"(new));
4949+5050+ return ((old >> 8) & FP_X_MASK);
5151+}
+49
lib/libc/arch/aarch64/gen/fpsetround.c
···11+/* $OpenBSD: fpsetround.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpsetround,fpsetround);
3636+#endif
3737+3838+fp_rnd
3939+fpsetround(fp_rnd rnd_dir)
4040+{
4141+ uint32_t old, new;
4242+4343+ __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
4444+ new = old & ~(3 << 22);
4545+ new |= rnd_dir << 22;
4646+ __asm __volatile("msr fpcr, %x0" : : "r"(new));
4747+4848+ return ((old >> 22) & 3);
4949+}
+51
lib/libc/arch/aarch64/gen/fpsetsticky.c
···11+/* $OpenBSD: fpsetsticky.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (C) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include <sys/cdefs.h>
3030+3131+#include <sys/types.h>
3232+#include <ieeefp.h>
3333+3434+#ifdef __weak_alias
3535+__weak_alias(_fpsetsticky,fpsetsticky);
3636+#endif
3737+3838+#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
3939+4040+fp_except
4141+fpsetsticky(fp_except except)
4242+{
4343+ fp_except old, new;
4444+4545+ __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
4646+ new = old & ~(FP_X_MASK);
4747+ new &= ~except;
4848+ __asm __volatile("msr fpcr, %x0" : : "r"(new));
4949+5050+ return (old & except);
5151+}
···11+/* $OpenBSD: isfinitel.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__isfinitel(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ return (p->ext_exp != EXT_EXP_INFNAN);
2828+}
+30
lib/libc/arch/aarch64/gen/isinfl.c
···11+/* $OpenBSD: isinfl.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__isinfl(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ return (p->ext_exp == EXT_EXP_INFNAN &&
2828+ p->ext_frach == 0 && p->ext_frachm == 0 &&
2929+ p->ext_fraclm == 0 && p->ext_fracl == 0);
3030+}
+30
lib/libc/arch/aarch64/gen/isnanl.c
···11+/* $OpenBSD: isnanl.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__isnanl(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ return (p->ext_exp == EXT_EXP_INFNAN &&
2828+ (p->ext_frach != 0 || p->ext_frachm != 0 ||
2929+ p->ext_fraclm != 0 || p->ext_fracl != 0));
3030+}
+28
lib/libc/arch/aarch64/gen/isnormall.c
···11+/* $OpenBSD: isnormall.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__isnormall(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ return (p->ext_exp != 0 && p->ext_exp != EXT_EXP_INFNAN);
2828+}
+14
lib/libc/arch/aarch64/gen/nan.c
···11+/* $OpenBSD: nan.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+33+/* Written by Martynas Venckus. Public Domain. */
44+55+#include <endian.h>
66+#include <math.h>
77+88+/* bytes for qNaN on an arm (IEEE single format) */
99+char __nan[] __attribute__((__aligned__(sizeof(float)))) =
1010+#if BYTE_ORDER == BIG_ENDIAN
1111+ { 0x7f, 0xc0, 0, 0 };
1212+#else /* BYTE_ORDER == BIG_ENDIAN */
1313+ { 0, 0, 0xc0, 0x7f };
1414+#endif /* BYTE_ORDER == BIG_ENDIAN */
+118
lib/libc/arch/aarch64/gen/setjmp.S
···11+/* $OpenBSD: setjmp.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*-
33+ * Copyright (c) 2014 Andrew Turner
44+ * Copyright (c) 2014 The FreeBSD Foundation
55+ * All rights reserved.
66+ *
77+ * Portions of this software were developed by Andrew Turner
88+ * under sponsorship from the FreeBSD Foundation
99+ *
1010+ * Redistribution and use in source and binary forms, with or without
1111+ * modification, are permitted provided that the following conditions
1212+ * are met:
1313+ * 1. Redistributions of source code must retain the above copyright
1414+ * notice, this list of conditions and the following disclaimer.
1515+ * 2. Redistributions in binary form must reproduce the above copyright
1616+ * notice, this list of conditions and the following disclaimer in the
1717+ * documentation and/or other materials provided with the distribution.
1818+ *
1919+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2020+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2121+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2222+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2323+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2424+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2525+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2727+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2828+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2929+ * SUCH DAMAGE.
3030+ *
3131+ */
3232+3333+#include "SYS.h"
3434+#include <machine/setjmp.h>
3535+3636+ENTRY(setjmp)
3737+ stp x0, x30, [sp, #-16]!
3838+3939+ /* Store the signal mask */
4040+ add x2, x0, #(_JB_SIGMASK * 8) /* oset */
4141+ mov x1, #0 /* set */
4242+ mov x0, #1 /* SIG_BLOCK */
4343+ SYSTRAP(sigprocmask)
4444+4545+ ldp x0, x30, [sp], #16
4646+4747+ /* Store the magic value and stack pointer */
4848+ ldr x8, .Lmagic
4949+ mov x9, sp
5050+ stp x8, x9, [x0], #16
5151+5252+ /* Store the general purpose registers and lr */
5353+ stp x19, x20, [x0], #16
5454+ stp x21, x22, [x0], #16
5555+ stp x23, x24, [x0], #16
5656+ stp x25, x26, [x0], #16
5757+ stp x27, x28, [x0], #16
5858+ stp x29, x30, [x0], #16
5959+6060+ /* Store the vfp registers */
6161+ stp d8, d9, [x0], #16
6262+ stp d10, d11, [x0], #16
6363+ stp d12, d13, [x0], #16
6464+ stp d14, d15, [x0]
6565+6666+ /* Return value */
6767+ mov x0, #0
6868+ ret
6969+7070+ .align 3
7171+.Lmagic:
7272+ .quad _JB_MAGIC_SETJMP
7373+END_STRONG(setjmp)
7474+7575+ENTRY(longjmp)
7676+ stp x0, x1, [sp, #-32]!
7777+ str x30, [sp, #24]
7878+7979+ /* Restore the signal mask */
8080+ mov x2, #0 /* oset */
8181+ add x1, x0, #(_JB_SIGMASK * 8) /* set */
8282+ mov x0, #3 /* SIG_SETMASK */
8383+ SYSTRAP(sigprocmask)
8484+8585+ ldr x30, [sp, #24]
8686+ ldp x0, x1, [sp], #32
8787+8888+ /* Check the magic value */
8989+ ldr x8, [x0], #8
9090+ ldr x9, .Lmagic
9191+ cmp x8, x9
9292+ b.ne botch
9393+9494+ /* Restore the stack pointer */
9595+ ldr x8, [x0], #8
9696+ mov sp, x8
9797+9898+ /* Restore the general purpose registers and lr */
9999+ ldp x19, x20, [x0], #16
100100+ ldp x21, x22, [x0], #16
101101+ ldp x23, x24, [x0], #16
102102+ ldp x25, x26, [x0], #16
103103+ ldp x27, x28, [x0], #16
104104+ ldp x29, x30, [x0], #16
105105+106106+ /* Restore the vfp registers */
107107+ ldp d8, d9, [x0], #16
108108+ ldp d10, d11, [x0], #16
109109+ ldp d12, d13, [x0], #16
110110+ ldp d14, d15, [x0]
111111+112112+ /* Load the return value */
113113+ mov x0, x1
114114+ ret
115115+116116+botch:
117117+ bl _HIDDEN(abort)
118118+END_STRONG(longjmp)
+28
lib/libc/arch/aarch64/gen/signbitl.c
···11+/* $OpenBSD: signbitl.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+1818+#include <sys/types.h>
1919+#include <machine/ieee.h>
2020+#include <math.h>
2121+2222+int
2323+__signbitl(long double e)
2424+{
2525+ struct ieee_ext *p = (struct ieee_ext *)&e;
2626+2727+ return p->ext_sign;
2828+}
+53
lib/libc/arch/aarch64/gen/sigsetjmp.S
···11+/* $OpenBSD: sigsetjmp.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*-
33+ * Copyright (c) 2014 The FreeBSD Foundation
44+ * All rights reserved.
55+ *
66+ * This software was developed by Andrew Turner under
77+ * sponsorship from the FreeBSD Foundation.
88+ *
99+ * Redistribution and use in source and binary forms, with or without
1010+ * modification, are permitted provided that the following conditions
1111+ * are met:
1212+ * 1. Redistributions of source code must retain the above copyright
1313+ * notice, this list of conditions and the following disclaimer.
1414+ * 2. Redistributions in binary form must reproduce the above copyright
1515+ * notice, this list of conditions and the following disclaimer in the
1616+ * documentation and/or other materials provided with the distribution.
1717+ *
1818+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1919+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2020+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2121+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2222+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2323+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2424+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2525+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2626+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2727+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2828+ * SUCH DAMAGE.
2929+ */
3030+3131+#include <machine/asm.h>
3232+3333+#include <machine/setjmp.h>
3434+3535+ENTRY(sigsetjmp)
3636+ cmp x1, #0
3737+ b.eq _C_LABEL(_setjmp)
3838+ b _C_LABEL(setjmp)
3939+//END(sigsetjmp)
4040+4141+ENTRY(siglongjmp)
4242+ /* Load the _setjmp magic */
4343+ ldr x2, .Lmagic
4444+ ldr x3, [x0]
4545+4646+ /* Check the magic */
4747+ cmp x2, x3
4848+ b.eq _C_LABEL(_longjmp)
4949+ b _C_LABEL(longjmp)
5050+.Lmagic:
5151+ .align 3
5252+ .quad _JB_MAGIC__SETJMP
5353+//END(siglongjmp)
+5
lib/libc/arch/aarch64/net/Makefile.inc
···11+# $OpenBSD: Makefile.inc,v 1.1 2017/01/11 18:09:24 patrick Exp $
22+# $NetBSD: Makefile.inc,v 1.1 2000/12/29 20:13:53 bjh21 Exp $
33+44+# hton* and nto* functions provided by ../gen/byte_swap_*.S
55+SRCS+=
···11+/* $OpenBSD: Ovfork.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: Ovfork.S,v 1.6 2003/08/07 16:42:03 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+/*
3838+ * pid = vfork();
3939+ *
4040+ * On return from the SWI:
4141+ * r1 == 0 in parent process, r1 == 1 in child process.
4242+ * r0 == pid of child in parent, r0 == pid of parent in child.
4343+ */
4444+ .text
4545+ .align 0
4646+4747+SYSENTRY_HIDDEN(vfork)
4848+ mov x2, x30
4949+ SYSTRAP(vfork)
5050+ bcs CERROR
5151+ sub x1, x1, #1 /* r1 == 0xffffffff if parent, 0 if child */
5252+ and x0, x0, x1 /* r0 == 0 if child, else unchanged */
5353+ mov x30, x2
5454+ ret
5555+SYSCALL_END_HIDDEN(vfork)
+96
lib/libc/arch/aarch64/sys/brk.S
···11+/* $OpenBSD: brk.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: brk.S,v 1.7 2003/12/26 11:23:44 martin Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)brk.s 5.2 (Berkeley) 12/17/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+ .globl _C_LABEL(end)
3838+ .globl CURBRK
3939+4040+#ifdef WEAK_ALIAS
4141+WEAK_ALIAS(brk, _brk)
4242+#endif
4343+4444+ .data
4545+ .align 0
4646+ .globl _C_LABEL(__minbrk)
4747+ .type _C_LABEL(__minbrk),#object
4848+_C_LABEL(__minbrk):
4949+ .quad _C_LABEL(end)
5050+5151+/*
5252+ * Change the data segment size
5353+ */
5454+SYSENTRY(_brk)
5555+#ifdef __PIC__
5656+ /* Setup the GOT */
5757+ adrp x3, :got:minbrk
5858+ ldr x1, [x3, #:got_lo12:minbrk]
5959+#else
6060+ ldr x1, .Lminbrk
6161+#endif
6262+ /* Get the minimum allowable brk address */
6363+ ldr x1, [x1]
6464+6565+ /*
6666+ * Valid the address specified and set to the minimum
6767+ * if the address is below minbrk.
6868+ */
6969+ cmp x0, x1
7070+ b.ge 1f
7171+ mov x0, x1
7272+1:
7373+ mov x2, x0
7474+ SYSTRAP(break)
7575+ bcs CERROR
7676+7777+#ifdef __PIC__
7878+ adrp x3, :got:minbrk
7979+ ldr x1, [x3, #:got_lo12:minbrk]
8080+#else
8181+ ldr x1, .Lcurbrk
8282+#endif
8383+ /* Store the new address in curbrk */
8484+ str x2, [x1]
8585+8686+ /* Return 0 for success */
8787+ mov x0, #0x00000000
8888+ ret
8989+9090+ .align 3
9191+#if !defined(__PIC__)
9292+.Lminbrk:
9393+ .quad _C_LABEL(__minbrk)
9494+.Lcurbrk:
9595+ .quad CURBRK
9696+#endif
+44
lib/libc/arch/aarch64/sys/cerror.S
···11+/* $OpenBSD: cerror.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*-
33+ * Copyright (c) 2014 Andrew Turner
44+ * All rights reserved.
55+ *
66+ * Redistribution and use in source and binary forms, with or without
77+ * modification, are permitted provided that the following conditions
88+ * are met:
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ *
1515+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1616+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1919+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2121+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2222+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2323+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525+ * SUCH DAMAGE.
2626+ *
2727+ */
2828+2929+#include "SYS.h"
3030+3131+_ENTRY(CERROR)
3232+ stp x0, x30, [sp,#-16]!
3333+ bl _C_LABEL(__errno)
3434+ ldp x1, x30, [sp],#16
3535+ str x1, [x0]
3636+ movn x0, #0
3737+ movn x1, #0
3838+ ret
3939+END(CERROR)
4040+4141+#if !defined(__PIC__)
4242+.Lerrno:
4343+ .word errno
4444+#endif
+86
lib/libc/arch/aarch64/sys/sbrk.S
···11+/* $OpenBSD: sbrk.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: sbrk.S,v 1.7 2003/08/07 16:42:05 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)sbrk.s 5.1 (Berkeley) 4/23/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+ .globl _C_LABEL(end)
3838+3939+#ifdef WEAK_ALIAS
4040+WEAK_ALIAS(sbrk, _sbrk)
4141+#endif
4242+4343+ .data
4444+ .align 0
4545+ .globl CURBRK
4646+ .type CURBRK,#object
4747+ .globl minbrk
4848+ .type minbrk,#object
4949+CURBRK:
5050+ .quad _C_LABEL(end)
5151+_ASM_LABEL(minbrk):
5252+ .quad _C_LABEL(end)
5353+5454+/*
5555+ * Change the data segment size
5656+ */
5757+SYSENTRY(_sbrk)
5858+#ifdef __PIC__
5959+ /* Setup the GOT */
6060+ adrp x3, :got:CURBRK
6161+ ldr x2, [x3, #:got_lo12:CURBRK]
6262+#else
6363+ ldr x2, .Lcurbrk
6464+#endif
6565+ /* Get the current brk address */
6666+ ldr x1, [x2]
6767+6868+ /* Calculate new value */
6969+ mov x3, x0
7070+ add x0, x0, x1
7171+ SYSTRAP(break)
7272+ bcs CERROR
7373+7474+ /* Store new curbrk value */
7575+ ldr x0, [x2]
7676+ add x1, x0, x3
7777+ str x1, [x2]
7878+7979+ /* Return old curbrk value */
8080+ ret
8181+8282+ .align 0
8383+#if !defined(__PIC__)
8484+.Lcurbrk:
8585+ .word CURBRK
8686+#endif
+43
lib/libc/arch/aarch64/sys/sigpending.S
···11+/* $OpenBSD: sigpending.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: sigpending.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+SYSENTRY(sigpending)
3838+ ldr w0, [x0]
3939+ SYSTRAP(sigpending)
4040+ bcs CERROR
4141+ mov x0, #0
4242+ ret
4343+SYSCALL_END(sigpending)
+53
lib/libc/arch/aarch64/sys/sigprocmask.S
···11+/* $OpenBSD: sigprocmask.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+SYSENTRY_HIDDEN(sigprocmask)
3838+ cbz x1, 2f
3939+ ldr w1, [x1]
4040+ b 2f
4141+1:
4242+ mov w0, #0x00000001
4343+ mov x1, #0x00000000
4444+2:
4545+4646+ SYSTRAP(sigprocmask)
4747+ bcs CERROR
4848+ cbz x2, 1f
4949+ str w0, [x2]
5050+1:
5151+ mov x0, #0x00000000
5252+ ret
5353+SYSCALL_END_HIDDEN(sigprocmask)
+43
lib/libc/arch/aarch64/sys/sigsuspend.S
···11+/* $OpenBSD: sigsuspend.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: sigsuspend.S,v 1.6 2003/08/07 16:42:05 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+SYSENTRY_HIDDEN(sigsuspend)
3838+ ldr w0, [x0]
3939+ SYSTRAP(sigsuspend)
4040+ bcs CERROR
4141+ mov x0, #0
4242+ ret
4343+SYSCALL_END_HIDDEN(sigsuspend)
+37
lib/libc/arch/aarch64/sys/syscall.S
···11+/* $OpenBSD: syscall.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/* $NetBSD: syscall.S,v 1.4 2003/08/07 16:42:05 agc Exp $ */
33+44+/*-
55+ * Copyright (c) 1990 The Regents of the University of California.
66+ * All rights reserved.
77+ *
88+ * Redistribution and use in source and binary forms, with or without
99+ * modification, are permitted provided that the following conditions
1010+ * are met:
1111+ * 1. Redistributions of source code must retain the above copyright
1212+ * notice, this list of conditions and the following disclaimer.
1313+ * 2. Redistributions in binary form must reproduce the above copyright
1414+ * notice, this list of conditions and the following disclaimer in the
1515+ * documentation and/or other materials provided with the distribution.
1616+ * 3. Neither the name of the University nor the names of its contributors
1717+ * may be used to endorse or promote products derived from this software
1818+ * without specific prior written permission.
1919+ *
2020+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2121+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2222+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2424+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2525+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2727+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2828+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2929+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3030+ * SUCH DAMAGE.
3131+ *
3232+ * from: @(#)syscall.s 5.1 (Berkeley) 4/23/90
3333+ */
3434+3535+#include "SYS.h"
3636+3737+RSYSCALL(syscall)
+39
lib/libc/arch/aarch64/sys/tfork_thread.S
···11+/* $OpenBSD: tfork_thread.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
22+/*
33+ * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ */
1717+#include <sys/syscall.h>
1818+#include <machine/asm.h>
1919+#include "SYS.h"
2020+2121+/*
2222+ * r0 r1 r2 r3
2323+ * __tfork_thread(param, psize, start_fnc, start_arg);
2424+ */
2525+2626+ENTRY(__tfork_thread)
2727+ SYSTRAP(__tfork)
2828+ bcs CERROR
2929+3030+ /* check if we are parent or child */
3131+ cbz x1, 1f
3232+ ret
3333+3434+1:
3535+ /* child */
3636+ mov x0, x3
3737+ blr x2
3838+ SYSTRAP(__threxit)
3939+END(__tfork_thread)