svn commit: r209878 - in head/lib/libc: . gmon powerpc64 powerpc64/gen powerpc64/softfloat powerpc64/sys stdlib

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Jul 10 14:45:04 UTC 2010


Author: nwhitehorn
Date: Sat Jul 10 14:45:03 2010
New Revision: 209878
URL: http://svn.freebsd.org/changeset/base/209878

Log:
  Provide 64-bit PowerPC support in libc.
  
  Obtained from:	projects/ppc64

Added:
  head/lib/libc/powerpc64/
  head/lib/libc/powerpc64/Makefile.inc   (contents, props changed)
  head/lib/libc/powerpc64/SYS.h   (contents, props changed)
  head/lib/libc/powerpc64/Symbol.map   (contents, props changed)
  head/lib/libc/powerpc64/_fpmath.h   (contents, props changed)
  head/lib/libc/powerpc64/arith.h   (contents, props changed)
  head/lib/libc/powerpc64/gd_qnan.h   (contents, props changed)
  head/lib/libc/powerpc64/gen/
  head/lib/libc/powerpc64/gen/Makefile.inc   (contents, props changed)
  head/lib/libc/powerpc64/gen/_ctx_start.S   (contents, props changed)
  head/lib/libc/powerpc64/gen/_set_tp.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/_setjmp.S   (contents, props changed)
  head/lib/libc/powerpc64/gen/fabs.S   (contents, props changed)
  head/lib/libc/powerpc64/gen/flt_rounds.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/fpgetmask.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/fpgetround.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/fpgetsticky.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/fpsetmask.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/fpsetround.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/infinity.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/makecontext.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/modf.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/setjmp.S   (contents, props changed)
  head/lib/libc/powerpc64/gen/signalcontext.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/sigsetjmp.S   (contents, props changed)
  head/lib/libc/powerpc64/gen/syncicache.c   (contents, props changed)
  head/lib/libc/powerpc64/softfloat/
  head/lib/libc/powerpc64/softfloat/milieu.h   (contents, props changed)
  head/lib/libc/powerpc64/softfloat/powerpc-gcc.h   (contents, props changed)
  head/lib/libc/powerpc64/softfloat/softfloat.h   (contents, props changed)
  head/lib/libc/powerpc64/sys/
  head/lib/libc/powerpc64/sys/Makefile.inc   (contents, props changed)
  head/lib/libc/powerpc64/sys/brk.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/cerror.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/exect.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/pipe.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/ptrace.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/sbrk.S   (contents, props changed)
  head/lib/libc/powerpc64/sys/setlogin.S   (contents, props changed)
Modified:
  head/lib/libc/Makefile
  head/lib/libc/gmon/gmon.c
  head/lib/libc/stdlib/malloc.c

Modified: head/lib/libc/Makefile
==============================================================================
--- head/lib/libc/Makefile	Sat Jul 10 14:40:57 2010	(r209877)
+++ head/lib/libc/Makefile	Sat Jul 10 14:45:03 2010	(r209878)
@@ -51,6 +51,7 @@ NOASM=
 .include "${.CURDIR}/posix1e/Makefile.inc"
 .if ${MACHINE_ARCH} != "amd64" && \
     ${MACHINE_ARCH} != "ia64" && \
+    ${MACHINE_ARCH} != "powerpc64" && \
     ${MACHINE_ARCH} != "sparc64" && \
     ${MACHINE_ARCH} != "mips"
 .include "${.CURDIR}/quad/Makefile.inc"

Modified: head/lib/libc/gmon/gmon.c
==============================================================================
--- head/lib/libc/gmon/gmon.c	Sat Jul 10 14:40:57 2010	(r209877)
+++ head/lib/libc/gmon/gmon.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -50,8 +50,10 @@ __FBSDID("$FreeBSD$");
 
 #include "libc_private.h"
 
-#if defined(__i386__) || defined(__sparc64__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__i386__) || defined(__sparc64__) || defined(__amd64__) || (defined(__powerpc__) && !defined(__powerpc64__))
 extern char *minbrk __asm (".minbrk");
+#elif defined(__powerpc64__)
+extern char *minbrk __asm ("_minbrk");
 #else
 extern char *minbrk __asm ("minbrk");
 #endif

Added: head/lib/libc/powerpc64/Makefile.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/Makefile.inc	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+# Long double is 64-bits
+MDSRCS+=machdep_ldisd.c
+SYM_MAPS+=${.CURDIR}/powerpc64/Symbol.map

Added: head/lib/libc/powerpc64/SYS.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/SYS.h	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,109 @@
+/*-
+ * Copyright (c) 2002 Benno Rice.  All rights reserved.
+ * Copyright (c) 2002 David E. O'Brien.  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.
+ * 3. Neither the name of the author nor the names of any 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 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.
+ *
+ *	$NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/syscall.h>
+#include <machine/asm.h>
+
+#define _SYSCALL(x)						\
+	.text;							\
+	.align 2;						\
+	li	0,(__CONCAT(SYS_,x));				\
+	sc
+
+#define	SYSCALL(x)						\
+	.text;							\
+	.align 2;						\
+2:	mflr	%r0;						\
+	std	%r0,16(%r1);					\
+	stdu	%r1,-48(%r1);					\
+	bl	PIC_PLT(CNAME(HIDENAME(cerror)));		\
+	nop;							\
+	addi	%r1,%r1,48;					\
+	ld	%r0,16(%r1);					\
+	mtlr	%r0;						\
+	blr;							\
+ENTRY(__CONCAT(__sys_,x));					\
+	.weak	CNAME(x);					\
+	.set	CNAME(x),CNAME(__CONCAT(__sys_,x));		\
+	.weak	CNAME(__CONCAT(_,x));				\
+	.set	CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x));	\
+	.weak	CNAME(__CONCAT(.,x));				\
+	.set	CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\
+	.weak	CNAME(__CONCAT(._,x));				\
+	.set	CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
+	_SYSCALL(x);						\
+	bso	2b
+
+#define	PSEUDO(x)						\
+	.text;							\
+	.align 2;						\
+ENTRY(__CONCAT(__sys_,x));					\
+	.weak	CNAME(__CONCAT(_,x));				\
+	.set	CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x));	\
+	.weak	CNAME(__CONCAT(._,x));				\
+	.set	CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
+	_SYSCALL(x);						\
+	bnslr;							\
+	mflr	%r0;						\
+	std	%r0,16(%r1);					\
+	stdu	%r1,-48(%r1);					\
+	bl	PIC_PLT(CNAME(HIDENAME(cerror)));		\
+	nop;							\
+	addi	%r1,%r1,48;					\
+	ld	%r0,16(%r1);					\
+	mtlr	%r0;						\
+	blr;
+
+#define	RSYSCALL(x)						\
+	.text;							\
+	.align 2;						\
+ENTRY(__CONCAT(__sys_,x));					\
+	.weak	CNAME(x);					\
+	.set	CNAME(x),CNAME(__CONCAT(__sys_,x));		\
+	.weak	CNAME(__CONCAT(_,x));				\
+	.set	CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x));	\
+	.weak	CNAME(__CONCAT(.,x));				\
+	.set	CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\
+	.weak	CNAME(__CONCAT(._,x));				\
+	.set	CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
+	_SYSCALL(x);						\
+	bnslr;							\
+								\
+	mflr	%r0;						\
+	std	%r0,16(%r1);					\
+	stdu	%r1,-48(%r1);					\
+	bl	PIC_PLT(CNAME(HIDENAME(cerror)));		\
+	nop;							\
+	addi	%r1,%r1,48;					\
+	ld	%r0,16(%r1);					\
+	mtlr	%r0;						\
+	blr;

Added: head/lib/libc/powerpc64/Symbol.map
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/Symbol.map	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,59 @@
+/*
+ * $FreeBSD$
+ */
+
+/*
+ * This only needs to contain symbols that are not listed in
+ * symbol maps from other parts of libc (i.e., not found in
+ * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
+ */
+FBSD_1.0 {
+	/* PSEUDO syscalls */
+	_exit;
+
+	_mcount;
+	_setjmp;
+	_longjmp;
+	fabs;
+	__flt_rounds;
+	fpgetmask;
+	fpgetround;
+	fpgetsticky;
+	fpsetmask;
+	fpsetround;
+	__infinity;
+	__nan;
+	makecontext;
+	modf;
+	setjmp;
+	longjmp;
+	sigsetjmp;
+	siglongjmp;
+	htonl;
+	htons;
+	ntohl;
+	ntohs;
+	brk;
+	exect;
+	sbrk;
+	vfork;
+};
+
+FBSDprivate_1.0 {
+	/* PSEUDO syscalls */
+	__sys_getlogin;
+	_getlogin;
+	__sys_exit;
+
+	_set_tp;
+	_fpgetsticky;
+	__makecontext;
+	__longjmp;
+	signalcontext;
+	__signalcontext;
+	__syncicache;
+	_end;
+	_curbrk;
+	_minbrk;
+	_cerror;
+};

Added: head/lib/libc/powerpc64/_fpmath.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/_fpmath.h	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2003 David Schultz <das at FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+union IEEEl2bits {
+	long double	e;
+	struct {
+		unsigned int		sign	:1;
+		unsigned int		exp	:11;
+		unsigned int		manh	:20;
+		unsigned int		manl	:32;
+	} bits;
+};
+
+#define	mask_nbit_l(u)	((void)0)
+#define	LDBL_IMPLICIT_NBIT
+#define	LDBL_NBIT	0
+
+#define	LDBL_MANH_SIZE	20
+#define	LDBL_MANL_SIZE	32
+
+#define	LDBL_TO_ARRAY32(u, a) do {			\
+	(a)[0] = (uint32_t)(u).bits.manl;		\
+	(a)[1] = (uint32_t)(u).bits.manh;		\
+} while(0)

Added: head/lib/libc/powerpc64/arith.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/arith.h	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,16 @@
+/*
+ * MD header for contrib/gdtoa
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * NOTE: The definitions in this file must be correct or strtod(3) and
+ * floating point formats in printf(3) will break!  The file can be
+ * generated by running contrib/gdtoa/arithchk.c on the target
+ * architecture.  See contrib/gdtoa/gdtoaimp.h for details.
+ */
+
+#define IEEE_MC68k
+#define Arith_Kind_ASL 2
+#define Double_Align

Added: head/lib/libc/powerpc64/gd_qnan.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gd_qnan.h	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,21 @@
+/*
+ * MD header for contrib/gdtoa
+ *
+ * This file can be generated by compiling and running contrib/gdtoa/qnan.c
+ * on the target architecture after arith.h has been generated.
+ *
+ * $FreeBSD$
+ */
+
+#define f_QNAN 0x7fc00000
+#define d_QNAN0 0x7ff80000
+#define d_QNAN1 0x0
+#define ld_QNAN0 0x7ff80000
+#define ld_QNAN1 0x0
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x0
+#define ldus_QNAN0 0x7ff8
+#define ldus_QNAN1 0x0
+#define ldus_QNAN2 0x0
+#define ldus_QNAN3 0x0
+#define ldus_QNAN4 0x0

Added: head/lib/libc/powerpc64/gen/Makefile.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/Makefile.inc	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \
+	fpgetsticky.c fpsetmask.c fpsetround.c \
+	infinity.c ldexp.c makecontext.c modf.c _setjmp.S \
+	setjmp.S sigsetjmp.S signalcontext.c syncicache.c \
+	_set_tp.c
+
+

Added: head/lib/libc/powerpc64/gen/_ctx_start.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/_ctx_start.S	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2004 Suleiman Souhlal
+ * 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$");
+
+	.globl  CNAME(_ctx_done)
+	.globl  CNAME(abort)
+
+ ENTRY(_ctx_start)
+	ld	%r2,8(%r14)
+	ld	%r14,0(%r14)
+	mtlr	%r14
+	blrl			/* branch to start function */
+	mr	%r3,%r15	/* pass pointer to ucontext as argument */
+	nop
+	bl	PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */
+	/*
+	 * we should never return from the
+	 * above branch.
+	 */
+	nop
+	bl	PIC_PLT(CNAME(abort))	/* abort */

Added: head/lib/libc/powerpc64/gen/_set_tp.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/_set_tp.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,35 @@
+/*-
+ * 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$
+ */
+
+void
+_set_tp(void *tpval)
+{
+	register void *tp __asm__("r13");
+
+	__asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7010));
+}

Added: head/lib/libc/powerpc64/gen/_setjmp.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/_setjmp.S	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,116 @@
+/*-
+ * Copyright (c) 2002 Peter Grehan.
+ * 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.
+ */
+/*      $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $      */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * C library -- _setjmp, _longjmp
+ *
+ *      _longjmp(a,v)
+ * will generate a "return(v?v:1)" from the last call to
+ *      _setjmp(a)
+ * by restoring registers from the stack.
+ * The previous signal state is NOT restored.
+ *
+ * jmpbuf layout:
+ *     +------------+
+ *     |   unused   |
+ *     +------------+
+ *     |   unused   |
+ *     |            |
+ *     | (4 words)  |
+ *     |            |
+ *     +------------+
+ *     | saved regs |
+ *     |    ...     |	
+ */
+
+ENTRY(_setjmp)
+	mflr	%r11
+	mfcr	%r12
+	mr	%r10,%r1
+	mr	%r9,%r2
+	std	%r9,40 + 0*8(%r3)
+	std	%r10,40 + 1*8(%r3)
+	std	%r11,40 + 2*8(%r3)
+	std	%r12,40 + 3*8(%r3)
+	std	%r13,40 + 4*8(%r3)
+	std	%r14,40 + 5*8(%r3)
+	std	%r15,40 + 6*8(%r3)
+	std	%r16,40 + 7*8(%r3)
+	std	%r17,40 + 8*8(%r3)
+	std	%r18,40 + 9*8(%r3)
+	std	%r19,40 + 10*8(%r3)
+	std	%r20,40 + 11*8(%r3)
+	std	%r21,40 + 12*8(%r3)
+	std	%r22,40 + 13*8(%r3)
+	std	%r23,40 + 14*8(%r3)
+	std	%r24,40 + 15*8(%r3)
+	std	%r25,40 + 16*8(%r3)
+	std	%r26,40 + 17*8(%r3)
+	std	%r27,40 + 18*8(%r3)
+	std	%r28,40 + 19*8(%r3)
+	std	%r29,40 + 20*8(%r3)
+	std	%r30,40 + 21*8(%r3)
+	std	%r31,40 + 22*8(%r3)
+	li	%r3,0
+	blr
+
+ENTRY(_longjmp)
+	ld	%r9,40 + 0*8(%r3)
+	ld	%r10,40 + 1*8(%r3)
+	ld	%r11,40 + 2*8(%r3)
+	ld	%r12,40 + 3*8(%r3)
+	ld	%r13,40 + 4*8(%r3)
+	ld	%r14,40 + 5*8(%r3)
+	ld	%r15,40 + 6*8(%r3)
+	ld	%r16,40 + 7*8(%r3)
+	ld	%r17,40 + 8*8(%r3)
+	ld	%r18,40 + 9*8(%r3)
+	ld	%r19,40 + 10*8(%r3)
+	ld	%r20,40 + 11*8(%r3)
+	ld	%r21,40 + 12*8(%r3)
+	ld	%r22,40 + 13*8(%r3)
+	ld	%r23,40 + 14*8(%r3)
+	ld	%r24,40 + 15*8(%r3)
+	ld	%r25,40 + 16*8(%r3)
+	ld	%r26,40 + 17*8(%r3)
+	ld	%r27,40 + 18*8(%r3)
+	ld	%r28,40 + 19*8(%r3)
+	ld	%r29,40 + 20*8(%r3)
+	ld	%r30,40 + 21*8(%r3)
+	ld	%r31,40 + 22*8(%r3)
+
+	mtlr	%r11
+	mtcr	%r12
+	mr	%r2,%r9
+	mr	%r1,%r10
+	or.	%r3,%r4,%r4
+	bnelr
+	li	%r3,1
+	blr

Added: head/lib/libc/powerpc64/gen/fabs.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fabs.S	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004 Peter Grehan.
+ * 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$");
+
+/*
+ * double fabs(double)
+ */
+ENTRY(fabs)
+	fabs	%f1,%f1
+	blr

Added: head/lib/libc/powerpc64/gen/flt_rounds.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/flt_rounds.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,56 @@
+/*	$NetBSD: flt_rounds.c,v 1.4.10.3 2002/03/22 20:41:53 nathanw Exp $	*/
+
+/*
+ * Copyright (c) 1996 Mark Brinicombe
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Mark Brinicombe
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/float.h>
+
+#ifndef _SOFT_FLOAT
+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()
+{
+	uint64_t fpscr;
+
+	__asm__ __volatile("mffs %0" : "=f"(fpscr));
+	return map[(fpscr & 0x03)];
+}
+#endif

Added: head/lib/libc/powerpc64/gen/fpgetmask.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fpgetmask.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,55 @@
+/*	$NetBSD: fpgetmask.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ *
+ * 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 the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 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 <sys/types.h>
+#include <ieeefp.h>
+
+#ifndef _SOFT_FLOAT
+fp_except_t
+fpgetmask()
+{
+	u_int64_t fpscr;
+
+	__asm__("mffs %0" : "=f"(fpscr));
+	return ((fp_except_t)((fpscr >> 3) & 0x1f));
+}
+#endif

Added: head/lib/libc/powerpc64/gen/fpgetround.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fpgetround.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,55 @@
+/*	$NetBSD: fpgetround.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ *
+ * 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 the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 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 <sys/types.h>
+#include <ieeefp.h>
+
+#ifndef _SOFT_FLOAT
+fp_rnd_t
+fpgetround()
+{
+	u_int64_t fpscr;
+
+	__asm__("mffs %0" : "=f"(fpscr));
+	return ((fp_rnd_t)(fpscr & 0x3));
+}
+#endif

Added: head/lib/libc/powerpc64/gen/fpgetsticky.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fpgetsticky.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,61 @@
+/*	$NetBSD: fpgetsticky.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * 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 the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+
+#include "namespace.h"
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+#ifndef _SOFT_FLOAT
+#ifdef __weak_alias
+__weak_alias(fpgetsticky,_fpgetsticky)
+#endif
+
+fp_except_t
+fpgetsticky()
+{
+	u_int64_t fpscr;
+
+	__asm__ __volatile("mffs %0" : "=f"(fpscr));
+	return ((fp_except_t)((fpscr >> 25) & 0x1f));
+}
+#endif

Added: head/lib/libc/powerpc64/gen/fpsetmask.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fpsetmask.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,59 @@
+/*	$NetBSD: fpsetmask.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ *
+ * 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 the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 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 <sys/types.h>
+#include <ieeefp.h>
+
+#ifndef _SOFT_FLOAT
+fp_except_t
+fpsetmask(fp_except_t mask)
+{
+	u_int64_t fpscr;
+	fp_rnd_t old;
+
+	__asm__("mffs %0" : "=f"(fpscr));
+	old = (fp_rnd_t)((fpscr >> 3) & 0x1f);
+	fpscr = (fpscr & 0xffffff07) | (mask << 3);
+	__asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr));
+	return (old);
+}
+#endif

Added: head/lib/libc/powerpc64/gen/fpsetround.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/fpsetround.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,59 @@
+/*	$NetBSD: fpsetround.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ *
+ * 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 the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 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 <sys/types.h>
+#include <ieeefp.h>
+
+#ifndef _SOFT_FLOAT
+fp_rnd_t
+fpsetround(fp_rnd_t rnd_dir)
+{
+	u_int64_t fpscr;
+	fp_rnd_t old;
+
+	__asm__ __volatile("mffs %0" : "=f"(fpscr));
+	old = (fp_rnd_t)(fpscr & 0x3);
+	fpscr = (fpscr & 0xfffffffc) | rnd_dir;
+	__asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr));
+	return (old);
+}
+#endif

Added: head/lib/libc/powerpc64/gen/infinity.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/infinity.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,17 @@
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: infinity.c,v 1.2 1998/11/14 19:31:02 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+/* infinity.c */
+
+#include <math.h>
+
+/* bytes for +Infinity on powerpc */
+const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
+
+/* bytes for NaN */
+const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } };

Added: head/lib/libc/powerpc64/gen/makecontext.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/powerpc64/gen/makecontext.c	Sat Jul 10 14:45:03 2010	(r209878)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004 Suleiman Souhlal
+ * 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 <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ucontext.h>
+
+__weak_reference(__makecontext, makecontext);
+
+void _ctx_done(ucontext_t *ucp);
+void _ctx_start(void);
+
+void
+_ctx_done(ucontext_t *ucp)
+{
+	if (ucp->uc_link == NULL)
+		exit(0);
+	else {
+		/* invalidate context */
+		ucp->uc_mcontext.mc_len = 0;
+
+		setcontext((const ucontext_t *)ucp->uc_link);
+
+		abort(); /* should never return from above call */
+	}
+}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list