[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Wed Feb 1 10:56:58 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/447c2b301507
changeset: 323:447c2b301507
user:      ray at terran.dlink.ua
date:      Wed Feb 01 11:55:32 2012 +0200
description:
Update libs

diffstat:

 head/lib/libc/amd64/gen/Makefile.inc            |    4 +-
 head/lib/libc/amd64/gen/getcontextx.c           |  101 ++++++++++++++++++
 head/lib/libc/arm/gen/Makefile.inc              |    4 +-
 head/lib/libc/arm/gen/flt_rounds.c              |    4 +-
 head/lib/libc/arm/gen/getcontextx.c             |   69 ++++++++++++
 head/lib/libc/gen/Symbol.map                    |    5 +-
 head/lib/libc/gen/getcontext.3                  |   33 +++++-
 head/lib/libc/gen/ucontext.3                    |    6 +-
 head/lib/libc/i386/gen/Makefile.inc             |    4 +-
 head/lib/libc/i386/gen/getcontextx.c            |  133 ++++++++++++++++++++++++
 head/lib/libc/ia64/gen/Makefile.inc             |    4 +-
 head/lib/libc/ia64/gen/getcontextx.c            |   69 ++++++++++++
 head/lib/libc/mips/gen/Makefile.inc             |    5 +-
 head/lib/libc/mips/gen/getcontextx.c            |   69 ++++++++++++
 head/lib/libc/powerpc/gen/Makefile.inc          |    4 +-
 head/lib/libc/powerpc/gen/getcontextx.c         |   69 ++++++++++++
 head/lib/libc/powerpc64/gen/Makefile.inc        |    4 +-
 head/lib/libc/powerpc64/gen/getcontextx.c       |   69 ++++++++++++
 head/lib/libc/powerpc64/sys/cerror.S            |    4 +-
 head/lib/libc/softfloat/Makefile.inc            |   14 ++-
 head/lib/libc/softfloat/bits32/softfloat-macros |    6 +-
 head/lib/libc/softfloat/bits64/softfloat-macros |    8 +-
 head/lib/libc/softfloat/bits64/softfloat.c      |  105 ++++++++++++++++++-
 head/lib/libc/softfloat/eqtf2.c                 |   24 ++++
 head/lib/libc/softfloat/getf2.c                 |   26 ++++
 head/lib/libc/softfloat/gexf2.c                 |   25 ++++
 head/lib/libc/softfloat/gttf2.c                 |   26 ++++
 head/lib/libc/softfloat/gtxf2.c                 |   25 ++++
 head/lib/libc/softfloat/letf2.c                 |   26 ++++
 head/lib/libc/softfloat/lttf2.c                 |   26 ++++
 head/lib/libc/softfloat/negtf2.c                |   27 ++++
 head/lib/libc/softfloat/negxf2.c                |   25 ++++
 head/lib/libc/softfloat/netf2.c                 |   26 ++++
 head/lib/libc/softfloat/nexf2.c                 |   25 ++++
 head/lib/libc/softfloat/softfloat-for-gcc.h     |  130 +++++++++++++++++++++++-
 head/lib/libc/softfloat/softfloat-source.txt    |    6 +-
 head/lib/libc/softfloat/softfloat-specialize    |   35 +++++-
 head/lib/libc/softfloat/softfloat.txt           |    6 +-
 head/lib/libc/sparc64/gen/Makefile.inc          |    4 +-
 head/lib/libc/sparc64/gen/getcontextx.c         |   69 ++++++++++++
 head/lib/libc/sys/close.2                       |    8 +-
 head/lib/libc/sys/fcntl.2                       |   36 +++---
 head/lib/libc/sys/mmap.2                        |    5 +-
 head/lib/libc/sys/read.2                        |    6 +-
 head/lib/libc/sys/write.2                       |    6 +-
 head/lib/libdisk/libdisk.h                      |    4 +-
 head/lib/libfetch/common.c                      |   59 ++++++++++-
 head/lib/libfetch/common.h                      |    9 +-
 head/lib/libfetch/http.c                        |   19 ++-
 head/lib/libpam/modules/pam_unix/Makefile       |    6 +-
 head/lib/libthr/thread/thr_sig.c                |   19 ++-
 head/lib/libutil/libutil.h                      |  117 ++++++++++----------
 head/lib/libutil/pidfile.3                      |    3 +-
 head/lib/libutil/property.3                     |    3 +-
 head/lib/libutil/realhostname.3                 |    4 +-
 head/lib/msun/arm/Makefile.inc                  |    3 +-
 head/lib/msun/arm/Symbol.map                    |    7 +-
 head/lib/msun/arm/fenv.c                        |   16 ++-
 head/lib/msun/arm/fenv.h                        |   27 ++--
 head/lib/msun/src/k_expf.c                      |    4 +-
 60 files changed, 1502 insertions(+), 183 deletions(-)

diffs (2658 lines):

diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/amd64/gen/Makefile.inc
--- a/head/lib/libc/amd64/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/amd64/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,8 +1,8 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-# $FreeBSD: head/lib/libc/amd64/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/amd64/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS+=	_setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \
-	fabs.S \
+	fabs.S getcontextx.c \
 	infinity.c ldexp.c makecontext.c signalcontext.c \
 	flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \
 	fpgetround.c fpsetround.c fpgetsticky.c
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/amd64/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/amd64/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/amd64/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <machine/cpufunc.h>
+#include <machine/fpu.h>
+#include <machine/specialreg.h>
+#include <machine/sysarch.h>
+
+static int xstate_sz = -1;
+
+size_t
+__getcontextx_size(void)
+{
+	u_int p[4];
+
+	if (xstate_sz == -1) {
+		do_cpuid(1, p);
+		if ((p[2] & CPUID2_OSXSAVE) != 0) {
+			cpuid_count(0xd, 0x0, p);
+			xstate_sz = p[1] - sizeof(struct savefpu);
+		} else
+			xstate_sz = 0;
+	}
+
+	return (sizeof(ucontext_t) + xstate_sz);
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	struct amd64_get_xfpustate xfpu;
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	if (getcontext(ucp) == -1)
+		return (-1);
+	if (xstate_sz != 0) {
+		xfpu.addr = (char *)(ucp + 1);
+		xfpu.len = xstate_sz;
+		if (sysarch(AMD64_GET_XFPUSTATE, &xfpu) == -1)
+			return (-1);
+		ucp->uc_mcontext.mc_xfpustate = (__register_t)xfpu.addr;
+		ucp->uc_mcontext.mc_xfpustate_len = xstate_sz;
+		ucp->uc_mcontext.mc_flags |= _MC_HASFPXSTATE;
+	} else {
+		ucp->uc_mcontext.mc_xfpustate = 0;
+		ucp->uc_mcontext.mc_xfpustate_len = 0;
+	}
+	return (0);
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/arm/gen/Makefile.inc
--- a/head/lib/libc/arm/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/arm/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,6 +1,6 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-# $FreeBSD: head/lib/libc/arm/gen/Makefile.inc 230191 2012-01-16 04:08:29Z das $
+# $FreeBSD: head/lib/libc/arm/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS+=	_ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \
-	infinity.c ldexp.c makecontext.c \
+	getcontextx.c infinity.c ldexp.c makecontext.c \
 	setjmp.S signalcontext.c sigsetjmp.S divsi3.S flt_rounds.c
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/arm/gen/flt_rounds.c
--- a/head/lib/libc/arm/gen/flt_rounds.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/arm/gen/flt_rounds.c	Wed Feb 01 11:55:32 2012 +0200
@@ -25,11 +25,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/arm/gen/flt_rounds.c 230191 2012-01-16 04:08:29Z das $");
+__FBSDID("$FreeBSD: head/lib/libc/arm/gen/flt_rounds.c 230367 2012-01-20 06:54:30Z das $");
 
 #include <fenv.h>
 #include <float.h>
 
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
 #include "softfloat.h"
 
 int
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/arm/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/arm/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/arm/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/gen/Symbol.map
--- a/head/lib/libc/gen/Symbol.map	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/gen/Symbol.map	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * $FreeBSD: head/lib/libc/gen/Symbol.map 229768 2012-01-07 10:33:01Z kib $
+ * $FreeBSD: head/lib/libc/gen/Symbol.map 230429 2012-01-21 18:00:28Z kib $
  */
 
 FBSD_1.0 {
@@ -384,6 +384,7 @@
 FBSD_1.3 {
 	 fdlopen;
 	__FreeBSD_libc_enter_restricted_mode;
+	getcontextx;
 };
 
 FBSDprivate_1.0 {
@@ -507,4 +508,6 @@
 
 	__elf_aux_vector;
 	__pthread_map_stacks_exec;
+	__fillcontextx;
+	__getcontextx_size;
 };
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/gen/getcontext.3
--- a/head/lib/libc/gen/getcontext.3	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/gen/getcontext.3	Wed Feb 01 11:55:32 2012 +0200
@@ -33,13 +33,13 @@
 .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/gen/getcontext.3 230429 2012-01-21 18:00:28Z kib $
 .\"
-.Dd September 10, 2002
+.Dd December 26, 2011
 .Dt GETCONTEXT 3
 .Os
 .Sh NAME
-.Nm getcontext , setcontext
+.Nm getcontext , getcontextx , setcontext
 .Nd get and set user thread context
 .Sh LIBRARY
 .Lb libc
@@ -59,6 +59,20 @@
 .Fn setcontext .
 .Pp
 The
+.Fn getcontextx
+function saves the current execution context in the newly allocated structure
+.Vt ucontext_t ,
+which is returned on success.
+If architecture defines additional CPU states that can be stored in extended
+blocks referenced from the
+.Vt ucontext_t ,
+the memory for them may be allocated and their context also stored.
+Memory returned by
+.Fn getcontextx
+function shall be freed using
+.Fn free 3 .
+.Pp
+The
 .Fn setcontext
 function
 makes a previously saved thread context the current thread context, i.e.,
@@ -109,11 +123,24 @@
 returns zero and
 .Fn setcontext
 does not return; otherwise \-1 is returned.
+The
+.Fn getcontextx
+returns pointer to the allocated and initialized context on success, and
+.Va NULL
+on failure.
 .Sh ERRORS
 No errors are defined for
 .Fn getcontext
 or
 .Fn setcontext .
+The
+.Fn getcontextx
+may return the following errors in
+.Va errno :
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+No memory was available to allocate for the context or some extended state.
+.El
 .Sh SEE ALSO
 .Xr sigaction 2 ,
 .Xr sigaltstack 2 ,
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/gen/ucontext.3
--- a/head/lib/libc/gen/ucontext.3	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/gen/ucontext.3	Wed Feb 01 11:55:32 2012 +0200
@@ -33,7 +33,7 @@
 .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/gen/ucontext.3 230429 2012-01-21 18:00:28Z kib $
 .\"
 .Dd September 10, 2002
 .Dt UCONTEXT 3
@@ -92,6 +92,9 @@
 .Ft int
 .Fn getcontext "ucontext_t *" ;
 .It
+.Ft "ucontext_t *"
+.Fn getcontextx "void" ;
+.It
 .Ft int
 .Fn setcontext "const ucontext_t *" ;
 .It
@@ -104,4 +107,5 @@
 .Sh SEE ALSO
 .Xr sigaltstack 2 ,
 .Xr getcontext 3 ,
+.Xr getcontextx 3 ,
 .Xr makecontext 3
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/i386/gen/Makefile.inc
--- a/head/lib/libc/i386/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/i386/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,6 +1,6 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-# $FreeBSD: head/lib/libc/i386/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/i386/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS+=	_ctx_start.S _setjmp.S _set_tp.c fabs.S \
-	flt_rounds.c infinity.c ldexp.c makecontext.c \
+	flt_rounds.c getcontextx.c infinity.c ldexp.c makecontext.c \
 	rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/i386/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/i386/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/i386/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <machine/npx.h>
+#include <machine/specialreg.h>
+#include <machine/sysarch.h>
+
+static int xstate_sz = -1;
+
+size_t
+__getcontextx_size(void)
+{
+	u_int p[4];
+	int cpuid_supported;
+
+	if (xstate_sz == -1) {
+		__asm __volatile(
+		    "	pushfl\n"
+		    "	popl	%%eax\n"
+		    "	movl    %%eax,%%ecx\n"
+		    "	xorl    $0x200000,%%eax\n"
+		    "	pushl	%%eax\n"
+		    "	popfl\n"
+		    "	pushfl\n"
+		    "	popl    %%eax\n"
+		    "	xorl    %%eax,%%ecx\n"
+		    "	je	1f\n"
+		    "	movl	$1,%0\n"
+		    "	jmp	2f\n"
+		    "1:	movl	$0,%0\n"
+		    "2:\n"
+		    : "=r" (cpuid_supported) : : "eax", "ecx");
+		if (cpuid_supported) {
+			__asm __volatile(
+			    "	pushl	%%ebx\n"
+			    "	cpuid\n"
+			    "	movl	%%ebx,%1\n"
+			    "	popl	%%ebx\n"
+			    : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3])
+			    :  "0" (0x0));
+			if ((p[2] & CPUID2_OSXSAVE) != 0) {
+				__asm __volatile(
+				    "	pushl	%%ebx\n"
+				    "	cpuid\n"
+				    "	movl	%%ebx,%1\n"
+				    "	popl	%%ebx\n"
+				    : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]),
+					"=d" (p[3])
+				    :  "0" (0xd), "2" (0x0));
+				xstate_sz = p[1] - sizeof(struct savexmm);
+			} else
+				xstate_sz = 0;
+		} else
+			xstate_sz = 0;
+	}
+
+	return (sizeof(ucontext_t) + xstate_sz);
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	struct i386_get_xfpustate xfpu;
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	if (getcontext(ucp) == -1)
+		return (-1);
+	if (xstate_sz != 0) {
+		xfpu.addr = (char *)(ucp + 1);
+		xfpu.len = xstate_sz;
+		if (sysarch(I386_GET_XFPUSTATE, &xfpu) == -1)
+			return (-1);
+		ucp->uc_mcontext.mc_xfpustate = (__register_t)xfpu.addr;
+		ucp->uc_mcontext.mc_xfpustate_len = xstate_sz;
+		ucp->uc_mcontext.mc_flags |= _MC_HASFPXSTATE;
+	} else {
+		ucp->uc_mcontext.mc_xfpustate = 0;
+		ucp->uc_mcontext.mc_xfpustate_len = 0;
+	}
+	return (0);
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/ia64/gen/Makefile.inc
--- a/head/lib/libc/ia64/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/ia64/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,9 +1,9 @@
-# $FreeBSD: head/lib/libc/ia64/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/ia64/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS+=	__divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \
 	__udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _mcount.S _set_tp.c \
 	_setjmp.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \
-	fpsetround.c infinity.c ldexp.c makecontext.c setjmp.S \
+	fpsetround.c getcontextx.c infinity.c ldexp.c makecontext.c setjmp.S \
 	signalcontext.c sigsetjmp.S
 
 # The following may go away if function _Unwind_FindTableEntry()
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/ia64/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/ia64/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/ia64/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/mips/gen/Makefile.inc
--- a/head/lib/libc/mips/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/mips/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,9 +1,10 @@
 #	$NetBSD: Makefile.inc,v 1.27 2005/10/07 17:16:40 tsutsui Exp $
-# $FreeBSD: head/lib/libc/mips/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/mips/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 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
+SRCS+=	_ctx_start.S _set_tp.c _setjmp.S getcontextx.c makecontext.c \
+	setjmp.S signalcontext.c sigsetjmp.S
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/mips/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/mips/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/mips/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/powerpc/gen/Makefile.inc
--- a/head/lib/libc/powerpc/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/powerpc/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,7 +1,7 @@
-# $FreeBSD: head/lib/libc/powerpc/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/powerpc/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \
-	fpgetsticky.c fpsetmask.c fpsetround.c \
+	fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \
 	infinity.c ldexp.c makecontext.c _setjmp.S \
 	setjmp.S sigsetjmp.S signalcontext.c syncicache.c \
 	_set_tp.c
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/powerpc/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/powerpc/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/powerpc/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/powerpc64/gen/Makefile.inc
--- a/head/lib/libc/powerpc64/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/powerpc64/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,7 +1,7 @@
-# $FreeBSD: head/lib/libc/powerpc64/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/powerpc64/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \
-	fpgetsticky.c fpsetmask.c fpsetround.c \
+	fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \
 	infinity.c ldexp.c makecontext.c _setjmp.S \
 	setjmp.S sigsetjmp.S signalcontext.c syncicache.c \
 	_set_tp.c
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/powerpc64/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/powerpc64/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/powerpc64/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/powerpc64/sys/cerror.S
--- a/head/lib/libc/powerpc64/sys/cerror.S	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/powerpc64/sys/cerror.S	Wed Feb 01 11:55:32 2012 +0200
@@ -26,7 +26,7 @@
 /*      $NetBSD: cerror.S,v 1.5 2000/01/27 14:58:48 kleink Exp $        */
 
 #include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/powerpc64/sys/cerror.S 230400 2012-01-20 22:34:19Z andreast $");
 	
 #include "SYS.h"
 
@@ -38,7 +38,7 @@
 	 * programs and the initial threaded in threaded programs,
 	 * it returns a pointer to the global errno variable.
 	 */
-ENTRY(HIDENAME(cerror))
+ENTRY_NOPROF(HIDENAME(cerror))
 	mflr	%r0
 	std	%r0,16(%r1)		/* save lr */
 	stdu	%r1,-64(%r1)		/* allocate new stack frame */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/Makefile.inc
--- a/head/lib/libc/softfloat/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-#	$NetBSD: Makefile.inc,v 1.3 2003/05/06 08:58:20 rearnsha Exp $
-# $FreeBSD$
+#	$NetBSD: Makefile.inc,v 1.10 2011/07/04 02:53:15 mrg Exp $
+# $FreeBSD: head/lib/libc/softfloat/Makefile.inc 230363 2012-01-20 06:16:14Z das $
 
 SOFTFLOAT_BITS?=64
 .PATH:		${LIBC_ARCH}/softfloat \
@@ -17,4 +17,14 @@
 		eqdf2.c nedf2.c gtdf2.c gedf2.c ltdf2.c ledf2.c negdf2.c \
 		unordsf2.c unorddf2.c
 
+.if defined(SOFTFLOAT_128)
+CFLAGS+=	-DFLOAT128
+SRCS+=		eqtf2.c netf2.c gttf2.c getf2.c lttf2.c letf2.c negtf2.c
+.endif
+
+.if defined(SOFTFLOAT_X80)
+CFLAGS+=	-DFLOATX80
+SRCS+=		nexf2.c gtxf2.c gexf2.c negxf2.c
+.endif
+
 SYM_MAPS+=	${.CURDIR}/softfloat/Symbol.map
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/bits32/softfloat-macros
--- a/head/lib/libc/softfloat/bits32/softfloat-macros	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/bits32/softfloat-macros	Wed Feb 01 11:55:32 2012 +0200
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/lib/libc/softfloat/bits32/softfloat-macros 230363 2012-01-20 06:16:14Z das $ */
 
 /*
 ===============================================================================
@@ -312,7 +312,7 @@
     carry0 = ( z1 < a1 );
     z0 = a0 + b0;
     z1 += carry1;
-    z0 += ( z1 < carry1 );
+    z0 += ( z1 < (bits32)carry1 );
     z0 += carry0;
     *z2Ptr = z2;
     *z1Ptr = z1;
@@ -369,7 +369,7 @@
     z1 = a1 - b1;
     borrow0 = ( a1 < b1 );
     z0 = a0 - b0;
-    z0 -= ( z1 < borrow1 );
+    z0 -= ( z1 < (bits32)borrow1 );
     z1 -= borrow1;
     z0 -= borrow0;
     *z2Ptr = z2;
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/bits64/softfloat-macros
--- a/head/lib/libc/softfloat/bits64/softfloat-macros	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/bits64/softfloat-macros	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-/* $NetBSD: softfloat-macros,v 1.1 2002/05/21 23:51:08 bjh21 Exp $ */
-/* $FreeBSD$ */
+/* $NetBSD: softfloat-macros,v 1.2 2009/02/16 10:23:35 tron Exp $ */
+/* $FreeBSD: head/lib/libc/softfloat/bits64/softfloat-macros 230363 2012-01-20 06:16:14Z das $ */
 
 /*
 ===============================================================================
@@ -387,7 +387,7 @@
     carry0 = ( z1 < a1 );
     z0 = a0 + b0;
     z1 += carry1;
-    z0 += ( z1 < carry1 );
+    z0 += ( z1 < (bits64)carry1 );
     z0 += carry0;
     *z2Ptr = z2;
     *z1Ptr = z1;
@@ -444,7 +444,7 @@
     z1 = a1 - b1;
     borrow0 = ( a1 < b1 );
     z0 = a0 - b0;
-    z0 -= ( z1 < borrow1 );
+    z0 -= ( z1 < (bits64)borrow1 );
     z1 -= borrow1;
     z0 -= borrow0;
     *z2Ptr = z2;
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/bits64/softfloat.c
--- a/head/lib/libc/softfloat/bits64/softfloat.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/bits64/softfloat.c	Wed Feb 01 11:55:32 2012 +0200
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.2 2003/07/26 19:24:52 salo Exp $ */
+/* $NetBSD: softfloat.c,v 1.8 2011/07/10 04:52:23 matt Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -45,7 +45,7 @@
 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/softfloat/bits64/softfloat.c 230189 2012-01-16 04:05:53Z das $");
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/bits64/softfloat.c 230380 2012-01-20 14:44:21Z das $");
 
 #ifdef SOFTFLOAT_FOR_GCC
 #include "softfloat-for-gcc.h"
@@ -1126,6 +1126,17 @@
 
 }
 
+#ifndef SOFTFLOAT_FOR_GCC /* __floatunsisf is in libgcc */
+float32 uint32_to_float32( uint32 a )
+{
+    if ( a == 0 ) return 0;
+    if ( a & (bits32) 0x80000000 )
+	return normalizeRoundAndPackFloat32( 0, 0x9D, a >> 1 );
+    return normalizeRoundAndPackFloat32( 0, 0x9C, a );
+}
+#endif
+
+
 /*
 -------------------------------------------------------------------------------
 Returns the result of converting the 32-bit two's complement integer `a'
@@ -1149,6 +1160,19 @@
 
 }
 
+#ifndef SOFTFLOAT_FOR_GCC /* __floatunsidf is in libgcc */
+float64 uint32_to_float64( uint32 a )
+{
+    int8 shiftCount;
+    bits64 zSig = a;
+
+    if ( a == 0 ) return 0;
+    shiftCount = countLeadingZeros32( a ) + 21;
+    return packFloat64( 0, 0x432 - shiftCount, zSig<<shiftCount );
+
+}
+#endif
+
 #ifdef FLOATX80
 
 /*
@@ -1175,6 +1199,17 @@
 
 }
 
+floatx80 uint32_to_floatx80( uint32 a )
+{
+    int8 shiftCount;
+    bits64 zSig = a;
+
+    if ( a == 0 ) return packFloatx80( 0, 0, 0 );
+    shiftCount = countLeadingZeros32( a ) + 32;
+    return packFloatx80( 0, 0x403E - shiftCount, zSig<<shiftCount );
+
+}
+
 #endif
 
 #ifdef FLOAT128
@@ -1202,6 +1237,17 @@
 
 }
 
+float128 uint32_to_float128( uint32 a )
+{
+    int8 shiftCount;
+    bits64 zSig0 = a;
+
+    if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
+    shiftCount = countLeadingZeros32( a ) + 17;
+    return packFloat128( 0, 0x402E - shiftCount, zSig0<<shiftCount, 0 );
+
+}
+
 #endif
 
 #ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */
@@ -4438,6 +4484,59 @@
 
 }
 
+#if (defined(SOFTFLOATSPARC64_FOR_GCC) || defined(SOFTFLOAT_FOR_GCC)) \
+    && defined(SOFTFLOAT_NEED_FIXUNS)
+/*
+ * just like above - but do not care for overflow of signed results
+ */
+uint64 float128_to_uint64_round_to_zero( float128 a )
+{
+    flag aSign;
+    int32 aExp, shiftCount;
+    bits64 aSig0, aSig1;
+    uint64 z;
+
+    aSig1 = extractFloat128Frac1( a );
+    aSig0 = extractFloat128Frac0( a );
+    aExp = extractFloat128Exp( a );
+    aSign = extractFloat128Sign( a );
+    if ( aExp ) aSig0 |= LIT64( 0x0001000000000000 );
+    shiftCount = aExp - 0x402F;
+    if ( 0 < shiftCount ) {
+        if ( 0x403F <= aExp ) {
+            aSig0 &= LIT64( 0x0000FFFFFFFFFFFF );
+            if (    ( a.high == LIT64( 0xC03E000000000000 ) )
+                 && ( aSig1 < LIT64( 0x0002000000000000 ) ) ) {
+                if ( aSig1 ) float_exception_flags |= float_flag_inexact;
+            }
+            else {
+                float_raise( float_flag_invalid );
+            }
+            return LIT64( 0xFFFFFFFFFFFFFFFF );
+        }
+        z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) & 63 ) );
+        if ( (bits64) ( aSig1<<shiftCount ) ) {
+            float_exception_flags |= float_flag_inexact;
+        }
+    }
+    else {
+        if ( aExp < 0x3FFF ) {
+            if ( aExp | aSig0 | aSig1 ) {
+                float_exception_flags |= float_flag_inexact;
+            }
+            return 0;
+        }
+        z = aSig0>>( - shiftCount );
+        if (aSig1 || ( shiftCount && (bits64) ( aSig0<<( shiftCount & 63 ) ) ) ) {
+            float_exception_flags |= float_flag_inexact;
+        }
+    }
+    if ( aSign ) z = - z;
+    return z;
+
+}
+#endif /* (SOFTFLOATSPARC64_FOR_GCC || SOFTFLOAT_FOR_GCC) && SOFTFLOAT_NEED_FIXUNS */
+
 /*
 -------------------------------------------------------------------------------
 Returns the result of converting the quadruple-precision floating-point
@@ -5110,7 +5209,7 @@
         sub128( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 );
     } while ( 0 <= (sbits64) aSig0 );
     add128(
-        aSig0, aSig1, alternateASig0, alternateASig1, &sigMean0, &sigMean1 );
+        aSig0, aSig1, alternateASig0, alternateASig1, (bits64 *)&sigMean0, &sigMean1 );
     if (    ( sigMean0 < 0 )
          || ( ( ( sigMean0 | sigMean1 ) == 0 ) && ( q & 1 ) ) ) {
         aSig0 = alternateASig0;
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/eqtf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/eqtf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,24 @@
+/* $NetBSD: eqtf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/eqtf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#ifdef FLOAT128
+flag __eqtf2(float128, float128);
+
+flag
+__eqtf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says !(a == b) */
+	return !float128_eq(a, b);
+}
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/getf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/getf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,26 @@
+/* $NetBSD: getf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/getf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+flag __getf2(float128, float128);
+
+flag
+__getf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says (a >= b) - 1 */
+	return float128_le(b, a) - 1;
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/gexf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/gexf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,25 @@
+/* $NetBSD: gexf2.c,v 1.2 2004/09/27 10:16:24 he Exp $ */
+
+/*
+ * Written by Ben Harris, 2000.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/gexf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOATX80
+
+flag __gexf2(floatx80, floatx80);
+
+flag
+__gexf2(floatx80 a, floatx80 b)
+{
+
+	/* libgcc1.c says (a >= b) - 1 */
+	return floatx80_le(b, a) - 1;
+}
+#endif /* FLOATX80 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/gttf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/gttf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,26 @@
+/* $NetBSD: gttf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/gttf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+flag __gttf2(float128, float128);
+
+flag
+__gttf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says a > b */
+	return float128_lt(b, a);
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/gtxf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/gtxf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,25 @@
+/* $NetBSD: gtxf2.c,v 1.2 2004/09/27 10:16:24 he Exp $ */
+
+/*
+ * Written by Ben Harris, 2000.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/gtxf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOATX80
+
+flag __gtxf2(floatx80, floatx80);
+
+flag
+__gtxf2(floatx80 a, floatx80 b)
+{
+
+	/* libgcc1.c says a > b */
+	return floatx80_lt(b, a);
+}
+#endif /* FLOATX80 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/letf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/letf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,26 @@
+/* $NetBSD: letf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/letf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+flag __letf2(float128, float128);
+
+flag
+__letf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says 1 - (a <= b) */
+	return 1 - float128_le(a, b);
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/lttf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/lttf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,26 @@
+/* $NetBSD: lttf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/lttf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+flag __lttf2(float128, float128);
+
+flag
+__lttf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says -(a < b) */
+	return -float128_lt(a, b);
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/negtf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/negtf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,27 @@
+/* $NetBSD: negtf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/negtf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+float128 __negtf2(float128);
+
+float128
+__negtf2(float128 a)
+{
+
+	/* libgcc1.c says -a */
+	a.high ^= FLOAT64_MANGLE(0x8000000000000000ULL);
+	return a;
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/negxf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/negxf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,25 @@
+/* $NetBSD: negxf2.c,v 1.2 2004/09/27 10:16:24 he Exp $ */
+
+/*
+ * Written by Ben Harris, 2000.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/negxf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOATX80
+
+floatx80 __negxf2(floatx80);
+
+floatx80
+__negxf2(floatx80 a)
+{
+
+	/* libgcc1.c says -a */
+	return __mulxf3(a,__floatsixf(-1));
+}
+#endif /* FLOATX80 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/netf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/netf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,26 @@
+/* $NetBSD: netf2.c,v 1.1 2011/01/17 10:08:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/netf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOAT128
+
+flag __netf2(float128, float128);
+
+flag
+__netf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says a != b */
+	return !float128_eq(a, b);
+}
+
+#endif /* FLOAT128 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/nexf2.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/softfloat/nexf2.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,25 @@
+/* $NetBSD: nexf2.c,v 1.2 2004/09/27 10:16:24 he Exp $ */
+
+/*
+ * Written by Ben Harris, 2000.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/lib/libc/softfloat/nexf2.c 230363 2012-01-20 06:16:14Z das $");
+
+#ifdef FLOATX80
+
+flag __nexf2(floatx80, floatx80);
+
+flag
+__nexf2(floatx80 a, floatx80 b)
+{
+
+	/* libgcc1.c says a != b */
+	return !floatx80_eq(a, b);
+}
+#endif /* FLOATX80 */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/softfloat-for-gcc.h
--- a/head/lib/libc/softfloat/softfloat-for-gcc.h	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/softfloat-for-gcc.h	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-/* $NetBSD: softfloat-for-gcc.h,v 1.6 2003/07/26 19:24:51 salo Exp $ */
-/* $FreeBSD: head/lib/libc/softfloat/softfloat-for-gcc.h 230190 2012-01-16 04:06:56Z das $ */
+/* $NetBSD: softfloat-for-gcc.h,v 1.8 2009/12/14 01:07:42 matt Exp $ */
+/* $FreeBSD: head/lib/libc/softfloat/softfloat-for-gcc.h 230363 2012-01-20 06:16:14Z das $ */
 
 /*
  * Move private identifiers with external linkage into implementation
@@ -16,6 +16,9 @@
 #define float64_eq		__softfloat_float64_eq
 #define float64_le		__softfloat_float64_le
 #define float64_lt		__softfloat_float64_lt
+#define float128_eq		__softfloat_float128_eq
+#define float128_le		__softfloat_float128_le
+#define float128_lt		__softfloat_float128_lt
 
 /*
  * Macros to define functions with the GCC expected names
@@ -23,21 +26,144 @@
 
 #define float32_add			__addsf3
 #define float64_add			__adddf3
+#define floatx80_add			__addxf3
+#define float128_add			__addtf3
+
 #define float32_sub			__subsf3
 #define float64_sub			__subdf3
+#define floatx80_sub			__subxf3
+#define float128_sub			__subtf3
+
 #define float32_mul			__mulsf3
 #define float64_mul			__muldf3
+#define floatx80_mul			__mulxf3
+#define float128_mul			__multf3
+
 #define float32_div			__divsf3
 #define float64_div			__divdf3
+#define floatx80_div			__divxf3
+#define float128_div			__divtf3
+
+#if 0
+#define float32_neg			__negsf2
+#define float64_neg			__negdf2
+#define floatx80_neg			__negxf2
+#define float128_neg			__negtf2
+#endif
+
 #define int32_to_float32		__floatsisf
 #define int32_to_float64		__floatsidf
+#define int32_to_floatx80		__floatsixf
+#define int32_to_float128		__floatsitf
+
 #define int64_to_float32		__floatdisf
 #define int64_to_float64		__floatdidf
+#define int64_to_floatx80		__floatdixf
+#define int64_to_float128		__floatditf
+
+#define int128_to_float32		__floattisf
+#define int128_to_float64		__floattidf
+#define int128_to_floatx80		__floattixf
+#define int128_to_float128		__floattitf
+
+#define uint32_to_float32		__floatunsisf
+#define uint32_to_float64		__floatunsidf
+#define uint32_to_floatx80		__floatunsixf
+#define uint32_to_float128		__floatunsitf
+
+#define uint64_to_float32		__floatundisf
+#define uint64_to_float64		__floatundidf
+#define uint64_to_floatx80		__floatundixf
+#define uint64_to_float128		__floatunditf
+
+#define uint128_to_float32		__floatuntisf
+#define uint128_to_float64		__floatuntidf
+#define uint128_to_floatx80		__floatuntixf
+#define uint128_to_float128		__floatuntitf
+
 #define float32_to_int32_round_to_zero	__fixsfsi
 #define float64_to_int32_round_to_zero	__fixdfsi
+#define floatx80_to_int32_round_to_zero __fixxfsi
+#define float128_to_int32_round_to_zero __fixtfsi
+
 #define float32_to_int64_round_to_zero	__fixsfdi
 #define float64_to_int64_round_to_zero	__fixdfdi
+#define floatx80_to_int64_round_to_zero	__fixxfdi
+#define float128_to_int64_round_to_zero	__fixtfdi
+
+#define float32_to_int128_round_to_zero __fixsfti
+#define float64_to_int128_round_to_zero __fixdfti
+#define floatx80_to_int128_round_to_zero __fixxfti
+#define float128_to_int128_round_to_zero __fixtfti
+
 #define float32_to_uint32_round_to_zero	__fixunssfsi
 #define float64_to_uint32_round_to_zero	__fixunsdfsi
+#define floatx80_to_uint32_round_to_zero	__fixunsxfsi
+#define float128_to_uint32_round_to_zero	__fixunstfsi
+
+#define float32_to_uint64_round_to_zero	__fixunssfdi
+#define float64_to_uint64_round_to_zero	__fixunsdfdi
+#define floatx80_to_uint64_round_to_zero	__fixunsxfdi
+#define float128_to_uint64_round_to_zero	__fixunstfdi
+
+#define float32_to_uint128_round_to_zero	__fixunssfti
+#define float64_to_uint128_round_to_zero	__fixunsdfti
+#define floatx80_to_uint128_round_to_zero	__fixunsxfti
+#define float128_to_uint128_round_to_zero	__fixunstfti
+
 #define float32_to_float64		__extendsfdf2
+#define float32_to_floatx80		__extendsfxf2
+#define float32_to_float128		__extendsftf2
+#define float64_to_floatx80		__extenddfxf2
+#define float64_to_float128		__extenddftf2
+
+#define float128_to_float64		__trunctfdf2
+#define floatx80_to_float64		__truncxfdf2
+#define float128_to_float32		__trunctfsf2
+#define floatx80_to_float32		__truncxfsf2
 #define float64_to_float32		__truncdfsf2
+
+#if 0
+#define float32_cmp			__cmpsf2
+#define float32_unord			__unordsf2
+#define float32_eq			__eqsf2
+#define float32_ne			__nesf2
+#define float32_ge			__gesf2
+#define float32_lt			__ltsf2
+#define float32_le			__lesf2
+#define float32_gt			__gtsf2
+#endif
+
+#if 0
+#define float64_cmp			__cmpdf2
+#define float64_unord			__unorddf2
+#define float64_eq			__eqdf2
+#define float64_ne			__nedf2
+#define float64_ge			__gedf2
+#define float64_lt			__ltdf2
+#define float64_le			__ledf2
+#define float64_gt			__gtdf2
+#endif
+
+/* XXX not in libgcc */
+#if 1
+#define floatx80_cmp			__cmpxf2
+#define floatx80_unord			__unordxf2
+#define floatx80_eq			__eqxf2
+#define floatx80_ne			__nexf2
+#define floatx80_ge			__gexf2
+#define floatx80_lt			__ltxf2
+#define floatx80_le			__lexf2
+#define floatx80_gt			__gtxf2
+#endif
+
+#if 0
+#define float128_cmp			__cmptf2
+#define float128_unord			__unordtf2
+#define float128_eq			__eqtf2
+#define float128_ne			__netf2
+#define float128_ge			__getf2
+#define float128_lt			__lttf2
+#define float128_le			__letf2
+#define float128_gt			__gttf2
+#endif
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/softfloat-source.txt
--- a/head/lib/libc/softfloat/softfloat-source.txt	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/softfloat-source.txt	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-$NetBSD: softfloat-source.txt,v 1.1 2000/06/06 08:15:10 bjh21 Exp $
-$FreeBSD$
+$NetBSD: softfloat-source.txt,v 1.2 2006/11/24 19:46:58 christos Exp $
+$FreeBSD: head/lib/libc/softfloat/softfloat-source.txt 230363 2012-01-20 06:16:14Z das $
 
 SoftFloat Release 2a Source Documentation
 
@@ -33,7 +33,7 @@
 Limitations
 
 SoftFloat as written requires an ISO/ANSI-style C compiler.  No attempt has
-been made to accomodate compilers that are not ISO-conformant.  Older ``K&R-
+been made to accommodate compilers that are not ISO-conformant.  Older ``K&R-
 style'' compilers are not adequate for compiling SoftFloat.  All testing I
 have done so far has been with the GNU C Compiler.  Compilation with other
 compilers should be possible but has not been tested.
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/softfloat-specialize
--- a/head/lib/libc/softfloat/softfloat-specialize	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/softfloat-specialize	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-/*	$NetBSD: softfloat-specialize,v 1.3 2002/05/12 13:12:45 bjh21 Exp $	*/
-/* $FreeBSD: head/lib/libc/softfloat/softfloat-specialize 230189 2012-01-16 04:05:53Z das $ */
+/*	$NetBSD: softfloat-specialize,v 1.6 2011/03/06 10:27:37 martin Exp $	*/
+/* $FreeBSD: head/lib/libc/softfloat/softfloat-specialize 230363 2012-01-20 06:16:14Z das $ */
 
 /* This is a derivative work. */
 
@@ -34,6 +34,8 @@
 */
 
 #include <signal.h>
+#include <string.h>
+#include <unistd.h>
 
 /*
 -------------------------------------------------------------------------------
@@ -58,6 +60,9 @@
 should be simply `float_exception_flags |= flags;'.
 -------------------------------------------------------------------------------
 */
+#ifdef SOFTFLOAT_FOR_GCC
+#define float_exception_mask	__softfloat_float_exception_mask
+#endif
 int float_exception_mask = 0;
 void float_raise( int flags )
 {
@@ -65,9 +70,29 @@
     float_exception_flags |= flags;
 
     if ( flags & float_exception_mask ) {
+#if 0
+	siginfo_t info;
+	memset(&info, 0, sizeof info);
+	info.si_signo = SIGFPE;
+	info.si_pid = getpid();
+	info.si_uid = geteuid();
+	if (flags & float_flag_underflow)
+	    info.si_code = FPE_FLTUND;
+	else if (flags & float_flag_overflow)
+	    info.si_code = FPE_FLTOVF;
+	else if (flags & float_flag_divbyzero)
+	    info.si_code = FPE_FLTDIV;
+	else if (flags & float_flag_invalid)
+	    info.si_code = FPE_FLTINV;
+	else if (flags & float_flag_inexact)
+	    info.si_code = FPE_FLTRES;
+	sigqueueinfo(getpid(), &info);
+#else
 	raise( SIGFPE );
+#endif
     }
 }
+#undef float_exception_mask
 
 /*
 -------------------------------------------------------------------------------
@@ -108,7 +133,8 @@
 NaN; otherwise returns 0.
 -------------------------------------------------------------------------------
 */
-#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC)
+#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC) && \
+    !defined(SOFTFLOAT_M68K_FOR_GCC)
 static
 #endif
 flag float32_is_signaling_nan( float32 a )
@@ -207,7 +233,8 @@
 NaN; otherwise returns 0.
 -------------------------------------------------------------------------------
 */
-#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC)
+#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC) && \
+    !defined(SOFTFLOATM68K_FOR_GCC)
 static
 #endif
 flag float64_is_signaling_nan( float64 a )
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/softfloat/softfloat.txt
--- a/head/lib/libc/softfloat/softfloat.txt	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/softfloat/softfloat.txt	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,5 @@
-$NetBSD: softfloat.txt,v 1.1 2000/06/06 08:15:10 bjh21 Exp $
-$FreeBSD$
+$NetBSD: softfloat.txt,v 1.2 2006/11/24 19:46:58 christos Exp $
+$FreeBSD: head/lib/libc/softfloat/softfloat.txt 230363 2012-01-20 06:16:14Z das $
 
 SoftFloat Release 2a General Documentation
 
@@ -27,7 +27,7 @@
 
 SoftFloat is written in C and is designed to work with other C code.  The
 SoftFloat header files assume an ISO/ANSI-style C compiler.  No attempt
-has been made to accomodate compilers that are not ISO-conformant.  In
+has been made to accommodate compilers that are not ISO-conformant.  In
 particular, the distributed header files will not be acceptable to any
 compiler that does not recognize function prototypes.
 
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sparc64/gen/Makefile.inc
--- a/head/lib/libc/sparc64/gen/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sparc64/gen/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,6 +1,6 @@
-# $FreeBSD: head/lib/libc/sparc64/gen/Makefile.inc 226606 2011-10-21 06:40:36Z das $
+# $FreeBSD: head/lib/libc/sparc64/gen/Makefile.inc 230429 2012-01-21 18:00:28Z kib $
 
 SRCS+=	_ctx_start.S _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpgetmask.c \
 	fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c \
-	infinity.c ldexp.c makecontext.c \
+	getcontextx.c infinity.c ldexp.c makecontext.c \
 	signalcontext.c setjmp.S sigsetjmp.S _set_tp.c
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sparc64/gen/getcontextx.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/head/lib/libc/sparc64/gen/getcontextx.c	Wed Feb 01 11:55:32 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov <kib 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 ``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: head/lib/libc/sparc64/gen/getcontextx.c 230429 2012-01-21 18:00:28Z kib $");
+
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+
+size_t
+__getcontextx_size(void)
+{
+
+	return (sizeof(ucontext_t));
+}
+
+int
+__fillcontextx(char *ctx)
+{
+	ucontext_t *ucp;
+
+	ucp = (ucontext_t *)ctx;
+	return (getcontext(ucp));
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+	char *ctx;
+	int error;
+
+	ctx = malloc(__getcontextx_size());
+	if (ctx == NULL)
+		return (NULL);
+	if (__fillcontextx(ctx) == -1) {
+		error = errno;
+		free(ctx);
+		errno = error;
+		return (NULL);
+	}
+	return ((ucontext_t *)ctx);
+}
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sys/close.2
--- a/head/lib/libc/sys/close.2	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sys/close.2	Wed Feb 01 11:55:32 2012 +0200
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)close.2	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/sys/close.2 230460 2012-01-22 11:58:17Z kib $
 .\"
-.Dd December 4, 2006
+.Dd January 22, 2012
 .Dt CLOSE 2
 .Os
 .Sh NAME
@@ -118,6 +118,10 @@
 The underlying object was a stream socket that was shut down by the peer
 before all pending data was delivered.
 .El
+.Pp
+In case of any error except
+.Er EBADF ,
+the supplied file descriptor is deallocated and therefore is no longer valid.
 .Sh SEE ALSO
 .Xr accept 2 ,
 .Xr closefrom 2 ,
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sys/fcntl.2
--- a/head/lib/libc/sys/fcntl.2	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sys/fcntl.2	Wed Feb 01 11:55:32 2012 +0200
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fcntl.2	8.2 (Berkeley) 1/12/94
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/sys/fcntl.2 230648 2012-01-28 18:35:10Z tijl $
 .\"
-.Dd September 28, 2009
+.Dd January 28, 2012
 .Dt FCNTL 2
 .Os
 .Sh NAME
@@ -143,6 +143,22 @@
 as negative, otherwise
 .Fa arg
 is interpreted as a process ID.
+.It Dv F_READAHEAD
+Set or clear the read ahead amount for sequential access to the third
+argument,
+.Fa arg ,
+which is rounded up to the nearest block size.
+A zero value in
+.Fa arg
+turns off read ahead.
+.It Dv F_RDAHEAD
+Equivalent to Darwin counterpart which sets read ahead amount of 128KB
+when the third argument,
+.Fa arg
+is non-zero.
+A zero value in
+.Fa arg
+turns off read ahead.
 .El
 .Pp
 The flags for the
@@ -241,22 +257,6 @@
 .Dv SA_RESTART
 (see
 .Xr sigaction 2 ) .
-.It Dv F_READAHEAD
-Set or clear the read ahead amount for sequential access to the third
-argument,
-.Fa arg ,
-which is rounded up to the nearest block size.
-A zero value in
-.Fa arg
-turns off read ahead.
-.It Dv F_RDAHEAD
-Equivalent to Darwin counterpart which sets read ahead amount of 128KB
-when the third argument,
-.Fa arg
-is non-zero.
-A zero value in
-.Fa arg
-turns off read ahead.
 .El
 .Pp
 When a shared lock has been set on a segment of a file,
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sys/mmap.2
--- a/head/lib/libc/sys/mmap.2	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sys/mmap.2	Wed Feb 01 11:55:32 2012 +0200
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mmap.2	8.4 (Berkeley) 5/11/95
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/sys/mmap.2 230613 2012-01-27 13:26:19Z pluknet $
 .\"
 .Dd August 28, 2010
 .Dt MMAP 2
@@ -356,8 +356,7 @@
 .Xr msync 2 ,
 .Xr munlock 2 ,
 .Xr munmap 2 ,
-.Xr getpagesize 3 ,
-.Xr make.conf 5
+.Xr getpagesize 3
 .Sh BUGS
 The
 .Fa len
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sys/read.2
--- a/head/lib/libc/sys/read.2	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sys/read.2	Wed Feb 01 11:55:32 2012 +0200
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)read.2	8.4 (Berkeley) 2/26/94
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/sys/read.2 230456 2012-01-22 11:15:48Z pjd $
 .\"
-.Dd October 11, 2006
+.Dd January 22, 2012
 .Dt READ 2
 .Os
 .Sh NAME
@@ -41,12 +41,12 @@
 .Lb libc
 .Sh SYNOPSIS
 .In sys/types.h
-.In sys/uio.h
 .In unistd.h
 .Ft ssize_t
 .Fn read "int d" "void *buf" "size_t nbytes"
 .Ft ssize_t
 .Fn pread "int d" "void *buf" "size_t nbytes" "off_t offset"
+.In sys/uio.h
 .Ft ssize_t
 .Fn readv "int d" "const struct iovec *iov" "int iovcnt"
 .Ft ssize_t
diff -r 625a24901dfe -r 447c2b301507 head/lib/libc/sys/write.2
--- a/head/lib/libc/sys/write.2	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libc/sys/write.2	Wed Feb 01 11:55:32 2012 +0200
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)write.2	8.5 (Berkeley) 4/2/94
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libc/sys/write.2 230456 2012-01-22 11:15:48Z pjd $
 .\"
-.Dd July 7, 2005
+.Dd January 22, 2012
 .Dt WRITE 2
 .Os
 .Sh NAME
@@ -41,12 +41,12 @@
 .Lb libc
 .Sh SYNOPSIS
 .In sys/types.h
-.In sys/uio.h
 .In unistd.h
 .Ft ssize_t
 .Fn write "int d" "const void *buf" "size_t nbytes"
 .Ft ssize_t
 .Fn pwrite "int d" "const void *buf" "size_t nbytes" "off_t offset"
+.In sys/uio.h
 .Ft ssize_t
 .Fn writev "int d" "const struct iovec *iov" "int iovcnt"
 .Ft ssize_t
diff -r 625a24901dfe -r 447c2b301507 head/lib/libdisk/libdisk.h
--- a/head/lib/libdisk/libdisk.h	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libdisk/libdisk.h	Wed Feb 01 11:55:32 2012 +0200
@@ -6,7 +6,7 @@
 * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
 * ----------------------------------------------------------------------------
 *
-* $FreeBSD$
+* $FreeBSD: head/lib/libdisk/libdisk.h 230369 2012-01-20 06:59:29Z das $
 *
 */
 
@@ -293,8 +293,6 @@
 int MakeDevChunk(const struct chunk *, const char *);
 __END_DECLS
 
-#define dprintf	printf
-
 /* TODO
  *
  * Need an error string mechanism from the functions instead of warn()
diff -r 625a24901dfe -r 447c2b301507 head/lib/libfetch/common.c
--- a/head/lib/libfetch/common.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libfetch/common.c	Wed Feb 01 11:55:32 2012 +0200
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libfetch/common.c 226537 2011-10-19 11:43:51Z des $");
+__FBSDID("$FreeBSD: head/lib/libfetch/common.c 230478 2012-01-23 09:23:07Z des $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -404,6 +404,33 @@
 }
 #endif
 
+/*
+ * Cache some data that was read from a socket but cannot be immediately
+ * returned because of an interrupted system call.
+ */
+static int
+fetch_cache_data(conn_t *conn, char *src, size_t nbytes)
+{
+	char *tmp;
+
+	if (conn->cache.size < nbytes) {
+		tmp = realloc(conn->cache.buf, nbytes);
+		if (tmp == NULL) {
+			fetch_syserr();
+			return (-1);
+		}
+		conn->cache.buf = tmp;
+		conn->cache.size = nbytes;
+	}
+
+	memcpy(conn->cache.buf, src, nbytes);
+	conn->cache.len = nbytes;
+	conn->cache.pos = 0;
+
+	return (0);
+}
+
+
 static ssize_t
 fetch_socket_read(int sd, char *buf, size_t len)
 {
@@ -429,6 +456,7 @@
 	fd_set readfds;
 	ssize_t rlen, total;
 	int r;
+	char *start;
 
 	if (fetchTimeout) {
 		FD_ZERO(&readfds);
@@ -437,6 +465,24 @@
 	}
 
 	total = 0;
+	start = buf;
+
+	if (conn->cache.len > 0) {
+		/*
+		 * The last invocation of fetch_read was interrupted by a
+		 * signal after some data had been read from the socket. Copy
+		 * the cached data into the supplied buffer before trying to
+		 * read from the socket again.
+		 */
+		total = (conn->cache.len < len) ? conn->cache.len : len;
+		memcpy(buf, conn->cache.buf, total);
+
+		conn->cache.len -= total;
+		conn->cache.pos += total;
+		len -= total;
+		buf += total;
+	}
+
 	while (len > 0) {
 		/*
 		 * The socket is non-blocking.  Instead of the canonical
@@ -472,6 +518,8 @@
 			total += rlen;
 			continue;
 		} else if (rlen == FETCH_READ_ERROR) {
+			if (errno == EINTR)
+				fetch_cache_data(conn, start, total);
 			return (-1);
 		}
 		// assert(rlen == FETCH_READ_WAIT);
@@ -492,8 +540,12 @@
 			errno = 0;
 			r = select(conn->sd + 1, &readfds, NULL, NULL, &delta);
 			if (r == -1) {
-				if (errno == EINTR && fetchRestartCalls)
-					continue;
+				if (errno == EINTR) {
+					if (fetchRestartCalls)
+						continue;
+					/* Save anything that was read. */
+					fetch_cache_data(conn, start, total);
+				}
 				fetch_syserr();
 				return (-1);
 			}
@@ -677,6 +729,7 @@
 	if (--conn->ref > 0)
 		return (0);
 	ret = close(conn->sd);
+	free(conn->cache.buf);
 	free(conn->buf);
 	free(conn);
 	return (ret);
diff -r 625a24901dfe -r 447c2b301507 head/lib/libfetch/common.h
--- a/head/lib/libfetch/common.h	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libfetch/common.h	Wed Feb 01 11:55:32 2012 +0200
@@ -25,7 +25,7 @@
  * (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: head/lib/libfetch/common.h 226537 2011-10-19 11:43:51Z des $
+ * $FreeBSD: head/lib/libfetch/common.h 230307 2012-01-18 15:13:21Z des $
  */
 
 #ifndef _COMMON_H_INCLUDED
@@ -52,6 +52,13 @@
 	size_t		 bufsize;	/* buffer size */
 	size_t		 buflen;	/* length of buffer contents */
 	int		 err;		/* last protocol reply code */
+	struct {			/* data cached after an interrupted
+					   read */
+		char	*buf;
+		size_t	 size;
+		size_t	 pos;
+		size_t	 len;
+	} cache;
 #ifdef WITH_SSL
 	SSL		*ssl;		/* SSL handle */
 	SSL_CTX		*ssl_ctx;	/* SSL context */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libfetch/http.c
--- a/head/lib/libfetch/http.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libfetch/http.c	Wed Feb 01 11:55:32 2012 +0200
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libfetch/http.c 226537 2011-10-19 11:43:51Z des $");
+__FBSDID("$FreeBSD: head/lib/libfetch/http.c 230307 2012-01-18 15:13:21Z des $");
 
 /*
  * The following copyright applies to the base64 code:
@@ -196,6 +196,8 @@
 static int
 http_fillbuf(struct httpio *io, size_t len)
 {
+	ssize_t nbytes;
+
 	if (io->error)
 		return (-1);
 	if (io->eof)
@@ -204,10 +206,11 @@
 	if (io->chunked == 0) {
 		if (http_growbuf(io, len) == -1)
 			return (-1);
-		if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) {
-			io->error = 1;
+		if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) {
+			io->error = errno;
 			return (-1);
 		}
+		io->buflen = nbytes;
 		io->bufpos = 0;
 		return (io->buflen);
 	}
@@ -227,10 +230,11 @@
 		len = io->chunksize;
 	if (http_growbuf(io, len) == -1)
 		return (-1);
-	if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) {
-		io->error = 1;
+	if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) {
+		io->error = errno;
 		return (-1);
 	}
+	io->buflen = nbytes;
 	io->chunksize -= io->buflen;
 
 	if (io->chunksize == 0) {
@@ -272,8 +276,11 @@
 		io->bufpos += l;
 	}
 
-	if (!pos && io->error)
+	if (!pos && io->error) {
+		if (io->error == EINTR)
+			io->error = 0;
 		return (-1);
+	}
 	return (pos);
 }
 
diff -r 625a24901dfe -r 447c2b301507 head/lib/libpam/modules/pam_unix/Makefile
--- a/head/lib/libpam/modules/pam_unix/Makefile	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libpam/modules/pam_unix/Makefile	Wed Feb 01 11:55:32 2012 +0200
@@ -32,7 +32,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: head/lib/libpam/modules/pam_unix/Makefile 228065 2011-11-28 14:01:17Z fjoe $
+# $FreeBSD: head/lib/libpam/modules/pam_unix/Makefile 230311 2012-01-18 18:26:56Z peter $
 
 .include <bsd.init.mk>
 
@@ -40,8 +40,8 @@
 SRCS=	pam_unix.c
 MAN=	pam_unix.8
 
-DPADD= ${LIBUTIL} ${LIBCRYPT}
-LDADD= -lutil -lcrypt
+DPADD+= ${LIBUTIL} ${LIBCRYPT}
+LDADD+= -lutil -lcrypt
 
 .if ${MK_NIS} != "no"
 CFLAGS+= -DYP
diff -r 625a24901dfe -r 447c2b301507 head/lib/libthr/thread/thr_sig.c
--- a/head/lib/libthr/thread/thr_sig.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libthr/thread/thr_sig.c	Wed Feb 01 11:55:32 2012 +0200
@@ -23,7 +23,7 @@
  * (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$
+ * $FreeBSD: head/lib/libthr/thread/thr_sig.c 230430 2012-01-21 18:06:18Z kib $
  */
 
 #include "namespace.h"
@@ -32,6 +32,7 @@
 #include <sys/signalvar.h>
 #include <signal.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
 #include "un-namespace.h"
@@ -314,16 +315,24 @@
 static void
 check_deferred_signal(struct pthread *curthread)
 {
-	ucontext_t uc;
+	ucontext_t *uc;
 	struct sigaction act;
 	siginfo_t info;
 
 	if (__predict_true(curthread->deferred_siginfo.si_signo == 0))
 		return;
-	getcontext(&uc);
+
+#if defined(__amd64__) || defined(__i386__)
+	uc = alloca(__getcontextx_size());
+	__fillcontextx((char *)uc);
+#else
+	ucontext_t ucv;
+	uc = &ucv;
+	getcontext(uc);
+#endif
 	if (curthread->deferred_siginfo.si_signo != 0) {
 		act = curthread->deferred_sigact;
-		uc.uc_sigmask = curthread->deferred_sigmask;
+		uc->uc_sigmask = curthread->deferred_sigmask;
 		memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t));
 		/* remove signal */
 		curthread->deferred_siginfo.si_signo = 0;
@@ -334,7 +343,7 @@
 			tact.sa_handler = SIG_DFL;
 			_sigaction(info.si_signo, &tact, NULL);
 		}
-		handle_signal(&act, info.si_signo, &info, &uc);
+		handle_signal(&act, info.si_signo, &info, uc);
 	}
 }
 
diff -r 625a24901dfe -r 447c2b301507 head/lib/libutil/libutil.h
--- a/head/lib/libutil/libutil.h	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libutil/libutil.h	Wed Feb 01 11:55:32 2012 +0200
@@ -33,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/lib/libutil/libutil.h 230037 2012-01-12 22:49:36Z ghelmer $
+ * $FreeBSD: head/lib/libutil/libutil.h 230601 2012-01-26 20:40:22Z ghelmer $
  */
 
 #ifndef _LIBUTIL_H_
@@ -49,8 +49,8 @@
 #endif
 
 #ifndef _MODE_T_DECLARED
-typedef __mode_t	mode_t;
-#define _MODE_T_DECLARED
+typedef	__mode_t	mode_t;
+#define	_MODE_T_DECLARED
 #endif
 
 #ifndef _PID_T_DECLARED
@@ -68,21 +68,18 @@
 #define	_UID_T_DECLARED
 #endif
 
-#define PROPERTY_MAX_NAME	64
-#define PROPERTY_MAX_VALUE	512
+#define	PROPERTY_MAX_NAME	64
+#define	PROPERTY_MAX_VALUE	512
 
-/* for properties.c */
+/* For properties.c. */
 typedef struct _property {
 	struct _property *next;
 	char	*name;
 	char	*value;
 } *properties;
 
-/* Avoid pulling in all the include files for no need */
+/* Avoid pulling in all the include files for no need. */
 struct in_addr;
-struct kinfo_file;
-struct kinfo_proc;
-struct kinfo_vmentry;
 struct pidfh;
 struct sockaddr;
 struct termios;
@@ -114,6 +111,12 @@
 int	login_tty(int _fd);
 int	openpty(int *_amaster, int *_aslave, char *_name,
 	    struct termios *_termp, struct winsize *_winp);
+int	pidfile_close(struct pidfh *_pfh);
+int	pidfile_fileno(const struct pidfh *_pfh);
+struct pidfh *
+	pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr);
+int	pidfile_remove(struct pidfh *_pfh);
+int	pidfile_write(struct pidfh *_pfh);
 void	properties_free(properties _list);
 char	*property_find(properties _list, const char *_name);
 properties
@@ -129,7 +132,11 @@
 int	uu_unlock(const char *_ttyname);
 int	uu_lock_txfr(const char *_ttyname, pid_t _pid);
 
-#ifdef _STDIO_H_	/* avoid adding new includes */
+/*
+ * Conditionally prototype the following functions if the include
+ * files upon which they depend have been included.
+ */
+#ifdef _STDIO_H_
 char	*fparseln(FILE *_fp, size_t *_len, size_t *_lineno,
 	    const char _delim[3], int _flags);
 #endif
@@ -147,36 +154,29 @@
 char	*pw_make_v7(const struct passwd *_pw);
 int	pw_mkdb(const char *_user);
 int	pw_lock(void);
-struct passwd
-	*pw_scan(const char *_line, int _flags);
-const char
-	*pw_tempname(void);
+struct passwd *
+	pw_scan(const char *_line, int _flags);
+const char *
+	pw_tempname(void);
 int	pw_tmp(int _mfd);
 #endif
 
 #ifdef _GRP_H_
 int 	gr_copy(int __ffd, int _tfd, const struct group *_gr,
 	    struct group *_old_gr);
-struct group
-	*gr_dup(const struct group *_gr);
+struct group *
+	gr_dup(const struct group *_gr);
 int	gr_equal(const struct group *_gr1, const struct group *_gr2);
 void	gr_fini(void);
 int	gr_init(const char *_dir, const char *_master);
 int	gr_lock(void);
 char	*gr_make(const struct group *_gr);
 int	gr_mkdb(void);
-struct group
-	*gr_scan(const char *_line);
+struct group *
+	gr_scan(const char *_line);
 int	gr_tmp(int _mdf);
 #endif
 
-int	pidfile_close(struct pidfh *_pfh);
-int	pidfile_fileno(const struct pidfh *_pfh);
-struct pidfh *
-	pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr);
-int	pidfile_remove(struct pidfh *_pfh);
-int	pidfile_write(struct pidfh *_pfh);
-
 #ifdef _UFS_UFS_QUOTA_H_
 struct fstab;
 struct quotafile;
@@ -199,22 +199,6 @@
 
 __END_DECLS
 
-#define UU_LOCK_INUSE (1)
-#define UU_LOCK_OK (0)
-#define UU_LOCK_OPEN_ERR (-1)
-#define UU_LOCK_READ_ERR (-2)
-#define UU_LOCK_CREAT_ERR (-3)
-#define UU_LOCK_WRITE_ERR (-4)
-#define UU_LOCK_LINK_ERR (-5)
-#define UU_LOCK_TRY_ERR (-6)
-#define UU_LOCK_OWNER_ERR (-7)
-
-/* return values from realhostname() */
-#define HOSTNAME_FOUND		(0)
-#define HOSTNAME_INCORRECTNAME	(1)
-#define HOSTNAME_INVALIDADDR	(2)
-#define HOSTNAME_INVALIDNAME	(3)
-
 /* fparseln(3) */
 #define	FPARSELN_UNESCESC	0x01
 #define	FPARSELN_UNESCCONT	0x02
@@ -222,26 +206,43 @@
 #define	FPARSELN_UNESCREST	0x08
 #define	FPARSELN_UNESCALL	0x0f
 
-/* pw_scan() */
-#define PWSCAN_MASTER		0x01
-#define PWSCAN_WARN		0x02
-
-/* humanize_number(3) */
-#define HN_DECIMAL		0x01
-#define HN_NOSPACE		0x02
-#define HN_B			0x04
-#define HN_DIVISOR_1000		0x08
-#define HN_IEC_PREFIXES		0x10
-
-/* maxscale = 0x07 */
-#define HN_GETSCALE		0x10
-#define HN_AUTOSCALE		0x20
-
-/* hexdump(3) */
+/* Flags for hexdump(3). */
 #define	HD_COLUMN_MASK		0xff
 #define	HD_DELIM_MASK		0xff00
 #define	HD_OMIT_COUNT		(1 << 16)
 #define	HD_OMIT_HEX		(1 << 17)
 #define	HD_OMIT_CHARS		(1 << 18)
 
+/* Values for humanize_number(3)'s flags parameter. */
+#define	HN_DECIMAL		0x01
+#define	HN_NOSPACE		0x02
+#define	HN_B			0x04
+#define	HN_DIVISOR_1000		0x08
+#define	HN_IEC_PREFIXES		0x10
+
+/* Values for humanize_number(3)'s scale parameter. */
+#define	HN_GETSCALE		0x10
+#define	HN_AUTOSCALE		0x20
+
+/* Return values from realhostname(). */
+#define	HOSTNAME_FOUND		0
+#define	HOSTNAME_INCORRECTNAME	1
+#define	HOSTNAME_INVALIDADDR	2
+#define	HOSTNAME_INVALIDNAME	3
+
+/* Flags for pw_scan(). */
+#define	PWSCAN_MASTER		0x01
+#define	PWSCAN_WARN		0x02
+
+/* Return values from uu_lock(). */
+#define	UU_LOCK_INUSE		1
+#define	UU_LOCK_OK		0
+#define	UU_LOCK_OPEN_ERR	(-1)
+#define	UU_LOCK_READ_ERR	(-2)
+#define	UU_LOCK_CREAT_ERR	(-3)
+#define	UU_LOCK_WRITE_ERR	(-4)
+#define	UU_LOCK_LINK_ERR	(-5)
+#define	UU_LOCK_TRY_ERR		(-6)
+#define	UU_LOCK_OWNER_ERR	(-7)
+
 #endif /* !_LIBUTIL_H_ */
diff -r 625a24901dfe -r 447c2b301507 head/lib/libutil/pidfile.3
--- a/head/lib/libutil/pidfile.3	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libutil/pidfile.3	Wed Feb 01 11:55:32 2012 +0200
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: head/lib/libutil/pidfile.3 230010 2012-01-12 14:13:49Z ghelmer $
+.\" $FreeBSD: head/lib/libutil/pidfile.3 230234 2012-01-16 21:25:41Z ghelmer $
 .\"
 .Dd October 16, 2011
 .Dt PIDFILE 3
@@ -36,7 +36,6 @@
 .Sh LIBRARY
 .Lb libutil
 .Sh SYNOPSIS
-.In sys/param.h
 .In libutil.h
 .Ft "struct pidfh *"
 .Fn pidfile_open "const char *path" "mode_t mode" "pid_t *pidptr"
diff -r 625a24901dfe -r 447c2b301507 head/lib/libutil/property.3
--- a/head/lib/libutil/property.3	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libutil/property.3	Wed Feb 01 11:55:32 2012 +0200
@@ -23,7 +23,7 @@
 .\" (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$
+.\" $FreeBSD: head/lib/libutil/property.3 230234 2012-01-16 21:25:41Z ghelmer $
 .\" "
 .Dd October 7, 1998
 .Dt PROPERTIES 3
@@ -36,7 +36,6 @@
 .Sh LIBRARY
 .Lb libutil
 .Sh SYNOPSIS
-.In sys/types.h
 .In libutil.h
 .Ft properties
 .Fn properties_read "int fd"
diff -r 625a24901dfe -r 447c2b301507 head/lib/libutil/realhostname.3
--- a/head/lib/libutil/realhostname.3	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/libutil/realhostname.3	Wed Feb 01 11:55:32 2012 +0200
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: head/lib/libutil/realhostname.3 230234 2012-01-16 21:25:41Z ghelmer $
 .\"
 .Dd April 6, 1999
 .Dt REALHOSTNAME 3
@@ -33,8 +33,6 @@
 .Sh LIBRARY
 .Lb libutil
 .Sh SYNOPSIS
-.In sys/types.h
-.In netinet/in.h
 .In libutil.h
 .Ft int
 .Fn realhostname "char *host" "size_t hsize" "const struct in_addr *ip"
diff -r 625a24901dfe -r 447c2b301507 head/lib/msun/arm/Makefile.inc
--- a/head/lib/msun/arm/Makefile.inc	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/msun/arm/Makefile.inc	Wed Feb 01 11:55:32 2012 +0200
@@ -1,5 +1,4 @@
-# $FreeBSD: head/lib/msun/arm/Makefile.inc 230192 2012-01-16 04:09:17Z das $
+# $FreeBSD: head/lib/msun/arm/Makefile.inc 230370 2012-01-20 07:01:58Z das $
 
-INCS += fenv-softfloat.h
 LDBL_PREC = 53
 SYM_MAPS += ${.CURDIR}/arm/Symbol.map
diff -r 625a24901dfe -r 447c2b301507 head/lib/msun/arm/Symbol.map
--- a/head/lib/msun/arm/Symbol.map	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/msun/arm/Symbol.map	Wed Feb 01 11:55:32 2012 +0200
@@ -1,12 +1,17 @@
 /*
- * $FreeBSD: head/lib/msun/arm/Symbol.map 226218 2011-10-10 15:43:09Z das $
+ * $FreeBSD: head/lib/msun/arm/Symbol.map 230367 2012-01-20 06:54:30Z das $
  */
 FBSD_1.0 {
 };
 
 FBSD_1.3 {
+	feclearexcept;
+	fegetexceptflag;
 	fesetexceptflag;
 	feraiseexcept;
+	fetestexcept;
+	fegetround;
+	fesetround;
 	fegetenv;
 	feholdexcept;
 	feupdateenv;
diff -r 625a24901dfe -r 447c2b301507 head/lib/msun/arm/fenv.c
--- a/head/lib/msun/arm/fenv.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/msun/arm/fenv.c	Wed Feb 01 11:55:32 2012 +0200
@@ -23,12 +23,26 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/lib/msun/arm/fenv.c 226415 2011-10-16 05:37:56Z das $
+ * $FreeBSD: head/lib/msun/arm/fenv.c 230367 2012-01-20 06:54:30Z das $
  */
 
 #define	__fenv_static
 #include "fenv.h"
 
+/*
+ * The following macros map between the softfloat emulator's flags and
+ * the hardware's FPSR.  The hardware this file was written for doesn't
+ * have rounding control bits, so we stick those in the system ID byte.
+ */
+#define	__set_env(env, flags, mask, rnd) env = ((flags)			\
+						| (mask)<<_FPUSW_SHIFT	\
+						| (rnd) << 24)
+#define	__env_flags(env)		((env) & FE_ALL_EXCEPT)
+#define	__env_mask(env)			(((env) >> _FPUSW_SHIFT)	\
+						& FE_ALL_EXCEPT)
+#define	__env_round(env)		(((env) >> 24) & _ROUND_MASK)
+#include "fenv-softfloat.h"
+
 #ifdef __GNUC_GNU_INLINE__
 #error "This file must be compiled with C99 'inline' semantics"
 #endif
diff -r 625a24901dfe -r 447c2b301507 head/lib/msun/arm/fenv.h
--- a/head/lib/msun/arm/fenv.h	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/msun/arm/fenv.h	Wed Feb 01 11:55:32 2012 +0200
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/lib/msun/arm/fenv.h 230192 2012-01-16 04:09:17Z das $
+ * $FreeBSD: head/lib/msun/arm/fenv.h 230367 2012-01-20 06:54:30Z das $
  */
 
 #ifndef	_FENV_H_
@@ -65,19 +65,18 @@
 #define	_ENABLE_MASK	(FE_ALL_EXCEPT << _FPUSW_SHIFT)
 
 #ifndef	ARM_HARD_FLOAT
-/*
- * The following macros map between the softfloat emulator's flags and
- * the hardware's FPSR.  The hardware this file was written for doesn't
- * have rounding control bits, so we stick those in the system ID byte.
- */
-#define	__set_env(env, flags, mask, rnd) env = ((flags)			\
-						| (mask)<<_FPUSW_SHIFT	\
-						| (rnd) << 24)
-#define	__env_flags(env)		((env) & FE_ALL_EXCEPT)
-#define	__env_mask(env)			(((env) >> _FPUSW_SHIFT)	\
-						& FE_ALL_EXCEPT)
-#define	__env_round(env)		(((env) >> 24) & _ROUND_MASK)
-#include <fenv-softfloat.h>
+
+int feclearexcept(int __excepts);
+int fegetexceptflag(fexcept_t *__flagp, int __excepts);
+int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
+int feraiseexcept(int __excepts);
+int fetestexcept(int __excepts);
+int fegetround(void);
+int fesetround(int __round);
+int fegetenv(fenv_t *__envp);
+int feholdexcept(fenv_t *__envp);
+int fesetenv(const fenv_t *__envp);
+int feupdateenv(const fenv_t *__envp);
 
 #else	/* ARM_HARD_FLOAT */
 
diff -r 625a24901dfe -r 447c2b301507 head/lib/msun/src/k_expf.c
--- a/head/lib/msun/src/k_expf.c	Wed Feb 01 11:55:09 2012 +0200
+++ b/head/lib/msun/src/k_expf.c	Wed Feb 01 11:55:32 2012 +0200
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 226597 2011-10-21 06:27:56Z das $");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 230371 2012-01-20 07:02:42Z das $");
 
 #include <complex.h>
 
@@ -44,7 +44,7 @@
 static float
 __frexp_expf(float x, int *expt)
 {
-	double exp_x;
+	float exp_x;
 	uint32_t hx;
 
 	exp_x = expf(x - kln2);


More information about the Zrouter-src-freebsd mailing list