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

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:39:31 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/eaa303571293
changeset: 389:eaa303571293
user:      ray at terran.dlink.ua
date:      Fri Mar 02 17:14:11 2012 +0200
description:
Update to FreeBSD-HEAD @232391

diffstat:

 head/sys/i386/i386/trap.c           |   11 +-
 head/sys/i386/ibcs2/imgact_coff.c   |   18 +--
 head/sys/i386/include/_limits.h     |   87 +-----------------
 head/sys/i386/include/_stdint.h     |  171 +-----------------------------------
 head/sys/i386/include/_types.h      |  128 +--------------------------
 head/sys/i386/include/apicvar.h     |   32 +------
 head/sys/i386/include/endian.h      |  145 +-----------------------------
 head/sys/i386/include/segments.h    |    4 +-
 head/sys/i386/include/setjmp.h      |   50 +---------
 head/sys/i386/include/stdarg.h      |   90 +------------------
 head/sys/i386/include/xen/xenpmap.h |   13 +--
 head/sys/i386/include/xen/xenvar.h  |    8 +-
 head/sys/i386/linux/imgact_linux.c  |   28 ++---
 head/sys/i386/linux/linux_sysvec.c  |   10 +-
 14 files changed, 56 insertions(+), 739 deletions(-)

diffs (1022 lines):

diff -r de99a27dd03c -r eaa303571293 head/sys/i386/i386/trap.c
--- a/head/sys/i386/i386/trap.c	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/i386/trap.c	Fri Mar 02 17:14:11 2012 +0200
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/i386/i386/trap.c 227399 2011-11-09 18:25:50Z kib $");
+__FBSDID("$FreeBSD: head/sys/i386/i386/trap.c 232231 2012-02-27 17:31:38Z jhb $");
 
 /*
  * 386 Trap and System call handling
@@ -304,8 +304,9 @@
 			uprintf(
 			    "pid %ld (%s): trap %d with interrupts disabled\n",
 			    (long)curproc->p_pid, curthread->td_name, type);
-		else if (type != T_BPTFLT && type != T_TRCTRAP &&
-			 frame->tf_eip != (int)cpu_switch_load_gs) {
+		else if (type != T_NMI && type != T_BPTFLT &&
+		    type != T_TRCTRAP &&
+		    frame->tf_eip != (int)cpu_switch_load_gs) {
 			/*
 			 * XXX not quite right, since this may be for a
 			 * multiple fault in user mode.
@@ -315,9 +316,9 @@
 			/*
 			 * Page faults need interrupts disabled until later,
 			 * and we shouldn't enable interrupts while holding
-			 * a spin lock or if servicing an NMI.
+			 * a spin lock.
 			 */
-			if (type != T_NMI && type != T_PAGEFLT &&
+			if (type != T_PAGEFLT &&
 			    td->td_md.md_spinlock_count == 0)
 				enable_intr();
 		}
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/ibcs2/imgact_coff.c
--- a/head/sys/i386/ibcs2/imgact_coff.c	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/ibcs2/imgact_coff.c	Fri Mar 02 17:14:11 2012 +0200
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/i386/ibcs2/imgact_coff.c 230132 2012-01-15 13:23:18Z uqs $");
+__FBSDID("$FreeBSD: head/sys/i386/ibcs2/imgact_coff.c 231885 2012-02-17 23:47:16Z kib $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -146,10 +146,7 @@
 
 	error = copyout(data_buf, (caddr_t) map_addr, copy_len);
 
-	if (vm_map_remove(exec_map,
-			  (vm_offset_t) data_buf,
-			  (vm_offset_t) data_buf + PAGE_SIZE))
-		panic("load_coff_section vm_map_remove failed");
+	kmem_free_wakeup(exec_map, (vm_offset_t)data_buf, PAGE_SIZE);
 
 	return error;
 }
@@ -280,11 +277,7 @@
   	error = 0;
 
  dealloc_and_fail:
-	if (vm_map_remove(exec_map,
-			  (vm_offset_t) ptr,
-			  (vm_offset_t) ptr + PAGE_SIZE))
-    		panic("%s vm_map_remove failed", __func__);
-
+	kmem_free_wakeup(exec_map, (vm_offset_t)ptr,  PAGE_SIZE);
  fail:
 	VOP_UNLOCK(vp, 0);
  unlocked_fail:
@@ -421,10 +414,7 @@
 		    	}
 			free(libbuf, M_TEMP);
 		}
-		if (vm_map_remove(exec_map,
-				  (vm_offset_t) buf,
-				  (vm_offset_t) buf + len))
-	      		panic("exec_coff_imgact vm_map_remove failed");
+		kmem_free_wakeup(exec_map, (vm_offset_t)buf, len);
 	    	if (error)
 	      		goto fail;
 	  	}
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/_limits.h
--- a/head/sys/i386/include/_limits.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/_limits.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,87 +1,6 @@
 /*-
- * Copyright (c) 1988, 1993
- *	The Regents of the University of California.  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.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)limits.h	8.3 (Berkeley) 1/4/94
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/_limits.h 232262 2012-02-28 18:24:28Z tijl $ */
 
-#ifndef _MACHINE__LIMITS_H_
-#define	_MACHINE__LIMITS_H_
-
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives.  Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions.  The subtraction for
- * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- */
-
-#define	__CHAR_BIT	8		/* number of bits in a char */
-
-#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
-#define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
-
-#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
-
-#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
-#define	__SHRT_MAX	0x7fff		/* max value for a short */
-#define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
-
-#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
-#define	__INT_MAX	0x7fffffff	/* max value for an int */
-#define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
-
-#define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */
-#define	__LONG_MAX	0x7fffffffL	/* max value for a long */
-#define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */
-
-			/* max value for an unsigned long long */
-#define	__ULLONG_MAX	0xffffffffffffffffULL
-#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
-#define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
-
-#define	__SSIZE_MAX	__INT_MAX	/* max value for a ssize_t */
-
-#define	__SIZE_T_MAX	__UINT_MAX	/* max value for a size_t */
-
-#define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */
-#define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */
-
-/* Quads and long longs are the same size.  Ensure they stay in sync. */
-#define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */
-#define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */
-#define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */
-
-#define	__LONG_BIT	32
-#define	__WORD_BIT	32
-
-/* Minimum signal stack size. */
-#define	__MINSIGSTKSZ	(512 * 4)
-
-#endif /* !_MACHINE__LIMITS_H_ */
+#include <x86/_limits.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/_stdint.h
--- a/head/sys/i386/include/_stdint.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/_stdint.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,171 +1,6 @@
 /*-
- * Copyright (c) 2001, 2002 Mike Barcroft <mike at FreeBSD.org>
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 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$
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/_stdint.h 232264 2012-02-28 18:38:33Z tijl $ */
 
-#ifndef _MACHINE__STDINT_H_
-#define	_MACHINE__STDINT_H_
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
-
-#define	INT8_C(c)		(c)
-#define	INT16_C(c)		(c)
-#define	INT32_C(c)		(c)
-#define	INT64_C(c)		(c ## LL)
-
-#define	UINT8_C(c)		(c)
-#define	UINT16_C(c)		(c)
-#define	UINT32_C(c)		(c ## U)
-#define	UINT64_C(c)		(c ## ULL)
-
-#define	INTMAX_C(c)		INT64_C(c)
-#define	UINTMAX_C(c)		UINT64_C(c)
-
-#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.1 Limits of exact-width integer types
- */
-/* Minimum values of exact-width signed integer types. */
-#define	INT8_MIN	(-0x7f-1)
-#define	INT16_MIN	(-0x7fff-1)
-#define	INT32_MIN	(-0x7fffffff-1)
-#define	INT64_MIN	(-0x7fffffffffffffffLL-1)
-
-/* Maximum values of exact-width signed integer types. */
-#define	INT8_MAX	0x7f
-#define	INT16_MAX	0x7fff
-#define	INT32_MAX	0x7fffffff
-#define	INT64_MAX	0x7fffffffffffffffLL
-
-/* Maximum values of exact-width unsigned integer types. */
-#define	UINT8_MAX	0xff
-#define	UINT16_MAX	0xffff
-#define	UINT32_MAX	0xffffffffU
-#define	UINT64_MAX	0xffffffffffffffffULL
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.2  Limits of minimum-width integer types
- */
-/* Minimum values of minimum-width signed integer types. */
-#define	INT_LEAST8_MIN	INT8_MIN
-#define	INT_LEAST16_MIN	INT16_MIN
-#define	INT_LEAST32_MIN	INT32_MIN
-#define	INT_LEAST64_MIN	INT64_MIN
-
-/* Maximum values of minimum-width signed integer types. */
-#define	INT_LEAST8_MAX	INT8_MAX
-#define	INT_LEAST16_MAX	INT16_MAX
-#define	INT_LEAST32_MAX	INT32_MAX
-#define	INT_LEAST64_MAX	INT64_MAX
-
-/* Maximum values of minimum-width unsigned integer types. */
-#define	UINT_LEAST8_MAX	 UINT8_MAX
-#define	UINT_LEAST16_MAX UINT16_MAX
-#define	UINT_LEAST32_MAX UINT32_MAX
-#define	UINT_LEAST64_MAX UINT64_MAX
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.3  Limits of fastest minimum-width integer types
- */
-/* Minimum values of fastest minimum-width signed integer types. */
-#define	INT_FAST8_MIN	INT32_MIN
-#define	INT_FAST16_MIN	INT32_MIN
-#define	INT_FAST32_MIN	INT32_MIN
-#define	INT_FAST64_MIN	INT64_MIN
-
-/* Maximum values of fastest minimum-width signed integer types. */
-#define	INT_FAST8_MAX	INT32_MAX
-#define	INT_FAST16_MAX	INT32_MAX
-#define	INT_FAST32_MAX	INT32_MAX
-#define	INT_FAST64_MAX	INT64_MAX
-
-/* Maximum values of fastest minimum-width unsigned integer types. */
-#define	UINT_FAST8_MAX	UINT32_MAX
-#define	UINT_FAST16_MAX	UINT32_MAX
-#define	UINT_FAST32_MAX	UINT32_MAX
-#define	UINT_FAST64_MAX	UINT64_MAX
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.4  Limits of integer types capable of holding object pointers
- */
-#define	INTPTR_MIN	INT32_MIN
-#define	INTPTR_MAX	INT32_MAX
-#define	UINTPTR_MAX	UINT32_MAX
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.5  Limits of greatest-width integer types
- */
-#define	INTMAX_MIN	INT64_MIN
-#define	INTMAX_MAX	INT64_MAX
-#define	UINTMAX_MAX	UINT64_MAX
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.3  Limits of other integer types
- */
-/* Limits of ptrdiff_t. */
-#define	PTRDIFF_MIN	INT32_MIN	
-#define	PTRDIFF_MAX	INT32_MAX
-
-/* Limits of sig_atomic_t. */
-#define	SIG_ATOMIC_MIN	INT32_MIN
-#define	SIG_ATOMIC_MAX	INT32_MAX
-
-/* Limit of size_t. */
-#define	SIZE_MAX	UINT32_MAX
-
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define	WCHAR_MIN	INT32_MIN
-#define	WCHAR_MAX	INT32_MAX
-#endif
-
-/* Limits of wint_t. */
-#define	WINT_MIN	INT32_MIN
-#define	WINT_MAX	INT32_MAX
-
-#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
-
-#endif /* !_MACHINE__STDINT_H_ */
+#include <x86/_stdint.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/_types.h
--- a/head/sys/i386/include/_types.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/_types.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,128 +1,6 @@
 /*-
- * Copyright (c) 2002 Mike Barcroft <mike at FreeBSD.org>
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  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 the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94
- *	From: @(#)types.h	8.3 (Berkeley) 1/5/94
- * $FreeBSD: head/sys/i386/include/_types.h 228469 2011-12-13 13:38:03Z ed $
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/_types.h 232261 2012-02-28 18:15:28Z tijl $ */
 
-#ifndef _MACHINE__TYPES_H_
-#define	_MACHINE__TYPES_H_
-
-#ifndef _SYS_CDEFS_H_
-#error this file needs sys/cdefs.h as a prerequisite
-#endif
-
-#define __NO_STRICT_ALIGNMENT
-
-/*
- * Basic types upon which most other types are built.
- */
-typedef	signed char		__int8_t;
-typedef	unsigned char		__uint8_t;
-typedef	short			__int16_t;
-typedef	unsigned short		__uint16_t;
-typedef	int			__int32_t;
-typedef	unsigned int		__uint32_t;
-#ifndef lint
-__extension__
-#endif
-/* LONGLONG */
-typedef	long long		__int64_t;
-#ifndef lint
-__extension__
-#endif
-/* LONGLONG */
-typedef	unsigned long long	__uint64_t;
-
-/*
- * Standard type definitions.
- */
-typedef	unsigned long	__clock_t;		/* clock()... */
-typedef	__int32_t	__critical_t;
-typedef	long double	__double_t;
-typedef	long double	__float_t;
-typedef	__int32_t	__intfptr_t;
-typedef	__int64_t	__intmax_t;
-typedef	__int32_t	__intptr_t;
-typedef	__int32_t	__int_fast8_t;
-typedef	__int32_t	__int_fast16_t;
-typedef	__int32_t	__int_fast32_t;
-typedef	__int64_t	__int_fast64_t;
-typedef	__int8_t	__int_least8_t;
-typedef	__int16_t	__int_least16_t;
-typedef	__int32_t	__int_least32_t;
-typedef	__int64_t	__int_least64_t;
-typedef	__int32_t	__ptrdiff_t;		/* ptr1 - ptr2 */
-typedef	__int32_t	__register_t;
-typedef	__int32_t	__segsz_t;		/* segment size (in pages) */
-typedef	__uint32_t	__size_t;		/* sizeof() */
-typedef	__int32_t	__ssize_t;		/* byte count or error */
-typedef	__int32_t	__time_t;		/* time()... */
-typedef	__uint32_t	__uintfptr_t;
-typedef	__uint64_t	__uintmax_t;
-typedef	__uint32_t	__uintptr_t;
-typedef	__uint32_t	__uint_fast8_t;
-typedef	__uint32_t	__uint_fast16_t;
-typedef	__uint32_t	__uint_fast32_t;
-typedef	__uint64_t	__uint_fast64_t;
-typedef	__uint8_t	__uint_least8_t;
-typedef	__uint16_t	__uint_least16_t;
-typedef	__uint32_t	__uint_least32_t;
-typedef	__uint64_t	__uint_least64_t;
-typedef	__uint32_t	__u_register_t;
-typedef	__uint32_t	__vm_offset_t;
-typedef	__int64_t	__vm_ooffset_t;
-#ifdef PAE
-typedef	__uint64_t	__vm_paddr_t;
-#else
-typedef	__uint32_t	__vm_paddr_t;
-#endif
-typedef	__uint64_t	__vm_pindex_t;
-typedef	__uint32_t	__vm_size_t;
-
-/*
- * Unusual type definitions.
- */
-#ifdef __GNUCLIKE_BUILTIN_VARARGS
-typedef __builtin_va_list	__va_list;	/* internally known to gcc */
-#else
-typedef	char *			__va_list;
-#endif /* __GNUCLIKE_BUILTIN_VARARGS */
-#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
-    && !defined(__NO_GNUC_VA_LIST)
-#define __GNUC_VA_LIST
-typedef __va_list		__gnuc_va_list;	/* compatibility w/GNU headers*/
-#endif
-
-#endif /* !_MACHINE__TYPES_H_ */
+#include <x86/_types.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/apicvar.h
--- a/head/sys/i386/include/apicvar.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/apicvar.h	Fri Mar 02 17:14:11 2012 +0200
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/apicvar.h 232230 2012-02-27 17:30:21Z jhb $
  */
 
 #ifndef _MACHINE_APICVAR_H_
@@ -103,35 +103,6 @@
  */ 
 
 /* Interrupts for local APIC LVT entries other than the timer. */
-#ifdef XEN
-/* These are the Xen i386 APIC definitions */
-#define	APIC_LOCAL_INTS	240
-#define	APIC_ERROR_INT	APIC_LOCAL_INTS
-#define	APIC_THERMAL_INT (APIC_LOCAL_INTS + 1)
-#define	APIC_CMC_INT	(APIC_LOCAL_INTS + 2)
-#define	APIC_IPI_INTS	(APIC_LOCAL_INTS + 3)
-
-#define	IPI_RENDEZVOUS		(APIC_IPI_INTS)	/* Inter-CPU rendezvous. */
-#define	IPI_INVLTLB		(APIC_IPI_INTS + 1)	/* TLB Shootdown IPIs */
-#define	IPI_INVLPG		(APIC_IPI_INTS + 2)
-#define	IPI_INVLRNG		(APIC_IPI_INTS + 3)
-#define	IPI_INVLCACHE		(APIC_IPI_INTS + 4)
-#define	IPI_LAZYPMAP		(APIC_IPI_INTS + 5)	/* Lazy pmap release. */
-/* Vector to handle bitmap based IPIs */
-#define	IPI_BITMAP_VECTOR	(APIC_IPI_INTS + 6)
-
-/* IPIs handled by IPI_BITMAPED_VECTOR  (XXX ups is there a better place?) */
-#define	IPI_AST		0 	/* Generate software trap. */
-#define IPI_PREEMPT     1
-#define IPI_HARDCLOCK   2 
-#define IPI_BITMAP_LAST IPI_HARDCLOCK
-#define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST)
-
-#define	IPI_STOP	(APIC_IPI_INTS + 7)	/* Stop CPU until restarted. */
-#define	IPI_STOP_HARD	(APIC_IPI_INTS + 8)	/* Stop CPU with a NMI. */
-
-#else /* XEN */
-/* These are the normal i386 APIC definitions */
 #define	APIC_LOCAL_INTS	240
 #define	APIC_ERROR_INT	APIC_LOCAL_INTS
 #define	APIC_THERMAL_INT (APIC_LOCAL_INTS + 1)
@@ -156,7 +127,6 @@
 
 #define	IPI_STOP	(APIC_IPI_INTS + 7)	/* Stop CPU until restarted. */
 #define	IPI_STOP_HARD	(APIC_IPI_INTS + 8)	/* Stop CPU with a NMI. */
-#endif /* XEN */
 
 /*
  * The spurious interrupt can share the priority class with the IPIs since
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/endian.h
--- a/head/sys/i386/include/endian.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/endian.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,145 +1,6 @@
 /*-
- * Copyright (c) 1987, 1991 Regents of the University of California.
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)endian.h	7.8 (Berkeley) 4/3/91
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/endian.h 232266 2012-02-28 19:39:54Z tijl $ */
 
-#ifndef _MACHINE_ENDIAN_H_
-#define	_MACHINE_ENDIAN_H_
-
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Define the order of 32-bit words in 64-bit words.
- */
-#define	_QUAD_HIGHWORD 1
-#define	_QUAD_LOWWORD 0
-
-/*
- * Definitions for byte order, according to byte significance from low
- * address to high.
- */
-#define	_LITTLE_ENDIAN	1234	/* LSB first: i386, vax */
-#define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
-#define	_PDP_ENDIAN	3412	/* LSB first in word, MSW first in long */
-
-#define	_BYTE_ORDER	_LITTLE_ENDIAN
-
-/*
- * Deprecated variants that don't have enough underscores to be useful in more
- * strict namespaces.
- */
-#if __BSD_VISIBLE
-#define	LITTLE_ENDIAN	_LITTLE_ENDIAN
-#define	BIG_ENDIAN	_BIG_ENDIAN
-#define	PDP_ENDIAN	_PDP_ENDIAN
-#define	BYTE_ORDER	_BYTE_ORDER
-#endif
-
-#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
-
-#define	__bswap64_const(_x)			\
-	(((_x) >> 56) |				\
-	(((_x) >> 40) & (0xffULL << 8)) |	\
-	(((_x) >> 24) & (0xffULL << 16)) |	\
-	(((_x) >> 8) & (0xffULL << 24)) |	\
-	(((_x) << 8) & (0xffULL << 32)) |	\
-	(((_x) << 24) & (0xffULL << 40)) |	\
-	(((_x) << 40) & (0xffULL << 48)) |	\
-	((_x) << 56))
-
-#define	__bswap32_const(_x)			\
-	(((_x) >> 24) |				\
-	(((_x) & (0xff << 16)) >> 8) |		\
-	(((_x) & (0xff << 8)) << 8) |		\
-	((_x) << 24))
-
-#define __bswap16_const(_x)	(__uint16_t)((_x) << 8 | (_x) >> 8)
-
-static __inline __uint64_t
-__bswap64_var(__uint64_t __x)
-{
-
-	return __bswap64_const(__x);
-}
-
-
-static __inline __uint32_t
-__bswap32_var(__uint32_t _x)
-{
-
-	__asm ("bswap %0" : "+r" (_x));
-	return (_x);
-}
-
-static __inline __uint16_t
-__bswap16_var(__uint16_t _x)
-{
-
-	return (__bswap16_const(_x));
-}
-
-#define	__bswap64(_x)					\
-	(__builtin_constant_p(_x) ?			\
-	    __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))
-
-#define	__bswap32(_x)					\
-	(__builtin_constant_p(_x) ?			\
-	    __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
-
-#define	__bswap16(_x)					\
-	(__builtin_constant_p(_x) ?			\
-	    __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
-
-#define	__htonl(x)	__bswap32(x)
-#define	__htons(x)	__bswap16(x)
-#define	__ntohl(x)	__bswap32(x)
-#define	__ntohs(x)	__bswap16(x)
-
-#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
-
-/*
- * No optimizations are available for this compiler.  Fall back to
- * non-optimized functions by defining the constant usually used to prevent
- * redefinition.
- */
-#define	_BYTEORDER_FUNC_DEFINED
-
-#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_MACHINE_ENDIAN_H_ */
+#include <x86/endian.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/segments.h
--- a/head/sys/i386/include/segments.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/segments.h	Fri Mar 02 17:14:11 2012 +0200
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)segments.h	7.1 (Berkeley) 5/9/91
- * $FreeBSD: head/sys/i386/include/segments.h 227290 2011-11-07 01:53:25Z rstone $
+ * $FreeBSD: head/sys/i386/include/segments.h 232228 2012-02-27 17:29:37Z jhb $
  */
 
 #ifndef _MACHINE_SEGMENTS_H_
@@ -206,8 +206,8 @@
 #define	IDT_MC		18	/* #MC: Machine Check */
 #define	IDT_XF		19	/* #XF: SIMD Floating-Point Exception */
 #define	IDT_IO_INTS	NRSVIDT	/* Base of IDT entries for I/O interrupts. */
+#define	IDT_DTRACE_RET	0x20	/* DTrace pid provider Interrupt Vector */
 #define	IDT_SYSCALL	0x80	/* System Call Interrupt Vector */
-#define	IDT_DTRACE_RET	0x20	/* DTrace pid provider Interrupt Vector */
 
 /*
  * Entries in the Global Descriptor Table (GDT)
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/setjmp.h
--- a/head/sys/i386/include/setjmp.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/setjmp.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,50 +1,6 @@
 /*-
- * Copyright (c) 1998 John Birrell <jb at cimlogic.com.au>.
- * 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 co-contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/setjmp.h 232275 2012-02-28 22:17:52Z tijl $ */
 
-#ifndef _MACHINE_SETJMP_H_
-#define	_MACHINE_SETJMP_H_
-
-#include <sys/cdefs.h>
-
-#define	_JBLEN	11		/* Size of the jmp_buf on x86. */
-
-/*
- * jmp_buf and sigjmp_buf are encapsulated in different structs to force
- * compile-time diagnostics for mismatches.  The structs are the same
- * internally to avoid some run-time errors for mismatches.
- */
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
-typedef	struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
-#endif
-
-typedef	struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1];
-
-#endif /* !_MACHINE_SETJMP_H_ */
+#include <x86/setjmp.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/stdarg.h
--- a/head/sys/i386/include/stdarg.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/stdarg.h	Fri Mar 02 17:14:11 2012 +0200
@@ -1,90 +1,6 @@
 /*-
- * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  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 the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)stdarg.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD: head/sys/i386/include/stdarg.h 232276 2012-02-28 22:30:58Z tijl $ */
 
-#ifndef _MACHINE_STDARG_H_
-#define	_MACHINE_STDARG_H_
-
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-
-#ifndef _VA_LIST_DECLARED
-#define	_VA_LIST_DECLARED
-typedef	__va_list	va_list;
-#endif
-
-#ifdef __GNUCLIKE_BUILTIN_STDARG
-
-#define	va_start(ap, last) \
-	__builtin_va_start((ap), (last))
-
-#define	va_arg(ap, type) \
-	__builtin_va_arg((ap), type)
-
-#if __ISO_C_VISIBLE >= 1999
-#define	va_copy(dest, src) \
-	__builtin_va_copy((dest), (src))
-#endif
-
-#define	va_end(ap) \
-	__builtin_va_end(ap)
-
-#else	/* !__GNUCLIKE_BUILTIN_STDARG */
-
-#define	__va_size(type) \
-	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-
-#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG
-#define va_start(ap, last) \
-	((ap) = (va_list)__builtin_next_arg(last))
-#else	/* !__GNUCLIKE_BUILTIN_NEXT_ARG */
-#define	va_start(ap, last) \
-	((ap) = (va_list)&(last) + __va_size(last))
-#endif	/* __GNUCLIKE_BUILTIN_NEXT_ARG */
-
-#define	va_arg(ap, type) \
-	(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
-
-#if __ISO_C_VISIBLE >= 1999
-#define	va_copy(dest, src) \
-	((dest) = (src))
-#endif
-
-#define	va_end(ap)
-
-#endif /* __GNUCLIKE_BUILTIN_STDARG */
-
-#endif /* !_MACHINE_STDARG_H_ */
+#include <x86/stdarg.h>
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/xen/xenpmap.h
--- a/head/sys/i386/include/xen/xenpmap.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/xen/xenpmap.h	Fri Mar 02 17:14:11 2012 +0200
@@ -30,7 +30,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  *
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/xen/xenpmap.h 230916 2012-02-02 17:54:35Z ken $
  */
 
 #ifndef _XEN_XENPMAP_H_
@@ -232,15 +232,6 @@
 	return xen_phys_machine[pfn] != INVALID_P2M_ENTRY;
 }
 
-#elif defined(XENHVM)
-
-#define	set_phys_to_machine(pfn, mfn)		((void)0)
-#define	phys_to_machine_mapping_valid(pfn)	(TRUE)
-
-#if !defined(PAE)
-#define	vtomach(va)	pmap_kextract((vm_offset_t) (va))
-#endif
-
-#endif /* !XEN && !XENHVM */
+#endif /* !XEN */
 
 #endif /* _XEN_XENPMAP_H_ */
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/include/xen/xenvar.h
--- a/head/sys/i386/include/xen/xenvar.h	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/include/xen/xenvar.h	Fri Mar 02 17:14:11 2012 +0200
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/i386/include/xen/xenvar.h 222041 2011-05-17 22:15:53Z attilio $
+ * $FreeBSD: head/sys/i386/include/xen/xenvar.h 230916 2012-02-02 17:54:35Z ken $
  */
 
 #ifndef XENVAR_H_
@@ -106,9 +106,15 @@
 
 #elif defined(XENHVM)
 
+#if !defined(PAE)
+#define	vtomach(va)	pmap_kextract((vm_offset_t) (va))
+#endif
 #define	PFNTOMFN(pa)	(pa)
 #define	MFNTOPFN(ma)	(ma)
 
+#define	set_phys_to_machine(pfn, mfn)		((void)0)
+#define	phys_to_machine_mapping_valid(pfn)	(TRUE)
+
 #endif /* !XEN && !XENHVM */
 
 #endif
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/linux/imgact_linux.c
--- a/head/sys/i386/linux/imgact_linux.c	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/linux/imgact_linux.c	Fri Mar 02 17:14:11 2012 +0200
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/i386/linux/imgact_linux.c 230132 2012-01-15 13:23:18Z uqs $");
+__FBSDID("$FreeBSD: head/sys/i386/linux/imgact_linux.c 231885 2012-02-17 23:47:16Z kib $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,8 +64,8 @@
     struct vmspace *vmspace;
     vm_offset_t vmaddr;
     unsigned long virtual_offset, file_offset;
-    vm_offset_t buffer;
     unsigned long bss_size;
+    ssize_t aresid;
     int error;
 
     if (((a_out->a_magic >> 16) & 0xff) != 0x64)
@@ -144,21 +144,15 @@
 	if (error)
 	    goto fail;
 
-	error = vm_mmap(kernel_map, &buffer,
-			round_page(a_out->a_text + a_out->a_data + file_offset),
-			VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE,
-			imgp->vp, trunc_page(file_offset));
-	if (error)
-	    goto fail;
-
-	error = copyout((void *)(uintptr_t)(buffer + file_offset),
-			(void *)vmaddr, a_out->a_text + a_out->a_data);
-
-	vm_map_remove(kernel_map, buffer,
-		      buffer + round_page(a_out->a_text + a_out->a_data + file_offset));
-
-	if (error)
-	    goto fail;
+	error = vn_rdwr(UIO_READ, imgp->vp, (void *)vmaddr, file_offset,
+	    a_out->a_text + a_out->a_data, UIO_USERSPACE, 0,
+	    curthread->td_ucred, NOCRED, &aresid, curthread);
+	if (error != 0)
+		goto fail;
+	if (aresid != 0) {
+		error = ENOEXEC;
+		goto fail;
+	}
 
 	/*
 	 * remove write enable on the 'text' part
diff -r de99a27dd03c -r eaa303571293 head/sys/i386/linux/linux_sysvec.c
--- a/head/sys/i386/linux/linux_sysvec.c	Fri Mar 02 17:12:32 2012 +0200
+++ b/head/sys/i386/linux/linux_sysvec.c	Fri Mar 02 17:14:11 2012 +0200
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/i386/linux/linux_sysvec.c 230132 2012-01-15 13:23:18Z uqs $");
+__FBSDID("$FreeBSD: head/sys/i386/linux/linux_sysvec.c 232143 2012-02-25 01:33:39Z kib $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -227,11 +227,11 @@
 	argv = *stack_base;
 	envp = *stack_base + (imgp->args->argc + 1);
 	(*stack_base)--;
-	**stack_base = (intptr_t)(void *)envp;
+	suword(*stack_base, (intptr_t)(void *)envp);
 	(*stack_base)--;
-	**stack_base = (intptr_t)(void *)argv;
+	suword(*stack_base, (intptr_t)(void *)argv);
 	(*stack_base)--;
-	**stack_base = imgp->args->argc;
+	suword(*stack_base, imgp->args->argc);
 	return (0);
 }
 
@@ -286,7 +286,7 @@
 	imgp->auxargs = NULL;
 
 	(*stack_base)--;
-	**stack_base = (register_t)imgp->args->argc;
+	suword(*stack_base, (register_t)imgp->args->argc);
 	return (0);
 }
 


More information about the Zrouter-src-freebsd mailing list