commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnumach] 01/01: Imported Upstream version 1.7+git20160522


From: Samuel Thibault
Subject: [gnumach] 01/01: Imported Upstream version 1.7+git20160522
Date: Sun, 22 May 2016 01:15:10 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository gnumach.

commit 8d63d9c0d3b84e8496248093ce333c959fe985c9
Author: Samuel Thibault <address@hidden>
Date:   Sat May 21 22:28:48 2016 +0000

    Imported Upstream version 1.7+git20160522
---
 ChangeLog              | 105 ++++++++++
 NEWS                   |  12 +-
 build-aux/config.guess | 111 ++++++-----
 build-aux/config.sub   |  20 +-
 configure              |  20 +-
 ddb/db_elf.c           |  12 +-
 ddb/db_output.c        |   3 +-
 ddb/db_output.h        |   2 +-
 device/ds_routines.c   |   4 +-
 doc/mach.info          |   2 +-
 doc/mach.info-1        |   4 +-
 doc/mach.info-2        |   2 +-
 doc/stamp-vti          |   4 +-
 doc/version.texi       |   4 +-
 i386/i386/user_ldt.c   |  11 +-
 i386/i386/xen.h        |   2 +-
 i386/intel/pmap.c      |   8 +-
 ipc/ipc_kmsg.c         |   2 +-
 kern/boot_script.c     |   3 +-
 kern/bootstrap.c       |   5 +-
 kern/host.c            |   2 +-
 kern/ipc_tt.c          |   2 +-
 kern/mach_clock.c      |   6 +-
 kern/processor.c       |   2 +-
 kern/strings.c         |   2 +-
 kern/task.c            |   2 +-
 kern/thread.c          |   4 +-
 version.m4             |   2 +-
 vm/memory_object.c     |   2 +-
 vm/vm_map.c            | 518 ++++++++++++++++++++++++++++---------------------
 vm/vm_map.h            |  11 ++
 vm/vm_object.c         |   2 +
 vm/vm_object.h         |   7 +
 vm/vm_pageout.c        |   1 +
 xen/block.c            |   8 +-
 xen/console.c          |   7 +-
 xen/console.h          |   6 +-
 xen/evt.c              |   3 +-
 xen/net.c              |   4 +-
 39 files changed, 571 insertions(+), 356 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c95736..5435bb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,108 @@
+2016-05-20  Richard Braun  <address@hidden>
+
+       vm_map: back allocations with a red-black tree
+       This change augments VM maps with a gap tree, sorted by gap size, to
+       use for non-fixed allocations.
+
+       * vm/vm_map.c: Include kern/list.h.
+       (vm_map_entry_gap_cmp_lookup, vm_map_entry_gap_cmp_insert,
+       vm_map_gap_valid, vm_map_gap_compute, vm_map_gap_insert_single,
+       vm_map_gap_remove_single, vm_map_gap_update, vm_map_gap_insert,
+       vm_map_gap_remove, vm_map_find_entry_anywhere): New functions.
+       (vm_map_setup): Initialize gap tree.
+       (_vm_map_entry_link): Call vm_map_gap_insert.
+       (_vm_map_entry_unlink): Call vm_map_gap_remove.
+       (vm_map_find_entry, vm_map_enter, vm_map_copyout,
+       vm_map_copyout_page_list, vm_map_copyin): Replace look up loop with
+       a call to vm_map_find_entry_anywhere. Call vm_map_gap_update and
+       initialize gap tree where relevant.
+       (vm_map_copy_insert): Turn macro into an inline function and rewrite.
+       (vm_map_simplify): Reorder call to vm_map_entry_unlink so that previous
+       entry is suitable for use with gap management functions.
+       * vm/vm_map.h: Include kern/list.h.
+       (struct vm_map_entry): New members `gap_node`, `gap_list`,
+       `gap_size` and `in_gap_tree`.
+       (struct vm_map_header): New member `gap_tree`.
+
+2016-05-20  Justus Winter  <address@hidden>
+
+       xen: fix prototype
+       Amends a7f248bf.
+
+       * xen/console.h (hypcnclose): Fix type of parameter.
+
+2016-05-18  Thomas Schwinge  <address@hidden>
+
+       GNU Mach 1.7
+       * version.m4 (AC_PACKAGE_VERSION): Set to 1.7.
+       * NEWS: Finalize for 1.7.
+
+2016-05-18  Samuel Thibault  <address@hidden>
+
+       Fix gcc-6 warnings
+       * ddb/db_elf.c (elf_db_sym_init): Turn `i' into unsigned.
+       * device/ds_routines.c (ds_device_open, device_writev_trap): Likewise.
+       * i386/i386/user_ldt.c (i386_set_ldt): Likewise for `i', 
`min_selector', and
+       `first_desc'.
+       (i386_get_ldt): Likewise for `ldt_count'.
+       (user_ldt_free): Likewise for `i'.
+       * i386/i386/xen.h (hyp_set_ldt): Turn `count' into unsigned long.
+       * i386/intel/pmap.c (pmap_bootstrap): Turn `i', `j' and 'n' into 
unsigned.
+       (pmap_clear_bootstrap_pagetable): Likewise for `i' and `j'.
+       * ipc/ipc_kmsg.c (ipc_msg_print): Turn `i' and `numwords' into unsigned.
+       * kern/boot_script.c (boot_script_parse_line): Likewise for `i'.
+       * kern/bootstrap.c (bootstrap_create): Likewise for `n' and `i'.
+       * kern/host.c (host_processors): Likewise for `i'.
+       * kern/ipc_tt.c (mach_ports_register): Likewise.
+       * kern/mach_clock.c (tickadj, bigadj): turn into unsigned.
+       * kern/processor.c (processor_set_things): Turn `i' into unsigned.
+       * kern/task.c (task_threads): Likewise.
+       * kern/thread.c (consider_thread_collect, stack_init): Likewise.
+       * kern/strings.c (memset): Turn `i' into size_t.
+       * vm/memory_object.c (memory_object_lock_request): Turn `i' into 
unsigned.
+       * xen/block.c (hyp_block_init): Use %u format for evt.
+       (device_open): Drop unused err variable.
+       (device_write): Turn `copy_npages', `i', `nbpages', and `j' into 
unsigned.
+       * xen/console.c (hypcnread, hypcnwrite, hypcnclose): Turn dev to dev_t.
+       (hypcnclose): Return void.
+       * xen/console.h (hypcnread, hypcnwrite, hypcnclose): Fix prototypes
+       accordingly.
+       * xen/evt.c (form_int_mask): Turn `i' into int.
+       * xen/net.c (hyp_net_init): Use %u format for evt.
+       (device_open): Remove unused `err' variable.
+
+2016-05-17  Samuel Thibault  <address@hidden>
+
+       Revert "Fix getting ELF symbol bind and type"
+       This reverts commit a8a52cafb5621b475737ffdc81f63703d5b37904.
+
+       It seems to be breaking backtracing in ddb...
+
+2016-05-16  Richard Braun  <address@hidden>
+
+       Fix pageout deadlock
+       The pageout daemon uses small, internal, temporary objects to transport
+       the data out to memory managers, which are expected to release the data
+       once written out to backing store. Releasing this data is done with a
+       vm_deallocate call. The problem with this is that vm_map is allowed to
+       merge these objects, in which case vm_deallocate will only remove a
+       reference instead of releasing the underlying pages, causing the pageout
+       daemon to deadlock.
+
+       This change makes the pageout daemon mark these objects so that they
+       don't get merged.
+
+       * vm/vm_object.c (vm_object_bootstrap): Update template.
+       (vm_object_coalesce): Don't coalesce if an object is used for pageout.
+       * vm/vm_object.h (struct vm_object): New `used_for_pageout` member.
+       * vm/vm_pageout.c (vm_pageout_page): Mark new objects for pageout.
+
+2016-05-15  Richard Braun  <address@hidden>
+
+       Fix warning
+       ddb/db_output.c (db_printf): Return 0.
+       ddb/db_printf.h (db_printf): Change declaration to return an int.
+
 2016-04-21  Samuel Thibault  <address@hidden>
 
        Fix xen boot
diff --git a/NEWS b/NEWS
index 1239482..7626e40 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
-Version 1.7 (2016-04-XX)
+Version 1.7 (2016-05-18)
 
-The code has been updated to work with newer versions of the compiler,
-and numerous bugs have been fixed throughout the code.  The code uses
-integer types from 'stdint.h' now instead of the old Mach types.
+The code has been updated to work with newer versions of GCC, and numerous bugs
+have been fixed throughout the code, including a pageout deadlock.  The code
+uses integer types from <stdint.h> now instead of the old Mach types.
 
 The VM cache policy change has been merged.  The kernel now caches
 unreferenced VM objects unconditionally instead of using a fixed
@@ -12,8 +12,8 @@ The physical page allocator of the X15 kernel has been 
integrated, and
 is now used directly by the slab allocator.  This increases the kernel
 heap addressing important scalability issues.
 
-A synchronization mechanism was added, similar to the Linux futexes, to
-allow efficient and powerful userland synchronization.
+The gsync synchronization mechanism was added, similar to the Linux kernel's
+futexes, to allow efficient and powerful userland synchronization.
 
 Support for profiling kernel code from userland through sampling was added.
 
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 1659250..0967f2a 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2015 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2015-08-20'
+timestamp='2016-04-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ timestamp='2015-08-20'
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# 
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
 # Please send patches to <address@hidden>.
 
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -237,6 +237,10 @@ case 
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
        echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
        exit ;;
+    *:LibertyBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+       exit ;;
     *:ekkoBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
        exit ;;
@@ -268,42 +272,42 @@ case 
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) 
processor.*$/\1/p' | head -n 1`
        case "$ALPHA_CPU_TYPE" in
            "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
+               UNAME_MACHINE=alphaev5 ;;
            "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
+               UNAME_MACHINE=alphaev56 ;;
            "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
+               UNAME_MACHINE=alphapca56 ;;
            "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
+               UNAME_MACHINE=alphapca57 ;;
            "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
+               UNAME_MACHINE=alphaev6 ;;
            "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
+               UNAME_MACHINE=alphaev67 ;;
            "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
+               UNAME_MACHINE=alphaev69 ;;
            "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
+               UNAME_MACHINE=alphaev7 ;;
            "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
+               UNAME_MACHINE=alphaev79 ;;
        esac
        # A Pn.n version is a patched version.
        # A Vn.n version is a released version.
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 
's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 
's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
        # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
        exitcode=$?
        trap '' 0
@@ -376,16 +380,16 @@ case 
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
        eval $set_cc_for_build
-       SUN_ARCH="i386"
+       SUN_ARCH=i386
        # If there is a compiler, see if it is configured for 64-bit objects.
        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
        # This test works for both compilers.
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
                grep IS_64BIT_ARCH >/dev/null
            then
-               SUN_ARCH="x86_64"
+               SUN_ARCH=x86_64
            fi
        fi
        echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -410,7 +414,7 @@ case 
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     sun*:*:4.2BSD:*)
        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 
2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
        case "`/bin/arch`" in
            sun3)
                echo m68k-sun-sunos${UNAME_RELEASE}
@@ -635,13 +639,13 @@ EOF
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                    case "${sc_cpu_version}" in
-                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
                      532)                      # CPU_PA_RISC2_0
                        case "${sc_kernel_bits}" in
-                         32) HP_ARCH="hppa2.0n" ;;
-                         64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                         32) HP_ARCH=hppa2.0n ;;
+                         64) HP_ARCH=hppa2.0w ;;
+                         '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
                        esac ;;
                    esac
                fi
@@ -680,11 +684,11 @@ EOF
                    exit (0);
                }
 EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && 
HP_ARCH=`$dummy`
+                   (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && 
HP_ARCH=`$dummy`
                    test -z "$HP_ARCH" && HP_ARCH=hppa
                fi ;;
        esac
-       if [ ${HP_ARCH} = "hppa2.0w" ]
+       if [ ${HP_ARCH} = hppa2.0w ]
        then
            eval $set_cc_for_build
 
@@ -697,12 +701,12 @@ EOF
            # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
            # => hppa64-hp-hpux11.23
 
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+           if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
                grep -q __LP64__
            then
-               HP_ARCH="hppa2.0w"
+               HP_ARCH=hppa2.0w
            else
-               HP_ARCH="hppa64"
+               HP_ARCH=hppa64
            fi
        fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -807,14 +811,14 @@ EOF
        echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 
'abcdefghijklmnopqrstuvwxyz'`
-       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 
'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     5000:UNIX_System_V:4.*:*)
-       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 
'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 
'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -896,7 +900,7 @@ EOF
        exit ;;
     *:GNU/*:*:*)
        # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' 
| tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' 
| tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
        exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
@@ -919,7 +923,7 @@ EOF
          EV68*) UNAME_MACHINE=alphaev68 ;;
        esac
        objdump --private-headers /bin/sh | grep -q ld.so.1
-       if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+       if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -965,6 +969,9 @@ EOF
     ia64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
+    k1om:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     m32r*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
@@ -1120,7 +1127,7 @@ EOF
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
        # the processor, so we play safe by assuming i586.
        # Note: whatever this is, it MUST be the same as what config.sub
-       # prints for the "djgpp" host, or else GDB configury will decide that
+       # prints for the "djgpp" host, or else GDB configure will decide that
        # this is a cross-build.
        echo i586-pc-msdosdjgpp
        exit ;;
@@ -1269,6 +1276,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
        echo sx8r-nec-superux${UNAME_RELEASE}
        exit ;;
+    SX-ACE:SUPER-UX:*:*)
+       echo sxace-nec-superux${UNAME_RELEASE}
+       exit ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
        exit ;;
@@ -1282,9 +1292,9 @@ EOF
            UNAME_PROCESSOR=powerpc
        fi
        if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-           if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
                if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') 
| \
-                   (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
                    grep IS_64BIT_ARCH >/dev/null
                then
                    case $UNAME_PROCESSOR in
@@ -1306,7 +1316,7 @@ EOF
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
+       if test "$UNAME_PROCESSOR" = x86; then
                UNAME_PROCESSOR=i386
                UNAME_MACHINE=pc
        fi
@@ -1337,7 +1347,7 @@ EOF
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
        # operating systems.
-       if test "$cputype" = "386"; then
+       if test "$cputype" = 386; then
            UNAME_MACHINE=i386
        else
            UNAME_MACHINE="$cputype"
@@ -1379,7 +1389,7 @@ EOF
        echo i386-pc-xenix
        exit ;;
     i*86:skyos:*:*)
-       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ 
.*$//'
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ 
.*$//'`
        exit ;;
     i*86:rdos:*:*)
        echo ${UNAME_MACHINE}-pc-rdos
@@ -1390,6 +1400,9 @@ EOF
     x86_64:VMkernel:*:*)
        echo ${UNAME_MACHINE}-unknown-esx
        exit ;;
+    amd64:Isilon\ OneFS:*:*)
+       echo x86_64-unknown-onefs
+       exit ;;
 esac
 
 cat >&2 <<EOF
@@ -1399,9 +1412,9 @@ This script, last modified $timestamp, has failed to 
recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 1acc966..8d39c4b 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2015 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2015-08-20'
+timestamp='2016-03-30'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ timestamp='2015-08-20'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# 
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2015-08-20'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@ Report bugs and patches to <address@hidden>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2015 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -521,7 +520,7 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-aros
                ;;
-        asmjs)
+       asmjs)
                basic_machine=asmjs-unknown
                ;;
        aux)
@@ -1383,7 +1382,7 @@ case $os in
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-             | -bitrig* | -openbsd* | -solidbsd* \
+             | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
@@ -1399,7 +1398,8 @@ case $os in
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | 
-tirtos*)
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+             | -onefs* | -tirtos*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1531,6 +1531,8 @@ case $os in
                ;;
        -nacl*)
                ;;
+       -ios)
+               ;;
        -none)
                ;;
        *)
diff --git a/configure b/configure
index 99c1c31..8a82bf7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU Mach 1.6+git20160502.
+# Generated by GNU Autoconf 2.69 for GNU Mach 1.7+git20160522.
 #
 # Report bugs to <address@hidden>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GNU Mach'
 PACKAGE_TARNAME='gnumach'
-PACKAGE_VERSION='1.6+git20160502'
-PACKAGE_STRING='GNU Mach 1.6+git20160502'
+PACKAGE_VERSION='1.7+git20160522'
+PACKAGE_STRING='GNU Mach 1.7+git20160522'
 PACKAGE_BUGREPORT='address@hidden'
 PACKAGE_URL=''
 
@@ -1599,7 +1599,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GNU Mach 1.6+git20160502 to adapt to many kinds of 
systems.
+\`configure' configures GNU Mach 1.7+git20160522 to adapt to many kinds of 
systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1670,7 +1670,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GNU Mach 1.6+git20160502:";;
+     short | recursive ) echo "Configuration of GNU Mach 1.7+git20160522:";;
    esac
   cat <<\_ACEOF
 
@@ -2026,7 +2026,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GNU Mach configure 1.6+git20160502
+GNU Mach configure 1.7+git20160522
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2118,7 +2118,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GNU Mach $as_me 1.6+git20160502, which was
+It was created by GNU Mach $as_me 1.7+git20160522, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2984,7 +2984,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gnumach'
- VERSION='1.6+git20160502'
+ VERSION='1.7+git20160522'
 
 
 # Some tools Automake needs.
@@ -12189,7 +12189,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GNU Mach $as_me 1.6+git20160502, which was
+This file was extended by GNU Mach $as_me 1.7+git20160522, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -12260,7 +12260,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GNU Mach config.status 1.6+git20160502
+GNU Mach config.status 1.7+git20160522
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/ddb/db_elf.c b/ddb/db_elf.c
index f654ad7..547453b 100644
--- a/ddb/db_elf.c
+++ b/ddb/db_elf.c
@@ -82,7 +82,7 @@ elf_db_sym_init (unsigned shdr_num,
 {
   Elf32_Shdr *shdr, *symtab, *strtab;
   const char *shstrtab;
-  int i;
+  unsigned i;
 
   if (shdr_num == 0)
     return FALSE;
@@ -165,23 +165,23 @@ elf_db_search_symbol (db_symtab_t *stab,
     if (s->st_name == 0)
       continue;
 
-    if (strategy == DB_STGY_XTRN && (ELF32_ST_BIND(s->st_info) != STB_GLOBAL))
+    if (strategy == DB_STGY_XTRN && (s->st_info & STB_GLOBAL) == 0)
       continue;
 
     if (off >= s->st_value) {
-      if (ELF32_ST_TYPE(s->st_info) == STT_FUNC)
+      if (s->st_info == STT_FUNC)
        continue;
 
       if (off - s->st_value < diff) {
        diff = off - s->st_value;
        symp = s;
-       if (diff == 0 && (ELF32_ST_BIND(s->st_info) == STB_GLOBAL))
+       if (diff == 0 && (s->st_info & STB_GLOBAL))
          break;
       } else if (off - s->st_value == diff) {
        if (symp == NULL)
          symp = s;
-       else if ((ELF32_ST_BIND(symp->st_info) != STB_GLOBAL)
-                && (ELF32_ST_BIND(s->st_info) == STB_GLOBAL))
+       else if ((symp->st_info & STB_GLOBAL) == 0
+                && (s->st_info & STB_GLOBAL) != 0)
          symp = s;     /* pick the external symbol */
       }
     }
diff --git a/ddb/db_output.c b/ddb/db_output.c
index a34e807..ded9fa9 100644
--- a/ddb/db_output.c
+++ b/ddb/db_output.c
@@ -203,7 +203,7 @@ void db_end_line(void)
 }
 
 /*VARARGS1*/
-void
+int
 db_printf(const char *fmt, ...)
 {
        va_list listp;
@@ -211,6 +211,7 @@ db_printf(const char *fmt, ...)
        va_start(listp, fmt);
        _doprnt(fmt, listp, db_id_putc, db_radix, 0);
        va_end(listp);
+       return 0;
 }
 
 #endif /* MACH_KDB */
diff --git a/ddb/db_output.h b/ddb/db_output.h
index 497ae43..7920179 100644
--- a/ddb/db_output.h
+++ b/ddb/db_output.h
@@ -38,7 +38,7 @@
 extern void    db_force_whitespace(void);
 extern int     db_print_position(void) __attribute__ ((pure));
 extern void    db_end_line(void);
-extern void    db_printf(const char *fmt, ...);
+extern int     db_printf(const char *fmt, ...);
 /* alternate name */
 #define kdbprintf db_printf
 extern void    db_putchar(int c);
diff --git a/device/ds_routines.c b/device/ds_routines.c
index dbff7f8..6b6dcb0 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -140,7 +140,7 @@ ds_device_open (ipc_port_t open_port, ipc_port_t reply_port,
                mach_msg_type_name_t reply_port_type, dev_mode_t mode,
                char *name, device_t *devp)
 {
-  int i;
+  unsigned i;
   io_return_t err;
 
   /* Open must be called on the master device port.  */
@@ -1715,7 +1715,7 @@ device_writev_trap (mach_device_t device, dev_mode_t mode,
        io_return_t result;
        io_buf_vec_t    stack_iovec[16]; /* XXX */
        vm_size_t data_count;
-       int i;
+       unsigned i;
 
        if (device->state != DEV_STATE_OPEN)
                return (D_NO_SUCH_DEVICE);
diff --git a/doc/mach.info b/doc/mach.info
index 51f4f5a..efb3a8d 100644
--- a/doc/mach.info
+++ b/doc/mach.info
@@ -3,7 +3,7 @@ This is mach.info, produced by makeinfo version 6.1 from 
mach.texi.
 This file documents the GNU Mach microkernel.
 
    This is edition 0.4, last updated on 20 April 2016, of 'The GNU Mach
-Reference Manual', for version 1.6+git20160502.
+Reference Manual', for version 1.7+git20160522.
 
    Copyright (C) 2001, 2002, 2006, 2007, 2008 Free Software Foundation,
 Inc.
diff --git a/doc/mach.info-1 b/doc/mach.info-1
index da9fbc0..702faf4 100644
--- a/doc/mach.info-1
+++ b/doc/mach.info-1
@@ -3,7 +3,7 @@ This is mach.info, produced by makeinfo version 6.1 from 
mach.texi.
 This file documents the GNU Mach microkernel.
 
    This is edition 0.4, last updated on 20 April 2016, of 'The GNU Mach
-Reference Manual', for version 1.6+git20160502.
+Reference Manual', for version 1.7+git20160522.
 
    Copyright (C) 2001, 2002, 2006, 2007, 2008 Free Software Foundation,
 Inc.
@@ -46,7 +46,7 @@ Main Menu
 This file documents the GNU Mach microkernel.
 
    This is edition 0.4, last updated on 20 April 2016, of 'The GNU Mach
-Reference Manual', for version 1.6+git20160502.
+Reference Manual', for version 1.7+git20160522.
 
    Copyright (C) 2001, 2002, 2006, 2007, 2008 Free Software Foundation,
 Inc.
diff --git a/doc/mach.info-2 b/doc/mach.info-2
index e91cf0e..5ea617d 100644
--- a/doc/mach.info-2
+++ b/doc/mach.info-2
@@ -3,7 +3,7 @@ This is mach.info, produced by makeinfo version 6.1 from 
mach.texi.
 This file documents the GNU Mach microkernel.
 
    This is edition 0.4, last updated on 20 April 2016, of 'The GNU Mach
-Reference Manual', for version 1.6+git20160502.
+Reference Manual', for version 1.7+git20160522.
 
    Copyright (C) 2001, 2002, 2006, 2007, 2008 Free Software Foundation,
 Inc.
diff --git a/doc/stamp-vti b/doc/stamp-vti
index 13c069d..4f8403b 100644
--- a/doc/stamp-vti
+++ b/doc/stamp-vti
@@ -1,4 +1,4 @@
 @set UPDATED 20 April 2016
 @set UPDATED-MONTH April 2016
address@hidden EDITION 1.6+git20160502
address@hidden VERSION 1.6+git20160502
address@hidden EDITION 1.7+git20160522
address@hidden VERSION 1.7+git20160522
diff --git a/doc/version.texi b/doc/version.texi
index 13c069d..4f8403b 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,4 +1,4 @@
 @set UPDATED 20 April 2016
 @set UPDATED-MONTH April 2016
address@hidden EDITION 1.6+git20160502
address@hidden VERSION 1.6+git20160502
address@hidden EDITION 1.7+git20160522
address@hidden VERSION 1.7+git20160522
diff --git a/i386/i386/user_ldt.c b/i386/i386/user_ldt.c
index d8bdb90..e7705b5 100644
--- a/i386/i386/user_ldt.c
+++ b/i386/i386/user_ldt.c
@@ -57,11 +57,11 @@ i386_set_ldt(
 {
        user_ldt_t      new_ldt, old_ldt, temp;
        struct real_descriptor *dp;
-       int             i;
-       int             min_selector = 0;
+       unsigned        i;
+       unsigned        min_selector = 0;
        pcb_t           pcb;
        vm_size_t       ldt_size_needed;
-       int             first_desc = sel_idx(first_selector);
+       unsigned        first_desc = sel_idx(first_selector);
        vm_map_copy_t   old_copy_object = NULL; /* Suppress gcc warning */
 
        if (thread == THREAD_NULL)
@@ -224,7 +224,6 @@ i386_set_ldt(
        if (new_ldt)
 #ifdef MACH_PV_DESCRIPTORS
        {
-           int i;
 #ifdef MACH_PV_PAGETABLES
            for (i=0; i<(new_ldt->desc.limit_low + 1)/sizeof(struct 
real_descriptor); i+=PAGE_SIZE/sizeof(struct real_descriptor))
                pmap_set_page_readwrite(&new_ldt->ldt[i]);
@@ -264,7 +263,7 @@ i386_get_ldt(thread, first_selector, selector_count, 
desc_list, count)
        struct user_ldt *user_ldt;
        pcb_t           pcb;
        int             first_desc = sel_idx(first_selector);
-       unsigned int    ldt_count;
+       unsigned        ldt_count;
        vm_size_t       ldt_size;
        vm_size_t       size, size_needed;
        vm_offset_t     addr;
@@ -370,7 +369,7 @@ void
 user_ldt_free(user_ldt_t user_ldt)
 {
 #ifdef MACH_PV_DESCRIPTORS
-       int i;
+       unsigned i;
 #ifdef MACH_PV_PAGETABLES
        for (i=0; i<(user_ldt->desc.limit_low + 1)/sizeof(struct 
real_descriptor); i+=PAGE_SIZE/sizeof(struct real_descriptor))
                pmap_set_page_readwrite(&user_ldt->ldt[i]);
diff --git a/i386/i386/xen.h b/i386/i386/xen.h
index 49b0d52..b434dda 100644
--- a/i386/i386/xen.h
+++ b/i386/i386/xen.h
@@ -260,7 +260,7 @@ MACH_INLINE void hyp_set_ldt(void *ldt, unsigned long 
nbentries) {
                .arg1.linear_addr = kvtolin(ldt),
                .arg2.nr_ents = nbentries,
        };
-       int count;
+       unsigned long count;
        if (((unsigned long)ldt) & PAGE_MASK)
                panic("ldt %p is not aligned on a page\n", ldt);
        for (count=0; count<nbentries; count+= PAGE_SIZE/8)
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 0771a08..e362b45 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -643,7 +643,7 @@ void pmap_bootstrap(void)
        kernel_pmap->dirbase = kernel_page_dir = 
(pt_entry_t*)phystokv(pmap_grab_page());
 #endif /* PAE */
        {
-               int i;
+               unsigned i;
                for (i = 0; i < NPDES; i++)
                        kernel_pmap->dirbase[i] = 0;
        }
@@ -678,7 +678,7 @@ void pmap_bootstrap(void)
                        l2_map += (la >> PDESHIFT) & PDEMASK;
                        if (!(*l2_map & INTEL_PTE_VALID)) {
                                struct mmu_update update;
-                               int j, n;
+                               unsigned j, n;
 
                                l1_map[n_l1map] = (pt_entry_t*) 
phystokv(pmap_grab_page());
                                for (j = 0; j < NPTES; j++)
@@ -857,11 +857,11 @@ void pmap_set_page_readonly_init(void *_vaddr) {
 }
 
 void pmap_clear_bootstrap_pagetable(pt_entry_t *base) {
-       int i;
+       unsigned i;
        pt_entry_t *dir;
        vm_offset_t va = 0;
 #if PAE
-       int j;
+       unsigned j;
 #endif /* PAE */
        if (!hyp_mmuext_op_mfn (MMUEXT_UNPIN_TABLE, kv_to_mfn(base)))
                panic("pmap_clear_bootstrap_pagetable: couldn't unpin page 
%p(%p)\n", base, (vm_offset_t) kv_to_ma(base));
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 21667ca..28ed23c 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -2857,7 +2857,7 @@ ipc_msg_print(mach_msg_header_t *msgh)
 
                if (is_inline) {
                        vm_size_t amount;
-                       int i, numwords;
+                       unsigned i, numwords;
 
                        /* inline data sizes round up to int boundaries */
                        amount = (length + 3) &~ 3;
diff --git a/kern/boot_script.c b/kern/boot_script.c
index b245d1d..b2ae901 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -294,7 +294,8 @@ boot_script_parse_line (void *hook, char *cmdline)
          for (p += 2;;)
            {
              char c;
-             int i, type;
+             unsigned i;
+             int type;
              long val;
              struct sym *s;
 
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 0836276..7398ea4 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -124,7 +124,7 @@ free_bootstrap_pages(phys_addr_t start, phys_addr_t end)
 void bootstrap_create(void)
 {
   int compat;
-  int n = 0;
+  unsigned n = 0;
 #ifdef MACH_XEN
   struct multiboot_module *bmods = ((struct multiboot_module *)
                                    boot_info.mod_start);
@@ -164,7 +164,8 @@ void bootstrap_create(void)
     }
   else
     {
-      int i, losers;
+      unsigned i;
+      int losers;
 
       /* Initialize boot script variables.  We leak these send rights.  */
       losers = boot_script_set_variable
diff --git a/kern/host.c b/kern/host.c
index 2855cd2..57280c4 100644
--- a/kern/host.c
+++ b/kern/host.c
@@ -51,7 +51,7 @@ kern_return_t host_processors(
        processor_array_t       *processor_list,
        natural_t               *countp)
 {
-       int                     i;
+       unsigned                i;
        processor_t             *tp;
        vm_offset_t             addr;
        unsigned int            count;
diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c
index e4d657b..04a5a92 100644
--- a/kern/ipc_tt.c
+++ b/kern/ipc_tt.c
@@ -818,7 +818,7 @@ mach_ports_register(
        mach_msg_type_number_t  portsCnt)
 {
        ipc_port_t ports[TASK_PORT_REGISTER_MAX];
-       int i;
+       unsigned i;
 
        if ((task == TASK_NULL) ||
            (portsCnt > TASK_PORT_REGISTER_MAX))
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index d6ebf23..e4d44f5 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -74,11 +74,11 @@ int         timedelta = 0;
 int            tickdelta = 0;
 
 #if    HZ > 500
-int            tickadj = 1;            /* can adjust HZ usecs per second */
+unsigned       tickadj = 1;            /* can adjust HZ usecs per second */
 #else
-int            tickadj = 500 / HZ;     /* can adjust 100 usecs per second */
+unsigned       tickadj = 500 / HZ;     /* can adjust 100 usecs per second */
 #endif
-int            bigadj = 1000000;       /* adjust 10*tickadj if adjustment
+unsigned       bigadj = 1000000;       /* adjust 10*tickadj if adjustment
                                           > bigadj */
 
 /*
diff --git a/kern/processor.c b/kern/processor.c
index 0a88469..dffd7d0 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -849,7 +849,7 @@ processor_set_things(
        int             type)
 {
        unsigned int actual;    /* this many things */
-       int i;
+       unsigned i;
 
        vm_size_t size, size_needed;
        vm_offset_t addr;
diff --git a/kern/strings.c b/kern/strings.c
index e299534..64410d9 100644
--- a/kern/strings.c
+++ b/kern/strings.c
@@ -184,7 +184,7 @@ memset(
        void *_s, int c, size_t n)
 {
        char *s = _s;
-       int i;
+       size_t i;
 
        for (i = 0; i < n ; i++)
                s[i] = c;
diff --git a/kern/task.c b/kern/task.c
index 0f24e44..d721f17 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -565,7 +565,7 @@ kern_return_t task_threads(
        unsigned int actual;    /* this many threads */
        thread_t thread;
        thread_t *threads;
-       int i;
+       unsigned i;
 
        vm_size_t size, size_needed;
        vm_offset_t addr;
diff --git a/kern/thread.c b/kern/thread.c
index ce44ed1..a821149 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -2332,7 +2332,7 @@ void consider_thread_collect(void)
 vm_size_t stack_usage(
        vm_offset_t stack)
 {
-       int i;
+       unsigned i;
 
        for (i = 0; i < KERNEL_STACK_SIZE/sizeof(unsigned int); i++)
            if (((unsigned int *)stack)[i] != STACK_MARKER)
@@ -2350,7 +2350,7 @@ void stack_init(
        vm_offset_t stack)
 {
        if (stack_check_usage) {
-           int i;
+           unsigned i;
 
            for (i = 0; i < KERNEL_STACK_SIZE/sizeof(unsigned int); i++)
                ((unsigned int *)stack)[i] = STACK_MARKER;
diff --git a/version.m4 b/version.m4
index c76a401..3dc231a 100644
--- a/version.m4
+++ b/version.m4
@@ -1,4 +1,4 @@
 m4_define([AC_PACKAGE_NAME],[GNU Mach])
-m4_define([AC_PACKAGE_VERSION],[1.6+git20160502])
+m4_define([AC_PACKAGE_VERSION],[1.7+git20160522])
 m4_define([AC_PACKAGE_BUGREPORT],address@hidden)
 m4_define([AC_PACKAGE_TARNAME],[gnumach])
diff --git a/vm/memory_object.c b/vm/memory_object.c
index 097ed23..7d33201 100644
--- a/vm/memory_object.c
+++ b/vm/memory_object.c
@@ -704,7 +704,7 @@ memory_object_lock_request(
 #define        PAGEOUT_PAGES                                                   
\
 MACRO_BEGIN                                                            \
        vm_map_copy_t           copy;                                   \
-       int                     i;                                      \
+       unsigned                i;                                      \
        vm_page_t               hp;                                     \
                                                                        \
        vm_object_unlock(object);                                       \
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 89a2b38..7a90551 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -42,6 +42,7 @@
 #include <kern/assert.h>
 #include <kern/debug.h>
 #include <kern/kalloc.h>
+#include <kern/list.h>
 #include <kern/rbtree.h>
 #include <kern/slab.h>
 #include <vm/pmap.h>
@@ -182,6 +183,7 @@ void vm_map_setup(
        map->hdr.nentries = 0;
        map->hdr.entries_pageable = pageable;
        rbtree_init(&map->hdr.tree);
+       rbtree_init(&map->hdr.gap_tree);
 
        map->size = 0;
        map->user_wired = 0;
@@ -294,6 +296,141 @@ static inline int vm_map_entry_cmp_insert(const struct 
rbtree_node *a,
 }
 
 /*
+ *     Gap management functions
+ */
+static inline int vm_map_entry_gap_cmp_lookup(vm_size_t gap_size,
+                                             const struct rbtree_node *node)
+{
+       struct vm_map_entry *entry;
+
+       entry = rbtree_entry(node, struct vm_map_entry, gap_node);
+
+       if (gap_size < entry->gap_size)
+               return -1;
+       else if (gap_size == entry->gap_size)
+               return 0;
+       else
+               return 1;
+}
+
+static inline int vm_map_entry_gap_cmp_insert(const struct rbtree_node *a,
+                                             const struct rbtree_node *b)
+{
+       struct vm_map_entry *entry;
+
+       entry = rbtree_entry(a, struct vm_map_entry, gap_node);
+       return vm_map_entry_gap_cmp_lookup(entry->gap_size, b);
+}
+
+static int
+vm_map_gap_valid(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       return entry != (struct vm_map_entry *)&hdr->links;
+}
+
+static void
+vm_map_gap_compute(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       struct vm_map_entry *next;
+
+       next = entry->vme_next;
+
+       if (vm_map_gap_valid(hdr, next)) {
+               entry->gap_size = next->vme_start - entry->vme_end;
+       } else {
+               entry->gap_size = hdr->vme_end - entry->vme_end;
+       }
+}
+
+static void
+vm_map_gap_insert_single(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       struct vm_map_entry *tmp;
+       struct rbtree_node *node;
+       unsigned long slot;
+
+       if (!vm_map_gap_valid(hdr, entry)) {
+               return;
+       }
+
+       vm_map_gap_compute(hdr, entry);
+
+       if (entry->gap_size == 0) {
+               return;
+       }
+
+       node = rbtree_lookup_slot(&hdr->gap_tree, entry->gap_size,
+                                 vm_map_entry_gap_cmp_lookup, slot);
+
+       if (node == NULL) {
+               rbtree_insert_slot(&hdr->gap_tree, slot, &entry->gap_node);
+               list_init(&entry->gap_list);
+               entry->in_gap_tree = 1;
+       } else {
+               tmp = rbtree_entry(node, struct vm_map_entry, gap_node);
+               list_insert_tail(&tmp->gap_list, &entry->gap_list);
+               entry->in_gap_tree = 0;
+       }
+}
+
+static void
+vm_map_gap_remove_single(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       struct vm_map_entry *tmp;
+
+       if (!vm_map_gap_valid(hdr, entry)) {
+               return;
+       }
+
+       if (entry->gap_size == 0) {
+               return;
+       }
+
+       if (!entry->in_gap_tree) {
+               list_remove(&entry->gap_list);
+               return;
+       }
+
+       rbtree_remove(&hdr->gap_tree, &entry->gap_node);
+
+       if (list_empty(&entry->gap_list)) {
+               return;
+       }
+
+       tmp = list_first_entry(&entry->gap_list, struct vm_map_entry, gap_list);
+       assert(tmp->gap_size == entry->gap_size);
+       list_remove(&tmp->gap_list);
+       list_set_head(&tmp->gap_list, &entry->gap_list);
+       assert(!tmp->in_gap_tree);
+       rbtree_insert(&hdr->gap_tree, &tmp->gap_node,
+                     vm_map_entry_gap_cmp_insert);
+       tmp->in_gap_tree = 1;
+}
+
+static void
+vm_map_gap_update(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       vm_map_gap_remove_single(hdr, entry);
+       vm_map_gap_insert_single(hdr, entry);
+}
+
+static void
+vm_map_gap_insert(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       vm_map_gap_remove_single(hdr, entry->vme_prev);
+       vm_map_gap_insert_single(hdr, entry->vme_prev);
+       vm_map_gap_insert_single(hdr, entry);
+}
+
+static void
+vm_map_gap_remove(struct vm_map_header *hdr, struct vm_map_entry *entry)
+{
+       vm_map_gap_remove_single(hdr, entry);
+       vm_map_gap_remove_single(hdr, entry->vme_prev);
+       vm_map_gap_insert_single(hdr, entry->vme_prev);
+}
+
+/*
  *     vm_map_entry_{un,}link:
  *
  *     Insert/remove entries from maps (or map copies).
@@ -316,6 +453,7 @@ static inline int vm_map_entry_cmp_insert(const struct 
rbtree_node *a,
         (entry)->vme_next->vme_prev = (entry);         \
        rbtree_insert(&(hdr)->tree, &(entry)->tree_node,        \
                      vm_map_entry_cmp_insert);         \
+       vm_map_gap_insert((hdr), (entry));              \
        MACRO_END
 
 #define vm_map_entry_unlink(map, entry)                        \
@@ -330,6 +468,7 @@ static inline int vm_map_entry_cmp_insert(const struct 
rbtree_node *a,
        (entry)->vme_next->vme_prev = (entry)->vme_prev; \
        (entry)->vme_prev->vme_next = (entry)->vme_next; \
        rbtree_remove(&(hdr)->tree, &(entry)->tree_node);       \
+       vm_map_gap_remove((hdr), (entry));              \
        MACRO_END
 
 /*
@@ -470,6 +609,104 @@ invalid_user_access(
                (prot & ~(entry->protection)));
 }
 
+/*
+ * Find a range of available space from the specified map.
+ *
+ * If successful, this function returns the map entry immediately preceding
+ * the range, and writes the range address in startp. If the map contains
+ * no entry, the entry returned points to the map header.
+ * Otherwise, NULL is returned.
+ *
+ * If map_locked is true, this function will not wait for more space in case
+ * of failure. Otherwise, the map is locked.
+ */
+static struct vm_map_entry *
+vm_map_find_entry_anywhere(struct vm_map *map,
+                          vm_size_t size,
+                          vm_offset_t mask,
+                          boolean_t map_locked,
+                          vm_offset_t *startp)
+{
+       struct vm_map_entry *entry;
+       struct rbtree_node *node;
+       vm_size_t max_size;
+       vm_offset_t start, end;
+
+       assert(size != 0);
+
+       if (!map_locked) {
+               vm_map_lock(map);
+       }
+
+restart:
+       if (map->hdr.nentries == 0) {
+               entry = vm_map_to_entry(map);
+               start = (map->min_offset + mask) & ~mask;
+               end = start + size;
+
+               if ((end <= start) || (end > map->max_offset)) {
+                       goto error;
+               }
+
+               *startp = start;
+               return entry;
+       }
+
+       entry = map->first_free;
+
+       if (entry != vm_map_to_entry(map)) {
+               start = (entry->vme_end + mask) & ~mask;
+               end = start + size;
+
+               if ((end > start)
+                   && (end <= map->max_offset)
+                   && (end <= (entry->vme_end + entry->gap_size))) {
+                       *startp = start;
+                       return entry;
+               }
+       }
+
+       max_size = size + mask;
+
+       if (max_size < size) {
+               goto error;
+       }
+
+       node = rbtree_lookup_nearest(&map->hdr.gap_tree, max_size,
+                                    vm_map_entry_gap_cmp_lookup, RBTREE_RIGHT);
+
+       if (node == NULL) {
+               if (map_locked || !map->wait_for_space) {
+                       goto error;
+               }
+
+               assert_wait((event_t)map, TRUE);
+               vm_map_unlock(map);
+               thread_block(NULL);
+               vm_map_lock(map);
+               goto restart;
+       }
+
+       entry = rbtree_entry(node, struct vm_map_entry, gap_node);
+       assert(entry->in_gap_tree);
+
+       if (!list_empty(&entry->gap_list)) {
+               entry = list_last_entry(&entry->gap_list,
+                                       struct vm_map_entry, gap_list);
+       }
+
+       assert(entry->gap_size >= max_size);
+       start = (entry->vme_end + mask) & ~mask;
+       end = start + size;
+       assert(end > start);
+       assert(end <= (entry->vme_end + entry->gap_size));
+       *startp = start;
+       return entry;
+
+error:
+       printf("no more room in %p\n", map);
+       return NULL;
+}
 
 /*
  *     Routine:        vm_map_find_entry
@@ -496,67 +733,14 @@ kern_return_t vm_map_find_entry(
        vm_offset_t     start;
        vm_offset_t     end;
 
-       /*
-        *      Look for the first possible address;
-        *      if there's already something at this
-        *      address, we have to start after it.
-        */
-
-       if ((entry = map->first_free) == vm_map_to_entry(map))
-               start = map->min_offset;
-       else
-               start = entry->vme_end;
-
-       /*
-        *      In any case, the "entry" always precedes
-        *      the proposed new region throughout the loop:
-        */
-
-       while (TRUE) {
-               vm_map_entry_t  next;
+       entry = vm_map_find_entry_anywhere(map, size, mask, TRUE, &start);
 
-               /*
-                *      Find the end of the proposed new region.
-                *      Be sure we didn't go beyond the end, or
-                *      wrap around the address.
-                */
-
-               if (((start + mask) & ~mask) < start) {
-                       printf_once("no more room for vm_map_find_entry in 
%p\n", map);
-                       return(KERN_NO_SPACE);
-               }
-               start = ((start + mask) & ~mask);
-               end = start + size;
-
-               if ((end > map->max_offset) || (end < start)) {
-                       printf_once("no more room for vm_map_find_entry in 
%p\n", map);
-                       return(KERN_NO_SPACE);
-               }
-
-               /*
-                *      If there are no more entries, we must win.
-                */
-
-               next = entry->vme_next;
-               if (next == vm_map_to_entry(map))
-                       break;
-
-               /*
-                *      If there is another entry, it must be
-                *      after the end of the potential new region.
-                */
-
-               if (next->vme_start >= end)
-                       break;
-
-               /*
-                *      Didn't fit -- move to the next entry.
-                */
-
-               entry = next;
-               start = entry->vme_end;
+       if (entry == NULL) {
+               return KERN_NO_SPACE;
        }
 
+       end = start + size;
+
        /*
         *      At this point,
         *              "start" and "end" should define the endpoints of the
@@ -594,6 +778,7 @@ kern_return_t vm_map_find_entry(
                 */
 
                entry->vme_end = end;
+               vm_map_gap_update(&map->hdr, entry);
                new_entry = entry;
        } else {
                new_entry = vm_map_entry_create(map);
@@ -736,98 +921,16 @@ kern_return_t vm_map_enter(
        if (size == 0)
                return KERN_INVALID_ARGUMENT;
 
- StartAgain: ;
-
        start = *address;
 
        if (anywhere) {
-               vm_map_lock(map);
-
-               /*
-                *      Calculate the first possible address.
-                */
+               entry = vm_map_find_entry_anywhere(map, size, mask, FALSE, 
&start);
 
-               if (start < map->min_offset)
-                       start = map->min_offset;
-               if (start > map->max_offset)
+               if (entry == NULL) {
                        RETURN(KERN_NO_SPACE);
-
-               /*
-                *      Look for the first possible address;
-                *      if there's already something at this
-                *      address, we have to start after it.
-                */
-
-               if (start == map->min_offset) {
-                       if ((entry = map->first_free) != vm_map_to_entry(map))
-                               start = entry->vme_end;
-               } else {
-                       vm_map_entry_t  tmp_entry;
-                       if (vm_map_lookup_entry(map, start, &tmp_entry))
-                               start = tmp_entry->vme_end;
-                       entry = tmp_entry;
                }
 
-               /*
-                *      In any case, the "entry" always precedes
-                *      the proposed new region throughout the
-                *      loop:
-                */
-
-               while (TRUE) {
-                       vm_map_entry_t  next;
-
-                       /*
-                        *      Find the end of the proposed new region.
-                        *      Be sure we didn't go beyond the end, or
-                        *      wrap around the address.
-                        */
-
-                       if (((start + mask) & ~mask) < start) {
-                               printf_once("no more room for vm_map_enter in 
%p\n", map);
-                               RETURN(KERN_NO_SPACE);
-                       }
-                       start = ((start + mask) & ~mask);
-                       end = start + size;
-
-                       if ((end > map->max_offset) || (end < start)) {
-                               if (map->wait_for_space) {
-                                       if (size <= (map->max_offset -
-                                                    map->min_offset)) {
-                                               assert_wait((event_t) map, 
TRUE);
-                                               vm_map_unlock(map);
-                                               thread_block((void (*)()) 0);
-                                               goto StartAgain;
-                                       }
-                               }
-
-                               printf_once("no more room for vm_map_enter in 
%p\n", map);
-                               RETURN(KERN_NO_SPACE);
-                       }
-
-                       /*
-                        *      If there are no more entries, we must win.
-                        */
-
-                       next = entry->vme_next;
-                       if (next == vm_map_to_entry(map))
-                               break;
-
-                       /*
-                        *      If there is another entry, it must be
-                        *      after the end of the potential new region.
-                        */
-
-                       if (next->vme_start >= end)
-                               break;
-
-                       /*
-                        *      Didn't fit -- move to the next entry.
-                        */
-
-                       entry = next;
-                       start = entry->vme_end;
-               }
+               end = start + size;
                *address = start;
        } else {
                vm_map_entry_t          temp_entry;
@@ -914,6 +1017,7 @@ kern_return_t vm_map_enter(
                         */
                        map->size += (end - entry->vme_end);
                        entry->vme_end = end;
+                       vm_map_gap_update(&map->hdr, entry);
                        RETURN(KERN_SUCCESS);
                }
        }
@@ -2373,29 +2477,40 @@ start_pass_1:
 }
 
 /*
- *     Macro:          vm_map_copy_insert
+ *     Routine:        vm_map_copy_insert
  *
  *     Description:
  *             Link a copy chain ("copy") into a map at the
  *             specified location (after "where").
  *     Side effects:
  *             The copy chain is destroyed.
- *     Warning:
- *             The arguments are evaluated multiple times.
  */
-#define        vm_map_copy_insert(map, where, copy)                            
\
-       MACRO_BEGIN                                                     \
-       struct rbtree_node *node, *tmp;                                 \
-       rbtree_for_each_remove(&(copy)->cpy_hdr.tree, node, tmp)        \
-               rbtree_insert(&(map)->hdr.tree, node,                   \
-                             vm_map_entry_cmp_insert);                 \
-       (((where)->vme_next)->vme_prev = vm_map_copy_last_entry(copy))  \
-               ->vme_next = ((where)->vme_next);                       \
-       ((where)->vme_next = vm_map_copy_first_entry(copy))             \
-               ->vme_prev = (where);                                   \
-       (map)->hdr.nentries += (copy)->cpy_hdr.nentries;                \
-       kmem_cache_free(&vm_map_copy_cache, (vm_offset_t) copy);        \
-       MACRO_END
+static void
+vm_map_copy_insert(struct vm_map *map, struct vm_map_entry *where,
+                  struct vm_map_copy *copy)
+{
+       struct vm_map_entry *entry;
+
+       assert(copy->type == VM_MAP_COPY_ENTRY_LIST);
+
+       for (;;) {
+               entry = vm_map_copy_first_entry(copy);
+
+               if (entry == vm_map_copy_to_entry(copy)) {
+                       break;
+               }
+
+               /*
+                * TODO Turn copy maps into their own type so they don't
+                * use any of the tree operations.
+                */
+               vm_map_copy_entry_unlink(copy, entry);
+               vm_map_entry_link(map, where, entry);
+               where = entry;
+       }
+
+       kmem_cache_free(&vm_map_copy_cache, (vm_offset_t)copy);
+}
 
 /*
  *     Routine:        vm_map_copyout
@@ -2460,37 +2575,11 @@ kern_return_t vm_map_copyout(
 
        vm_copy_start = trunc_page(copy->offset);
        size =  round_page(copy->offset + copy->size) - vm_copy_start;
+       last = vm_map_find_entry_anywhere(dst_map, size, 0, FALSE, &start);
 
- StartAgain: ;
-
-       vm_map_lock(dst_map);
-       start = ((last = dst_map->first_free) == vm_map_to_entry(dst_map)) ?
-               vm_map_min(dst_map) : last->vme_end;
-
-       while (TRUE) {
-               vm_map_entry_t  next = last->vme_next;
-               vm_offset_t     end = start + size;
-
-               if ((end > dst_map->max_offset) || (end < start)) {
-                       if (dst_map->wait_for_space) {
-                               if (size <= (dst_map->max_offset - 
dst_map->min_offset)) {
-                                       assert_wait((event_t) dst_map, TRUE);
-                                       vm_map_unlock(dst_map);
-                                       thread_block((void (*)()) 0);
-                                       goto StartAgain;
-                               }
-                       }
-                       vm_map_unlock(dst_map);
-                       printf_once("no more room for vm_map_copyout in %p\n", 
dst_map);
-                       return(KERN_NO_SPACE);
-               }
-
-               if ((next == vm_map_to_entry(dst_map)) ||
-                   (next->vme_start >= end))
-                       break;
-
-               last = next;
-               start = last->vme_end;
+       if (last == NULL) {
+               vm_map_unlock(dst_map);
+               return KERN_NO_SPACE;
        }
 
        /*
@@ -2515,6 +2604,7 @@ kern_return_t vm_map_copyout(
            copy->cpy_hdr.nentries = 0;
            copy->cpy_hdr.entries_pageable = dst_map->hdr.entries_pageable;
            rbtree_init(&copy->cpy_hdr.tree);
+           rbtree_init(&copy->cpy_hdr.gap_tree);
            vm_map_copy_first_entry(copy) =
             vm_map_copy_last_entry(copy) =
                vm_map_copy_to_entry(copy);
@@ -2546,6 +2636,11 @@ kern_return_t vm_map_copyout(
                entry->vme_start += adjustment;
                entry->vme_end += adjustment;
 
+               /*
+                * XXX There is no need to update the gap tree here.
+                * See vm_map_copy_insert.
+                */
+
                entry->inheritance = VM_INHERIT_DEFAULT;
                entry->protection = VM_PROT_DEFAULT;
                entry->max_protection = VM_PROT_ALL;
@@ -2691,44 +2786,19 @@ kern_return_t vm_map_copyout_page_list(
 
        size =  round_page(copy->offset + copy->size) -
                trunc_page(copy->offset);
-StartAgain:
-       vm_map_lock(dst_map);
-       must_wire = dst_map->wiring_required;
 
-       last = dst_map->first_free;
-       if (last == vm_map_to_entry(dst_map)) {
-               start = vm_map_min(dst_map);
-       } else {
-               start = last->vme_end;
-       }
+       vm_map_lock(dst_map);
 
-       while (TRUE) {
-               vm_map_entry_t next = last->vme_next;
-               end = start + size;
+       last = vm_map_find_entry_anywhere(dst_map, size, 0, FALSE, &start);
 
-               if ((end > dst_map->max_offset) || (end < start)) {
-                       if (dst_map->wait_for_space) {
-                               if (size <= (dst_map->max_offset -
-                                            dst_map->min_offset)) {
-                                       assert_wait((event_t) dst_map, TRUE);
-                                       vm_map_unlock(dst_map);
-                                       thread_block((void (*)()) 0);
-                                       goto StartAgain;
-                               }
-                       }
-                       vm_map_unlock(dst_map);
-                       printf_once("no more room for vm_map_copyout_page_list 
in %p\n", dst_map);
-                       return(KERN_NO_SPACE);
-               }
+       if (last == NULL) {
+               vm_map_unlock(dst_map);
+               return KERN_NO_SPACE;
+       }
 
-               if ((next == vm_map_to_entry(dst_map)) ||
-                   (next->vme_start >= end)) {
-                       break;
-               }
+       end = start + size;
 
-               last = next;
-               start = last->vme_end;
-       }
+       must_wire = dst_map->wiring_required;
 
        /*
         *      See whether we can avoid creating a new entry (and object) by
@@ -2815,6 +2885,7 @@ StartAgain:
         */
        dst_map->size += size;
        last->vme_end = end;
+       vm_map_gap_update(&dst_map->hdr, last);
 
        SAVE_HINT(dst_map, last);
 
@@ -3102,6 +3173,7 @@ kern_return_t vm_map_copyin(
        copy->cpy_hdr.nentries = 0;
        copy->cpy_hdr.entries_pageable = TRUE;
        rbtree_init(&copy->cpy_hdr.tree);
+       rbtree_init(&copy->cpy_hdr.gap_tree);
 
        copy->offset = src_addr;
        copy->size = len;
@@ -4624,8 +4696,8 @@ void vm_map_simplify(
                        map->first_free = prev_entry;
 
                SAVE_HINT(map, prev_entry);
-               vm_map_entry_unlink(map, this_entry);
                prev_entry->vme_end = this_entry->vme_end;
+               vm_map_entry_unlink(map, this_entry);
                vm_object_deallocate(this_entry->object.vm_object);
                vm_map_entry_dispose(map, this_entry);
        }
diff --git a/vm/vm_map.h b/vm/vm_map.h
index b4ba7c7..74c86a7 100644
--- a/vm/vm_map.h
+++ b/vm/vm_map.h
@@ -50,6 +50,7 @@
 #include <vm/vm_object.h>
 #include <vm/vm_page.h>
 #include <vm/vm_types.h>
+#include <kern/list.h>
 #include <kern/lock.h>
 #include <kern/rbtree.h>
 #include <kern/macros.h>
@@ -105,9 +106,17 @@ struct vm_map_entry {
 #define vme_start              links.start
 #define vme_end                        links.end
        struct rbtree_node      tree_node;      /* links to other entries in 
tree */
+       struct rbtree_node      gap_node;       /* links to other entries in 
gap tree */
+       struct list             gap_list;       /* links to other entries with
+                                                  the same gap size */
+       vm_size_t               gap_size;       /* size of available memory
+                                                  following this entry */
        union vm_map_object     object;         /* object I point to */
        vm_offset_t             offset;         /* offset into object */
        unsigned int
+       /* boolean_t */         in_gap_tree:1,  /* entry is in the gap tree if 
true,
+                                                  or linked to other entries 
with
+                                                  the same gap size if false */
        /* boolean_t */         is_shared:1,    /* region is shared */
        /* boolean_t */         is_sub_map:1,   /* Is "object" a submap? */
        /* boolean_t */         in_transition:1, /* Entry being changed */
@@ -141,6 +150,8 @@ typedef struct vm_map_entry *vm_map_entry_t;
 struct vm_map_header {
        struct vm_map_links     links;          /* first, last, min, max */
        struct rbtree           tree;           /* Sorted tree of entries */
+       struct rbtree           gap_tree;       /* Sorted tree of gap lists
+                                                  for allocations */
        int                     nentries;       /* Number of entries */
        boolean_t               entries_pageable;
                                                /* are map entries pageable? */
diff --git a/vm/vm_object.c b/vm/vm_object.c
index bc30128..046b6c4 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -302,6 +302,7 @@ void vm_object_bootstrap(void)
        vm_object_template.all_wanted = 0; /* all bits FALSE */
 
        vm_object_template.paging_in_progress = 0;
+       vm_object_template.used_for_pageout = FALSE;
        vm_object_template.can_persist = FALSE;
        vm_object_template.cached = FALSE;
        vm_object_template.internal = TRUE;
@@ -2742,6 +2743,7 @@ boolean_t vm_object_coalesce(
 
        if ((prev_object->ref_count > 1) ||
            prev_object->pager_created ||
+           prev_object->used_for_pageout ||
            (prev_object->shadow != VM_OBJECT_NULL) ||
            (prev_object->copy != VM_OBJECT_NULL) ||
            (prev_object->paging_in_progress != 0)) {
diff --git a/vm/vm_object.h b/vm/vm_object.h
index eb8a0c2..e1dd0ba 100644
--- a/vm/vm_object.h
+++ b/vm/vm_object.h
@@ -113,6 +113,13 @@ struct vm_object {
                                                 * of these fields (i.e., don't
                                                 * collapse, destroy or 
terminate)
                                                 */
+       /* boolean_t */         used_for_pageout:1,/* The object carries data 
sent to
+                                                * a memory manager, which 
signals
+                                                * it's done by releasing 
memory.
+                                                * This flag prevents 
coalescing so
+                                                * that unmapping memory 
immediately
+                                                * results in object 
termination.
+                                                */
        /* boolean_t */         pager_created:1,/* Has pager ever been created? 
*/
        /* boolean_t */         pager_initialized:1,/* Are fields ready to use? 
*/
        /* boolean_t */         pager_ready:1,  /* Will manager take requests? 
*/
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
index 72f96cb..f420804 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -461,6 +461,7 @@ vm_pageout_page(
         *      Allocate a new object into which we can put the page.
         */
        new_object = vm_object_allocate(PAGE_SIZE);
+       new_object->used_for_pageout = TRUE;
 
        /*
         *      Move the page into the new object.
diff --git a/xen/block.c b/xen/block.c
index 46df358..7d6f1ca 100644
--- a/xen/block.c
+++ b/xen/block.c
@@ -247,7 +247,7 @@ void hyp_block_init(void) {
                        /* Allocate an event channel and give it to backend.  */
                        bd->evt = evt = hyp_event_channel_alloc(domid);
                        hyp_evt_handler(evt, hyp_block_intr, n, SPL7);
-                       i = sprintf(port_name, "%lu", evt);
+                       i = sprintf(port_name, "%u", evt);
                        c = hyp_store_write(t, port_name, 5, VBD_PATH, "/", 
vbds[n], "/", "event-channel");
                        if (!c)
                                panic("%s: couldn't store event channel (%s)", 
device_name, hyp_store_error);
@@ -351,7 +351,7 @@ static io_return_t
 device_open (ipc_port_t reply_port, mach_msg_type_name_t reply_port_type,
            dev_mode_t mode, char *name, device_t *devp /* out */)
 {
-       int i, err = 0;
+       int i;
        ipc_port_t port, notify;
        struct block_data *bd;
 
@@ -569,13 +569,13 @@ device_write(void *d, ipc_port_t reply_port,
   io_return_t err = 0;
   vm_map_copy_t copy = (vm_map_copy_t) data;
   vm_offset_t aligned_buffer = 0;
-  int copy_npages = atop(round_page(count));
+  unsigned copy_npages = atop(round_page(count));
   vm_offset_t phys_addrs[copy_npages];
   struct block_data *bd = d;
   blkif_request_t *req;
   grant_ref_t gref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   unsigned reqn, size;
-  int i, nbpages, j;
+  unsigned i, nbpages, j;
 
   if (!(bd->mode & D_WRITE))
     return D_READ_ONLY;
diff --git a/xen/console.c b/xen/console.c
index 313b934..9e8db8f 100644
--- a/xen/console.c
+++ b/xen/console.c
@@ -129,14 +129,14 @@ static void hypcnintr(int unit, spl_t spl, void 
*ret_addr, void *regs) {
        simple_unlock(&inlock);
 }
 
-int hypcnread(int dev, io_req_t ior)
+int hypcnread(dev_t dev, io_req_t ior)
 {
        struct tty *tp = &hypcn_tty;
        tp->t_state |= TS_CARR_ON;
        return char_read(tp, ior);
 }
 
-int hypcnwrite(int dev, io_req_t ior)
+int hypcnwrite(dev_t dev, io_req_t ior)
 {
        return char_write(&hypcn_tty, ior);
 }
@@ -207,7 +207,7 @@ int hypcnopen(dev_t dev, int flag, io_req_t ior)
        return (char_open(dev, tp, flag, ior));
 }
 
-int hypcnclose(int dev, int flag)
+void hypcnclose(dev_t dev, int flag)
 {
        struct tty      *tp = &hypcn_tty;
        spl_t s = spltty();
@@ -215,7 +215,6 @@ int hypcnclose(int dev, int flag)
        ttyclose(tp);
        simple_unlock(&tp->t_lock);
        splx(s);
-       return 0;
 }
 
 int hypcnprobe(struct consdev *cp)
diff --git a/xen/console.h b/xen/console.h
index 061ba28..cd5fd5f 100644
--- a/xen/console.h
+++ b/xen/console.h
@@ -40,9 +40,9 @@ extern int hypcnprobe(struct consdev *cp);
 extern int hypcninit(struct consdev *cp);
 
 extern int hypcnopen(dev_t dev, int flag, io_req_t ior);
-extern int hypcnread(int dev, io_req_t ior);
-extern int hypcnwrite(int dev, io_req_t ior);
-extern int hypcnclose(int dev, int flag);
+extern int hypcnread(dev_t dev, io_req_t ior);
+extern int hypcnwrite(dev_t dev, io_req_t ior);
+extern void hypcnclose(dev_t dev, int flag);
 extern io_return_t hypcngetstat(dev_t dev, int flavor, int *data, unsigned int 
*count);
 extern io_return_t hypcnsetstat(dev_t dev, int flavor, int *data, unsigned int 
count);
 extern int hypcnportdeath(dev_t dev, mach_port_t port);
diff --git a/xen/evt.c b/xen/evt.c
index c62e1d5..2a84ef7 100644
--- a/xen/evt.c
+++ b/xen/evt.c
@@ -77,7 +77,8 @@ void hyp_c_callback(void *ret_addr, void *regs)
 
 void form_int_mask(void)
 {
-       unsigned int i, j, bit, mask;
+       unsigned int j, bit, mask;
+       int i;
 
        for (i=SPL0; i < NSPL; i++) {
                for (j=0x00, bit=0x01, mask = 0; j < NEVNT; j++, bit<<=1)
diff --git a/xen/net.c b/xen/net.c
index 7181d78..5a3f90d 100644
--- a/xen/net.c
+++ b/xen/net.c
@@ -395,7 +395,7 @@ void hyp_net_init(void) {
 
                        /* Allocate an event channel and give it to backend.  */
                        nd->evt = evt = hyp_event_channel_alloc(domid);
-                       i = sprintf(port_name, "%lu", evt);
+                       i = sprintf(port_name, "%u", evt);
                        c = hyp_store_write(t, port_name, 5, VIF_PATH, "/", 
vifs[n], "/", "event-channel");
                        if (!c)
                                panic("eth: couldn't store event channel for 
VIF %s (%s)", vifs[n], hyp_store_error);
@@ -538,7 +538,7 @@ static io_return_t
 device_open (ipc_port_t reply_port, mach_msg_type_name_t reply_port_type,
            dev_mode_t mode, char *name, device_t *devp /* out */)
 {
-       int i, n, err = 0;
+       int i, n;
        ipc_port_t port, notify;
        struct net_data *nd;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/gnumach.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]