BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / vm / vm_user.c
index 9414f4e..0457a66 100644 (file)
@@ -1,16 +1,65 @@
 /* 
 /* 
- * Copyright (c) 1985, Avadis Tevanian, Jr., Michael Wayne Young
- * Copyright (c) 1987 Carnegie-Mellon University
  * Copyright (c) 1991 Regents of the University of California.
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * The Mach Operating System project at Carnegie-Mellon University.
  *
  * Copyright (c) 1991 Regents of the University of California.
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * The Mach Operating System project at Carnegie-Mellon University.
  *
- * The CMU software License Agreement specifies the terms and conditions
- * for use and redistribution.
+ * 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.
  *
  *
- *     @(#)vm_user.c   7.1 (Berkeley) %G%
+ * 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.
+ *
+ *     @(#)vm_user.c   7.3 (Berkeley) 4/21/91
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Avadis Tevanian, Jr., Michael Wayne Young
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
  */
 
 /*
  */
 
 /*
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
-#include "user.h"
 #include "proc.h"
 
 #include "proc.h"
 
-#include "../vm/vm_param.h"
-#include "../vm/vm_object.h"
-#include "../vm/vm_map.h"
-#include "../vm/vm_page.h"
-#include "../vm/vm_statistics.h"
+#include "vm.h"
+#include "vm_page.h"
 
 
-#include "lock.h"                      /* XXX */
 simple_lock_data_t     vm_alloc_lock;  /* XXX */
 
 #ifdef MACHVMCOMPAT
 simple_lock_data_t     vm_alloc_lock;  /* XXX */
 
 #ifdef MACHVMCOMPAT
@@ -130,7 +174,7 @@ vm_allocate(map, addr, size, anywhere)
 {
        int     result;
 
 {
        int     result;
 
-       if (map == VM_MAP_NULL)
+       if (map == NULL)
                return(KERN_INVALID_ARGUMENT);
        if (size == 0) {
                *addr = 0;
                return(KERN_INVALID_ARGUMENT);
        if (size == 0) {
                *addr = 0;
@@ -143,7 +187,7 @@ vm_allocate(map, addr, size, anywhere)
                *addr = trunc_page(*addr);
        size = round_page(size);
 
                *addr = trunc_page(*addr);
        size = round_page(size);
 
-       result = vm_map_find(map, VM_OBJECT_NULL, (vm_offset_t) 0, addr,
+       result = vm_map_find(map, NULL, (vm_offset_t) 0, addr,
                        size, anywhere);
 
        return(result);
                        size, anywhere);
 
        return(result);
@@ -158,7 +202,7 @@ vm_deallocate(map, start, size)
        vm_offset_t             start;
        vm_size_t               size;
 {
        vm_offset_t             start;
        vm_size_t               size;
 {
-       if (map == VM_MAP_NULL)
+       if (map == NULL)
                return(KERN_INVALID_ARGUMENT);
 
        if (size == (vm_offset_t) 0)
                return(KERN_INVALID_ARGUMENT);
 
        if (size == (vm_offset_t) 0)
@@ -177,7 +221,7 @@ vm_inherit(map, start, size, new_inheritance)
        vm_size_t               size;
        vm_inherit_t            new_inheritance;
 {
        vm_size_t               size;
        vm_inherit_t            new_inheritance;
 {
-       if (map == VM_MAP_NULL)
+       if (map == NULL)
                return(KERN_INVALID_ARGUMENT);
 
        return(vm_map_inherit(map, trunc_page(start), round_page(start+size), new_inheritance));
                return(KERN_INVALID_ARGUMENT);
 
        return(vm_map_inherit(map, trunc_page(start), round_page(start+size), new_inheritance));
@@ -195,7 +239,7 @@ vm_protect(map, start, size, set_maximum, new_protection)
        boolean_t               set_maximum;
        vm_prot_t               new_protection;
 {
        boolean_t               set_maximum;
        vm_prot_t               new_protection;
 {
-       if (map == VM_MAP_NULL)
+       if (map == NULL)
                return(KERN_INVALID_ARGUMENT);
 
        return(vm_map_protect(map, trunc_page(start), round_page(start+size), new_protection, set_maximum));
                return(KERN_INVALID_ARGUMENT);
 
        return(vm_map_protect(map, trunc_page(start), round_page(start+size), new_protection, set_maximum));