summaryrefslogtreecommitdiffstats
path: root/lib/libc/mips/gen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/mips/gen')
-rw-r--r--lib/libc/mips/gen/Makefile.inc11
-rw-r--r--lib/libc/mips/gen/_ctx_start.S41
-rw-r--r--lib/libc/mips/gen/_set_tp.c39
-rw-r--r--lib/libc/mips/gen/_setjmp.S201
-rw-r--r--lib/libc/mips/gen/fabs.S58
-rw-r--r--lib/libc/mips/gen/fabs.c46
-rw-r--r--lib/libc/mips/gen/flt_rounds.c30
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetmask.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetround.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetsticky.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetmask.c38
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetround.c37
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetsticky.c38
-rw-r--r--lib/libc/mips/gen/infinity.c26
-rw-r--r--lib/libc/mips/gen/ldexp.S219
-rw-r--r--lib/libc/mips/gen/longjmp.c103
-rw-r--r--lib/libc/mips/gen/makecontext.c123
-rw-r--r--lib/libc/mips/gen/setjmp.S238
-rw-r--r--lib/libc/mips/gen/signalcontext.c53
-rw-r--r--lib/libc/mips/gen/sigsetjmp.S77
20 files changed, 1465 insertions, 0 deletions
diff --git a/lib/libc/mips/gen/Makefile.inc b/lib/libc/mips/gen/Makefile.inc
new file mode 100644
index 0000000..a186fda
--- /dev/null
+++ b/lib/libc/mips/gen/Makefile.inc
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile.inc,v 1.27 2005/10/07 17:16:40 tsutsui Exp $
+# $FreeBSD$
+
+SRCS+= infinity.c fabs.c ldexp.c
+
+# SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
+# fpsetround.c fpsetsticky.c
+
+SRCS+= _ctx_start.S _set_tp.c _setjmp.S makecontext.c \
+ setjmp.S signalcontext.c sigsetjmp.S \
+ trivial-getcontextx.c
diff --git a/lib/libc/mips/gen/_ctx_start.S b/lib/libc/mips/gen/_ctx_start.S
new file mode 100644
index 0000000..5d754a9
--- /dev/null
+++ b/lib/libc/mips/gen/_ctx_start.S
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett.
+ * 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * XXX gp?
+ */
+ENTRY(_ctx_start)
+ jalr t9
+
+ move a0, s0
+ PTR_LA t9, _ctx_done
+ jalr t9
+
+ break 0
+END(_ctx_start)
diff --git a/lib/libc/mips/gen/_set_tp.c b/lib/libc/mips/gen/_set_tp.c
new file mode 100644
index 0000000..0bf04b52
--- /dev/null
+++ b/lib/libc/mips/gen/_set_tp.c
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2004 Doug Rabson
+ * 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$
+ */
+
+#include <string.h>
+#include <stdint.h>
+
+#include <machine/sysarch.h>
+
+void
+_set_tp(void *tp)
+{
+
+ sysarch(MIPS_SET_TLS, tp);
+}
diff --git a/lib/libc/mips/gen/_setjmp.S b/lib/libc/mips/gen/_setjmp.S
new file mode 100644
index 0000000..0f7a75a
--- /dev/null
+++ b/lib/libc/mips/gen/_setjmp.S
@@ -0,0 +1,201 @@
+/* $NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+#include <machine/regnum.h>
+
+#include "SYS.h"
+
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+ RCSID("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
+#else
+ RCSID("$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $")
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * C library -- _setjmp, _longjmp
+ *
+ * _longjmp(a,v)
+ * will generate a "return(v)" from
+ * the last call to
+ * _setjmp(a)
+ * by restoring registers from the stack,
+ * The previous signal state is NOT restored.
+ */
+
+ .set noreorder
+
+LEAF(_setjmp)
+ REG_PROLOGUE
+ REG_LI v0, _JB_MAGIC__SETJMP # sigcontext magic number
+ REG_S v0, (_JB_MAGIC * SZREG)(a0)
+ REG_S ra, (_JB_REG_RA * SZREG)(a0)
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * Registers s0..s7 are callee-saved.
+ * The sp register is callee-saved.
+ * The fp (or s8) register is callee-saved.
+ * The gp register is callee-saved (for n32/n64).
+ */
+ REG_S s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_S s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_S s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_S s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_S s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_S s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_S s6, (_JB_REG_S6 * SZREG)(a0)
+ REG_S s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_S sp, (_JB_REG_SP * SZREG)(a0)
+ REG_S s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+ REG_S gp, (_JB_REG_GP * SZREG)(a0) # newabi gp is callee-saved
+#endif
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
+ * In N64, FP registers F24 .. F31 are callee-saved.
+ * In O32, FP registers F20 .. F23 are callee-saved.
+ */
+#ifndef SOFTFLOAT
+ cfc1 v0, $31 # too bad can't check if FP used
+#if defined(__mips_n64) || defined(__mips_n32)
+ FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0)
+ FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0)
+ FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0)
+ FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0)
+#endif
+#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
+ FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0)
+ FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0)
+#endif
+#if defined(__mips_o32) || defined(__mips_o64)
+ FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0)
+ FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0)
+#endif
+#if defined(__mips_n64)
+ FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0)
+ FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0)
+ FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0)
+ FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0)
+#endif
+ INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0)
+#endif /* ! SOFTFLOAT */
+ REG_EPILOGUE
+
+ j ra
+ move v0, zero
+END(_setjmp)
+
+LEAF(_longjmp)
+ PIC_PROLOGUE(_longjmp)
+ PTR_SUBU sp, sp, CALLFRAME_SIZ
+ SAVE_GP(CALLFRAME_GP)
+
+ REG_PROLOGUE
+ REG_L v0, (_JB_MAGIC * SZREG)(a0) # get magic number
+ REG_L ra, (_JB_REG_RA * SZREG)(a0)
+ REG_LI t0, _JB_MAGIC__SETJMP
+ bne v0, t0, botch # jump if error
+ PTR_ADDU sp, sp, CALLFRAME_SIZ # does not matter, sanity
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * Registers s0..s7 are callee-saved.
+ * The sp register is callee-saved.
+ * The fp (or s8) register is callee-saved.
+ * The gp register is callee-saved (for n32/n64).
+ */
+ REG_L s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_L s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_L s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_L s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_L s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_L s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_L s6, (_JB_REG_S6 * SZREG)(a0)
+ REG_L s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_L sp, (_JB_REG_SP * SZREG)(a0)
+ REG_L s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+ REG_L gp, (_JB_REG_GP * SZREG)(a0)
+#endif
+#ifndef SOFTFLOAT
+ # get fpu status
+ INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0)
+ ctc1 v0, $31
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
+ * In N64, FP registers F24 .. F31 are callee-saved.
+ * In O32, FP registers F20 .. F23 are callee-saved.
+ */
+#if defined(__mips_n64) || defined(__mips_n32)
+ FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0)
+ FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0)
+ FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0)
+ FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0)
+#endif
+#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
+ FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0)
+ FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0)
+#endif
+#if defined(__mips_o32) || defined(__mips_o64)
+ FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0)
+ FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0)
+#endif
+#if defined(__mips_n64)
+ FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0)
+ FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0)
+ FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0)
+ FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0)
+#endif
+#endif /* ! SOFTFLOAT */
+
+ REG_EPILOGUE
+ move v0, a1 # get return value in 1st arg
+ j ra
+ nop
+
+botch:
+ /*
+ * We know we aren't returning so we don't care about restoring
+ * our caller's GP.
+ */
+ PTR_LA t9, _C_LABEL(longjmperror)
+ jalr t9
+ nop
+
+ PIC_TAILCALL(abort)
+END(_longjmp)
diff --git a/lib/libc/mips/gen/fabs.S b/lib/libc/mips/gen/fabs.S
new file mode 100644
index 0000000..3b79249
--- /dev/null
+++ b/lib/libc/mips/gen/fabs.S
@@ -0,0 +1,58 @@
+/* $NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)fabs.s 8.1 (Berkeley) 2/16/94")
+ ASMSTR("$NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
+ .set noreorder
+
+/*
+ * fabs(x)
+ * double x;
+ *
+ * Return absolute value of x.
+ */
+LEAF(fabs)
+ j ra
+ abs.d $f0, $f12 # compute absolute value of x
+END(fabs)
diff --git a/lib/libc/mips/gen/fabs.c b/lib/libc/mips/gen/fabs.c
new file mode 100644
index 0000000..8bb1502
--- /dev/null
+++ b/lib/libc/mips/gen/fabs.c
@@ -0,0 +1,46 @@
+/* $NetBSD: fabs.c,v 1.2 2002/05/26 11:48:01 wiz Exp $ */
+
+/*
+ * Copyright (c) 1996 Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Brinicombe
+ * 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 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.
+ */
+
+/*
+ * fabs(x) returns the absolute value of x.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+double
+fabs(double x)
+{
+ if (x < 0)
+ x = -x;
+ return(x);
+}
diff --git a/lib/libc/mips/gen/flt_rounds.c b/lib/libc/mips/gen/flt_rounds.c
new file mode 100644
index 0000000..9fc64a5
--- /dev/null
+++ b/lib/libc/mips/gen/flt_rounds.c
@@ -0,0 +1,30 @@
+/* $NetBSD: flt_rounds.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: flt_rounds.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <machine/float.h>
+
+static const int map[] = {
+ 1, /* round to nearest */
+ 0, /* round to zero */
+ 2, /* round to positive infinity */
+ 3 /* round to negative infinity */
+};
+
+int
+__flt_rounds()
+{
+ int x;
+
+ __asm("cfc1 %0,$31" : "=r" (x));
+ return map[x & 0x03];
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetmask.c b/lib/libc/mips/gen/hardfloat/fpgetmask.c
new file mode 100644
index 0000000..505a74c
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpgetmask.c
@@ -0,0 +1,29 @@
+/* $NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpgetmask,_fpgetmask)
+#endif
+
+fp_except_t
+fpgetmask()
+{
+ int x;
+
+ __asm("cfc1 %0,$31" : "=r" (x));
+ return (x >> 7) & 0x1f;
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetround.c b/lib/libc/mips/gen/hardfloat/fpgetround.c
new file mode 100644
index 0000000..6d0f11a
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpgetround.c
@@ -0,0 +1,29 @@
+/* $NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpgetround,_fpgetround)
+#endif
+
+fp_rnd_t
+fpgetround()
+{
+ int x;
+
+ __asm("cfc1 %0,$31" : "=r" (x));
+ return x & 0x03;
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetsticky.c b/lib/libc/mips/gen/hardfloat/fpgetsticky.c
new file mode 100644
index 0000000..8028261
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpgetsticky.c
@@ -0,0 +1,29 @@
+/* $NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpgetsticky,_fpgetsticky)
+#endif
+
+fp_except_t
+fpgetsticky()
+{
+ int x;
+
+ __asm("cfc1 %0,$31" : "=r" (x));
+ return (x >> 2) & 0x1f;
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetmask.c b/lib/libc/mips/gen/hardfloat/fpsetmask.c
new file mode 100644
index 0000000..7abb3fd
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpsetmask.c
@@ -0,0 +1,38 @@
+/* $NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpsetmask,_fpsetmask)
+#endif
+
+fp_except_t
+fpsetmask(mask)
+ fp_except_t mask;
+{
+ fp_except_t old;
+ fp_except_t new;
+
+ __asm("cfc1 %0,$31" : "=r" (old));
+
+ new = old;
+ new &= ~(0x1f << 7);
+ new |= ((mask & 0x1f) << 7);
+
+ __asm("ctc1 %0,$31" : : "r" (new));
+
+ return (old >> 7) & 0x1f;
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetround.c b/lib/libc/mips/gen/hardfloat/fpsetround.c
new file mode 100644
index 0000000..0205161
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpsetround.c
@@ -0,0 +1,37 @@
+/* $NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpsetround,_fpsetround)
+#endif
+
+fp_rnd_t
+fpsetround(fp_rnd_t rnd_dir)
+{
+ fp_rnd_t old;
+ fp_rnd_t new;
+
+ __asm("cfc1 %0,$31" : "=r" (old));
+
+ new = old;
+ new &= ~0x03;
+ new |= (rnd_dir & 0x03);
+
+ __asm("ctc1 %0,$31" : : "r" (new));
+
+ return old & 0x03;
+}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetsticky.c b/lib/libc/mips/gen/hardfloat/fpsetsticky.c
new file mode 100644
index 0000000..e433671
--- /dev/null
+++ b/lib/libc/mips/gen/hardfloat/fpsetsticky.c
@@ -0,0 +1,38 @@
+/* $NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <ieeefp.h>
+
+#ifdef __weak_alias
+__weak_alias(fpsetsticky,_fpsetsticky)
+#endif
+
+fp_except
+fpsetsticky(sticky)
+ fp_except sticky;
+{
+ fp_except old;
+ fp_except new;
+
+ __asm("cfc1 %0,$31" : "=r" (old));
+
+ new = old;
+ new &= ~(0x1f << 2);
+ new |= ((sticky & 0x1f) << 2);
+
+ __asm("ctc1 %0,$31" : : "r" (new));
+
+ return (old >> 2) & 0x1f;
+}
diff --git a/lib/libc/mips/gen/infinity.c b/lib/libc/mips/gen/infinity.c
new file mode 100644
index 0000000..55cf25f
--- /dev/null
+++ b/lib/libc/mips/gen/infinity.c
@@ -0,0 +1,26 @@
+/*
+ * infinity.c
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <math.h>
+
+/* bytes for +Infinity on a 387 */
+const union __infinity_un __infinity = {
+#if BYTE_ORDER == BIG_ENDIAN
+ { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
+#else
+ { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
+#endif
+};
+
+/* bytes for NaN */
+const union __nan_un __nan = {
+#if BYTE_ORDER == BIG_ENDIAN
+ {0x7f, 0xa0, 0, 0}
+#else
+ { 0, 0, 0xa0, 0x7f }
+#endif
+};
diff --git a/lib/libc/mips/gen/ldexp.S b/lib/libc/mips/gen/ldexp.S
new file mode 100644
index 0000000..caee703
--- /dev/null
+++ b/lib/libc/mips/gen/ldexp.S
@@ -0,0 +1,219 @@
+/* $NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)ldexp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
+
+#define DEXP_INF 0x7ff
+#define DEXP_BIAS 1023
+#define DEXP_MIN -1022
+#define DEXP_MAX 1023
+#define DFRAC_BITS 52
+#define DIMPL_ONE 0x00100000
+#define DLEAD_ZEROS 31 - 20
+#define STICKYBIT 1
+#define GUARDBIT 0x80000000
+#define DSIGNAL_NAN 0x00040000
+#define DQUIET_NAN0 0x0007ffff
+#define DQUIET_NAN1 0xffffffff
+
+/*
+ * double ldexp(x, N)
+ * double x; int N;
+ *
+ * Return x * (2**N), for integer values N.
+ */
+LEAF(ldexp)
+ mfc1 v1, $f13 # get MSW of x
+ mfc1 t3, $f12 # get LSW of x
+ sll t1, v1, 1 # get x exponent
+ srl t1, t1, 32 - 11
+ beq t1, DEXP_INF, 9f # is it a NAN or infinity?
+ beq t1, zero, 1f # zero or denormalized number?
+ addu t1, t1, a2 # scale exponent
+ sll v0, a2, 20 # position N for addition
+ bge t1, DEXP_INF, 8f # overflow?
+ addu v0, v0, v1 # multiply by (2**N)
+ ble t1, zero, 4f # underflow?
+ mtc1 v0, $f1 # save MSW of result
+ mtc1 t3, $f0 # save LSW of result
+ j ra
+1:
+ sll t2, v1, 32 - 20 # get x fraction
+ srl t2, t2, 32 - 20
+ srl t0, v1, 31 # get x sign
+ bne t2, zero, 1f
+ beq t3, zero, 9f # result is zero
+1:
+/*
+ * Find out how many leading zero bits are in t2,t3 and put in t9.
+ */
+ move v0, t2
+ move t9, zero
+ bne t2, zero, 1f
+ move v0, t3
+ addu t9, 32
+1:
+ srl ta0, v0, 16
+ bne ta0, zero, 1f
+ addu t9, 16
+ sll v0, 16
+1:
+ srl ta0, v0, 24
+ bne ta0, zero, 1f
+ addu t9, 8
+ sll v0, 8
+1:
+ srl ta0, v0, 28
+ bne ta0, zero, 1f
+ addu t9, 4
+ sll v0, 4
+1:
+ srl ta0, v0, 30
+ bne ta0, zero, 1f
+ addu t9, 2
+ sll v0, 2
+1:
+ srl ta0, v0, 31
+ bne ta0, zero, 1f
+ addu t9, 1
+/*
+ * Now shift t2,t3 the correct number of bits.
+ */
+1:
+ subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros
+ li t1, DEXP_MIN + DEXP_BIAS
+ subu t1, t1, t9 # adjust exponent
+ addu t1, t1, a2 # scale exponent
+ li v0, 32
+ blt t9, v0, 1f
+ subu t9, t9, v0 # shift fraction left >= 32 bits
+ sll t2, t3, t9
+ move t3, zero
+ b 2f
+1:
+ subu v0, v0, t9 # shift fraction left < 32 bits
+ sll t2, t2, t9
+ srl ta0, t3, v0
+ or t2, t2, ta0
+ sll t3, t3, t9
+2:
+ bge t1, DEXP_INF, 8f # overflow?
+ ble t1, zero, 4f # underflow?
+ sll t2, t2, 32 - 20 # clear implied one bit
+ srl t2, t2, 32 - 20
+3:
+ sll t1, t1, 31 - 11 # reposition exponent
+ sll t0, t0, 31 # reposition sign
+ or t0, t0, t1 # put result back together
+ or t0, t0, t2
+ mtc1 t0, $f1 # save MSW of result
+ mtc1 t3, $f0 # save LSW of result
+ j ra
+4:
+ li v0, 0x80000000
+ ble t1, -52, 7f # is result too small for denorm?
+ sll t2, v1, 31 - 20 # clear exponent, extract fraction
+ or t2, t2, v0 # set implied one bit
+ blt t1, -30, 2f # will all bits in t3 be shifted out?
+ srl t2, t2, 31 - 20 # shift fraction back to normal position
+ subu t1, t1, 1
+ sll ta0, t2, t1 # shift right t2,t3 based on exponent
+ srl t8, t3, t1 # save bits shifted out
+ negu t1
+ srl t3, t3, t1
+ or t3, t3, ta0
+ srl t2, t2, t1
+ bge t8, zero, 1f # does result need to be rounded?
+ addu t3, t3, 1 # round result
+ sltu ta0, t3, 1
+ sll t8, t8, 1
+ addu t2, t2, ta0
+ bne t8, zero, 1f # round result to nearest
+ and t3, t3, ~1
+1:
+ mtc1 t3, $f0 # save denormalized result (LSW)
+ mtc1 t2, $f1 # save denormalized result (MSW)
+ bge v1, zero, 1f # should result be negative?
+ neg.d $f0, $f0 # negate result
+1:
+ j ra
+2:
+ mtc1 zero, $f1 # exponent and upper fraction
+ addu t1, t1, 20 # compute amount to shift right by
+ sll t8, t2, t1 # save bits shifted out
+ negu t1
+ srl t3, t2, t1
+ bge t8, zero, 1f # does result need to be rounded?
+ addu t3, t3, 1 # round result
+ sltu ta0, t3, 1
+ sll t8, t8, 1
+ mtc1 ta0, $f1 # exponent and upper fraction
+ bne t8, zero, 1f # round result to nearest
+ and t3, t3, ~1
+1:
+ mtc1 t3, $f0
+ bge v1, zero, 1f # is result negative?
+ neg.d $f0, $f0 # negate result
+1:
+ j ra
+7:
+ mtc1 zero, $f0 # result is zero
+ mtc1 zero, $f1
+ beq t0, zero, 1f # is result positive?
+ neg.d $f0, $f0 # negate result
+1:
+ j ra
+8:
+ li t1, 0x7ff00000 # result is infinity (MSW)
+ mtc1 t1, $f1
+ mtc1 zero, $f0 # result is infinity (LSW)
+ bge v1, zero, 1f # should result be negative infinity?
+ neg.d $f0, $f0 # result is negative infinity
+1:
+ add.d $f0, $f0 # cause overflow faults if enabled
+ j ra
+9:
+ mov.d $f0, $f12 # yes, result is just x
+ j ra
+END(ldexp)
diff --git a/lib/libc/mips/gen/longjmp.c b/lib/libc/mips/gen/longjmp.c
new file mode 100644
index 0000000..7c68470
--- /dev/null
+++ b/lib/libc/mips/gen/longjmp.c
@@ -0,0 +1,103 @@
+/* $NetBSD: longjmp.c,v 1.1 2005/09/17 11:49:39 tsutsui Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christian Limpach and Matt Thomas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include "namespace.h"
+#include <sys/types.h>
+#include <ucontext.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <machine/regnum.h>
+
+void
+__longjmp14(jmp_buf env, int val)
+{
+ struct sigcontext *sc = (void *)env;
+ ucontext_t uc;
+
+ /* Ensure non-zero SP and sigcontext magic number is present */
+ if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != 0xACEDBADE)
+ goto err;
+
+ /* Ensure non-zero return value */
+ if (val == 0)
+ val = 1;
+
+ /*
+ * Set _UC_{SET,CLR}STACK according to SS_ONSTACK.
+ *
+ * Restore the signal mask with sigprocmask() instead of _UC_SIGMASK,
+ * since libpthread may want to interpose on signal handling.
+ */
+ uc.uc_flags = _UC_CPU | (sc->sc_onstack ? _UC_SETSTACK : _UC_CLRSTACK);
+
+ sigprocmask(SIG_SETMASK, &sc->sc_mask, NULL);
+
+ /* Clear uc_link */
+ uc.uc_link = 0;
+
+ /* Save return value in context */
+ uc.uc_mcontext.__gregs[_R_V0] = val;
+
+ /* Copy saved registers */
+ uc.uc_mcontext.__gregs[_REG_S0] = sc->sc_regs[_R_S0];
+ uc.uc_mcontext.__gregs[_REG_S1] = sc->sc_regs[_R_S1];
+ uc.uc_mcontext.__gregs[_REG_S2] = sc->sc_regs[_R_S2];
+ uc.uc_mcontext.__gregs[_REG_S3] = sc->sc_regs[_R_S3];
+ uc.uc_mcontext.__gregs[_REG_S4] = sc->sc_regs[_R_S4];
+ uc.uc_mcontext.__gregs[_REG_S5] = sc->sc_regs[_R_S5];
+ uc.uc_mcontext.__gregs[_REG_S6] = sc->sc_regs[_R_S6];
+ uc.uc_mcontext.__gregs[_REG_S7] = sc->sc_regs[_R_S7];
+ uc.uc_mcontext.__gregs[_REG_S8] = sc->sc_regs[_R_S8];
+ uc.uc_mcontext.__gregs[_REG_SP] = sc->sc_regs[_R_SP];
+ uc.uc_mcontext.__gregs[_REG_RA] = sc->sc_regs[_R_RA];
+ uc.uc_mcontext.__gregs[_REG_EPC] = sc->sc_pc;
+
+ /* Copy FP state */
+ if (sc->sc_fpused) {
+ /* FP saved regs are $f20 .. $f31 */
+ memcpy(&uc.uc_mcontext.__fpregs.__fp_r.__fp_regs[20],
+ &sc->sc_fpregs[20], 32 - 20);
+ uc.uc_mcontext.__fpregs.__fp_csr =
+ sc->sc_fpregs[_R_FSR - _FPBASE];
+ /* XXX sc_fp_control */
+ uc.uc_flags |= _UC_FPU;
+ }
+
+ setcontext(&uc);
+ err:
+ longjmperror();
+ abort();
+ /* NOTREACHED */
+}
diff --git a/lib/libc/mips/gen/makecontext.c b/lib/libc/mips/gen/makecontext.c
new file mode 100644
index 0000000..f2a826e
--- /dev/null
+++ b/lib/libc/mips/gen/makecontext.c
@@ -0,0 +1,123 @@
+/* $NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $ */
+
+/*-
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
+#endif
+
+#include <sys/param.h>
+#include <machine/regnum.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ucontext.h>
+
+__weak_reference(__makecontext, makecontext);
+
+void _ctx_done(ucontext_t *);
+void _ctx_start(void);
+
+void
+__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
+{
+ mcontext_t *mc;
+ register_t *sp;
+ int i;
+ va_list ap;
+
+ /*
+ * XXX/juli
+ * We need an mc_len or mc_flags like other architectures
+ * so that we can mark a context as invalid. Store it in
+ * mc->mc_regs[ZERO] perhaps?
+ */
+ if (argc < 0 || argc > 6 || ucp == NULL ||
+ ucp->uc_stack.ss_sp == NULL ||
+ ucp->uc_stack.ss_size < MINSIGSTKSZ)
+ return;
+ mc = &ucp->uc_mcontext;
+
+ sp = (register_t *)
+ ((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+#if defined(__mips_o32) || defined(__mips_o64)
+ sp -= (argc >= 4 ? argc : 4); /* Make room for >=4 arguments. */
+ sp = (register_t *)
+ ((uintptr_t)sp & ~0x7); /* Align on double-word boundary. */
+#elif defined(__mips_n32) || defined(__mips_n64)
+ sp -= (argc > 8 ? argc - 8 : 0); /* Make room for > 8 arguments. */
+ sp = (register_t *)
+ ((uintptr_t)sp & ~0xf); /* Align on quad-word boundary. */
+#endif
+
+ mc->mc_regs[SP] = (intptr_t)sp;
+ mc->mc_regs[S0] = (intptr_t)ucp;
+ mc->mc_regs[T9] = (intptr_t)func;
+ mc->mc_pc = (intptr_t)_ctx_start;
+
+ /* Construct argument list. */
+ va_start(ap, argc);
+#if defined(__mips_o32) || defined(__mips_o64)
+ /* Up to the first four arguments are passed in $a0-3. */
+ for (i = 0; i < argc && i < 4; i++)
+ /* LINTED register_t is safe */
+ mc->mc_regs[A0 + i] = va_arg(ap, register_t);
+ /* Pass remaining arguments on the stack above the $a0-3 gap. */
+ sp += i;
+#endif
+#if defined(__mips_n32) || defined(__mips_n64)
+ /* Up to the first 8 arguments are passed in $a0-7. */
+ for (i = 0; i < argc && i < 8; i++)
+ /* LINTED register_t is safe */
+ mc->mc_regs[A0 + i] = va_arg(ap, register_t);
+ /* Pass remaining arguments on the stack above the $a0-3 gap. */
+#endif
+ /* Pass remaining arguments on the stack above the $a0-3 gap. */
+ for (; i < argc; i++)
+ /* LINTED uintptr_t is safe */
+ *sp++ = va_arg(ap, register_t);
+ va_end(ap);
+}
+
+void
+_ctx_done(ucontext_t *ucp)
+{
+
+ if (ucp->uc_link == NULL)
+ exit(0);
+ else {
+ setcontext((const ucontext_t *)ucp->uc_link);
+ abort();
+ }
+}
diff --git a/lib/libc/mips/gen/setjmp.S b/lib/libc/mips/gen/setjmp.S
new file mode 100644
index 0000000..9c9e8b8
--- /dev/null
+++ b/lib/libc/mips/gen/setjmp.S
@@ -0,0 +1,238 @@
+/* $NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+#include <machine/regnum.h>
+
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+#include "SYS.h"
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
+
+/*
+ * C library -- setjmp, longjmp
+ *
+ * longjmp(a,v)
+ * will generate a "return(v)" from
+ * the last call to
+ * setjmp(a)
+ * by restoring registers from the stack,
+ * and a struct sigcontext, see <signal.h>
+ */
+
+#define SETJMP_FRAME_SIZE (CALLFRAME_SIZ + (SZREG * 2))
+
+
+NESTED(setjmp, SETJMP_FRAME_SIZE, ra)
+ .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
+ SETUP_GP
+ PTR_SUBU sp, sp, SETJMP_FRAME_SIZE # allocate stack frame
+ SAVE_GP(CALLFRAME_GP)
+ SETUP_GP64(CALLFRAME_GP, setjmp)
+
+ REG_S ra, CALLFRAME_RA(sp) # save RA
+ REG_S a0, CALLFRAME_SIZ(sp) # store env
+
+ /* Get the signal mask. */
+ PTR_ADDU a2, a0, _JB_SIGMASK * SZREG # &oenv
+ li a0, 1 # SIG_SETBLOCK
+ move a1, zero # &env == 0
+ PTR_LA t9, _C_LABEL(sigprocmask) # get current signal mask
+ jalr t9
+
+ RESTORE_GP64
+ REG_L a0, CALLFRAME_SIZ(sp) # restore env pointer
+ REG_L ra, CALLFRAME_RA(sp) # restore RA
+ PTR_ADDU sp, sp, SETJMP_FRAME_SIZE # pop stack frame
+
+ REG_LI v0, _JB_MAGIC_SETJMP
+ REG_S v0, (_JB_MAGIC * SZREG)(a0)
+ REG_S ra, (_JB_REG_RA * SZREG)(a0)
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * Registers s0..s7 are callee-saved.
+ * The sp register is callee-saved.
+ * The fp (or s8) register is callee-saved.
+ * The gp register is callee-saved (for n32/n64).
+ */
+ REG_S s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_S s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_S s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_S s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_S s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_S s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_S s6, (_JB_REG_S6 * SZREG)(a0)
+ REG_S s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_S sp, (_JB_REG_SP * SZREG)(a0)
+ REG_S s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+ REG_S gp, (_JB_REG_GP * SZREG)(a0)
+#endif
+#ifndef SOFTFLOAT
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
+ * In N64, FP registers F24 .. F31 are callee-saved.
+ * In O32, FP registers F20 .. F23 are callee-saved.
+ */
+ cfc1 v0, $31
+ INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0)
+#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32)
+ FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0)
+ FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0)
+#endif
+#if defined(__mips_o32) || defined(__mips_o64)
+ FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0)
+ FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0)
+#endif
+#if defined(__mips_n32) || defined(__mips_n64)
+ FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0)
+ FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0)
+ FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0)
+ FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0)
+#endif
+#if defined(__mips_n64)
+ FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0)
+ FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0)
+ FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0)
+ FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0)
+#endif
+#endif /* ! SOFTFLOAT */
+
+ move v0, zero
+ jr ra
+END(setjmp)
+
+#define LONGJMP_FRAME_SIZE (CALLFRAME_SIZ + (SZREG * 2))
+
+NESTED(longjmp, LONGJMP_FRAME_SIZE, ra)
+ .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
+ PIC_PROLOGUE(longjmp)
+ PTR_SUBU sp, sp, LONGJMP_FRAME_SIZE # allocate stack frame
+ SAVE_GP(CALLFRAME_GP)
+
+ REG_S ra, CALLFRAME_RA(sp) # save RA
+ REG_L v0, (_JB_MAGIC * SZREG)(a0)
+ REG_LI t0, _JB_MAGIC_SETJMP
+ bne v0, t0, botch # jump if error
+ nop
+
+ REG_S a0, CALLFRAME_SIZ(sp) # save env
+ REG_S a1, (CALLFRAME_SIZ + SZREG)(sp) # save return value
+
+ # set sigmask
+ PTR_ADDU a1, a0, _JB_SIGMASK * SZREG # &set
+ move a2, zero # &oset == NULL
+ li a0, 3 # SIG_SETMASK
+ PTR_LA t9,_C_LABEL(sigprocmask) # set current signal mask
+ jal t9
+ nop
+
+ REG_L a0, CALLFRAME_SIZ(sp) # restore env
+ REG_L a1, (CALLFRAME_SIZ + SZREG)(sp) # restore return value
+
+ REG_L ra, (_JB_REG_RA * SZREG)(a0)
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * Registers s0..s7 are callee-saved.
+ * The sp register is callee-saved.
+ * The fp (or s8) register is callee-saved.
+ * The gp register is callee-saved (for n32/n64).
+ */
+ REG_L s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_L s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_L s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_L s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_L s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_L s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_L s6, (_JB_REG_S6 * SZREG)(a0)
+ REG_L s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_L sp, (_JB_REG_SP * SZREG)(a0)
+ REG_L s8, (_JB_REG_S8 * SZREG)(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+ REG_L gp, (_JB_REG_GP * SZREG)(a0)
+#endif
+#ifndef SOFTFLOAT
+ /*
+ * From "MIPSpro N32 ABI Handbook", Table 2-1:
+ * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
+ * In N64, FP registers F23 .. F31 are callee-saved.
+ * In O32, FP registers F20 .. F23 are callee-saved.
+ */
+ INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0)
+ ctc1 v0, $31
+#if defined(__mips_n64) || defined(__mips_n32)
+ FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0)
+ FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0)
+ FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0)
+ FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0)
+#endif
+#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
+ FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0)
+ FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0)
+#endif
+#if defined(__mips_o32) || defined(__mips_o64)
+ FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0)
+ FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0)
+#endif
+#if defined(__mips_n64)
+ FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0)
+ FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0)
+ FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0)
+ FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0)
+#endif
+#endif /* ! SOFTFLOAT */
+
+ move v0, a1
+ j ra
+ nop
+
+botch:
+ /*
+ * We know we aren't returning so we don't care about restoring
+ * our caller's GP.
+ */
+ PTR_LA t9, _C_LABEL(longjmperror)
+ jalr t9
+ nop
+
+ PIC_TAILCALL(abort)
+END(longjmp)
diff --git a/lib/libc/mips/gen/signalcontext.c b/lib/libc/mips/gen/signalcontext.c
new file mode 100644
index 0000000..694468c
--- /dev/null
+++ b/lib/libc/mips/gen/signalcontext.c
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2004 Olivier Houchard
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/ucontext.h>
+
+#include <machine/frame.h>
+#include <machine/sigframe.h>
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <strings.h>
+#include <signal.h>
+
+__weak_reference(__signalcontext, signalcontext);
+
+extern void _ctx_start(void);
+
+int
+__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func)
+{
+ /* XXXMIPS: Implement me */
+ return (0);
+}
diff --git a/lib/libc/mips/gen/sigsetjmp.S b/lib/libc/mips/gen/sigsetjmp.S
new file mode 100644
index 0000000..41c47f2
--- /dev/null
+++ b/lib/libc/mips/gen/sigsetjmp.S
@@ -0,0 +1,77 @@
+/* $NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993, 1995,
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Havard Eidnes.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+#include <machine/regnum.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+#include "SYS.h"
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
+
+/*
+ * C library -- sigsetjmp, siglongjmp
+ *
+ * siglongjmp(a,v)
+ * will generate a "return(v)" from
+ * the last call to
+ * sigsetjmp(a, savemask)
+ * by restoring registers from the stack,
+ * and dependent on savemask restores the
+ * signal mask.
+ */
+
+LEAF(sigsetjmp)
+ PIC_PROLOGUE(sigsetjmp)
+
+ bne a1, zero, 1f # do saving of signal mask?
+ PIC_TAILCALL(_setjmp)
+
+1: PIC_TAILCALL(setjmp)
+END(sigsetjmp)
+
+LEAF(siglongjmp)
+ PIC_PROLOGUE(siglongjmp)
+ REG_L t0, (_JB_MAGIC * SZREG)(a0)
+ REG_LI t1, _JB_MAGIC__SETJMP
+ bne t0, t1, 1f # setjmp or _setjmp magic?
+ PIC_TAILCALL(_longjmp)
+1: PIC_TAILCALL(longjmp)
+END(siglongjmp)
OpenPOWER on IntegriCloud