4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / sys / vm / vm_map.h
index 5e552b2..1272d72 100644 (file)
@@ -1,16 +1,39 @@
 /* 
 /* 
- * 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.
+ * Copyright (c) 1991, 1993
+ *     The 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.
  *
  *
  * 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.
+ * %sccs.include.redist.c%
+ *
+ *     @(#)vm_map.h    8.1 (Berkeley) %G%
+ *
+ *
+ * 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
  *
  *
- *     @(#)vm_map.h    7.1 (Berkeley) %G%
+ *  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.
  */
 
 /*
  */
 
 /*
 #ifndef        _VM_MAP_
 #define        _VM_MAP_
 
 #ifndef        _VM_MAP_
 #define        _VM_MAP_
 
-#ifdef KERNEL
-#include "types.h"
-#include "lock.h"
-#include "../vm/pmap.h"
-#include "../vm/vm_prot.h"
-#include "../vm/vm_inherit.h"
-#include "../vm/vm_object.h"
-#else
-#include <sys/types.h>
-#include <sys/lock.h>
-#include <vm/pmap.h>
-#include <vm/vm_prot.h>
-#include <vm/vm_inherit.h>
-#include <vm/vm_object.h>
-#endif
-
 /*
  *     Types defined:
  *
 /*
  *     Types defined:
  *
@@ -56,8 +63,6 @@ union vm_map_object {
        struct vm_map           *sub_map;       /* belongs to another map */
 };
 
        struct vm_map           *sub_map;       /* belongs to another map */
 };
 
-typedef union vm_map_object    vm_map_object_t;
-
 /*
  *     Address map entries consist of start and end addresses,
  *     a VM object (or sharing map) and offset into that object,
 /*
  *     Address map entries consist of start and end addresses,
  *     a VM object (or sharing map) and offset into that object,
@@ -83,10 +88,6 @@ struct vm_map_entry {
        int                     wired_count;    /* can be paged if = 0 */
 };
 
        int                     wired_count;    /* can be paged if = 0 */
 };
 
-typedef struct vm_map_entry    *vm_map_entry_t;
-
-#define        VM_MAP_ENTRY_NULL       ((vm_map_entry_t) 0)
-
 /*
  *     Maps are doubly-linked lists of map entries, kept sorted
  *     by address.  A single hint is provided to start
 /*
  *     Maps are doubly-linked lists of map entries, kept sorted
  *     by address.  A single hint is provided to start
@@ -94,10 +95,10 @@ typedef struct vm_map_entry *vm_map_entry_t;
  *     insertion, or removal.
  */
 struct vm_map {
  *     insertion, or removal.
  */
 struct vm_map {
+       struct pmap *           pmap;           /* Physical map */
        lock_data_t             lock;           /* Lock for map data */
        struct vm_map_entry     header;         /* List of entries */
        int                     nentries;       /* Number of entries */
        lock_data_t             lock;           /* Lock for map data */
        struct vm_map_entry     header;         /* List of entries */
        int                     nentries;       /* Number of entries */
-       pmap_t                  pmap;           /* Physical map */
        vm_size_t               size;           /* virtual size */
        boolean_t               is_main_map;    /* Am I a main map? */
        int                     ref_count;      /* Reference count */
        vm_size_t               size;           /* virtual size */
        boolean_t               is_main_map;    /* Am I a main map? */
        int                     ref_count;      /* Reference count */
@@ -111,10 +112,6 @@ struct vm_map {
 #define max_offset             header.end
 };
 
 #define max_offset             header.end
 };
 
-typedef        struct vm_map   *vm_map_t;
-
-#define                VM_MAP_NULL     ((vm_map_t) 0)
-
 /*
  *     Map versions are used to validate a previous lookup attempt.
  *
 /*
  *     Map versions are used to validate a previous lookup attempt.
  *
@@ -136,31 +133,13 @@ typedef struct {
  *             Perform locking on the data portion of a map.
  */
 
  *             Perform locking on the data portion of a map.
  */
 
-#define                vm_map_lock(map)        { lock_write(&(map)->lock); (map)->timestamp++; }
-#define                vm_map_unlock(map)      lock_write_done(&(map)->lock)
-#define                vm_map_lock_read(map)   lock_read(&(map)->lock)
-#define                vm_map_unlock_read(map) lock_read_done(&(map)->lock)
-
-/*
- *     Exported procedures that operate on vm_map_t.
- */
-
-void           vm_map_init();
-vm_map_t       vm_map_create();
-void           vm_map_deallocate();
-void           vm_map_reference();
-int            vm_map_find();
-int            vm_map_remove();
-int            vm_map_lookup();
-void           vm_map_lookup_done();
-int            vm_map_protect();
-int            vm_map_inherit();
-int            vm_map_copy();
-vm_map_t       vm_map_fork();
-void           vm_map_print();
-void           vm_map_copy_entry();
-boolean_t      vm_map_verify();
-void           vm_map_verify_done();
+#define        vm_map_lock(map) { \
+       lock_write(&(map)->lock); \
+       (map)->timestamp++; \
+}
+#define        vm_map_unlock(map)      lock_write_done(&(map)->lock)
+#define        vm_map_lock_read(map)   lock_read(&(map)->lock)
+#define        vm_map_unlock_read(map) lock_read_done(&(map)->lock)
 
 /*
  *     Functions implemented as macros
 
 /*
  *     Functions implemented as macros
@@ -173,4 +152,51 @@ void               vm_map_verify_done();
 #define MAX_KMAP       10
 #define        MAX_KMAPENT     500
 
 #define MAX_KMAP       10
 #define        MAX_KMAPENT     500
 
-#endif _VM_MAP_
+#ifdef KERNEL
+boolean_t       vm_map_check_protection __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, vm_prot_t));
+int             vm_map_copy __P((vm_map_t, vm_map_t, vm_offset_t,
+                   vm_size_t, vm_offset_t, boolean_t, boolean_t));
+void            vm_map_copy_entry __P((vm_map_t,
+                   vm_map_t, vm_map_entry_t, vm_map_entry_t));
+struct pmap;
+vm_map_t        vm_map_create __P((struct pmap *,
+                   vm_offset_t, vm_offset_t, boolean_t));
+void            vm_map_deallocate __P((vm_map_t));
+int             vm_map_delete __P((vm_map_t, vm_offset_t, vm_offset_t));
+vm_map_entry_t  vm_map_entry_create __P((vm_map_t));
+void            vm_map_entry_delete __P((vm_map_t, vm_map_entry_t));
+void            vm_map_entry_dispose __P((vm_map_t, vm_map_entry_t));
+void            vm_map_entry_unwire __P((vm_map_t, vm_map_entry_t));
+int             vm_map_find __P((vm_map_t, vm_object_t,
+                   vm_offset_t, vm_offset_t *, vm_size_t, boolean_t));
+int             vm_map_findspace __P((vm_map_t,
+                   vm_offset_t, vm_size_t, vm_offset_t *));
+int             vm_map_inherit __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, vm_inherit_t));
+void            vm_map_init __P((struct vm_map *,
+                   vm_offset_t, vm_offset_t, boolean_t));
+int             vm_map_insert __P((vm_map_t,
+                   vm_object_t, vm_offset_t, vm_offset_t, vm_offset_t));
+boolean_t       vm_map_is_allocated __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, boolean_t));
+int             vm_map_lookup __P((vm_map_t *, vm_offset_t, vm_prot_t,
+                   vm_map_entry_t *, vm_object_t *, vm_offset_t *, vm_prot_t *,
+                   boolean_t *, boolean_t *));
+void            vm_map_lookup_done __P((vm_map_t, vm_map_entry_t));
+boolean_t       vm_map_lookup_entry __P((vm_map_t,
+                   vm_offset_t, vm_map_entry_t *));
+int             vm_map_pageable __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, boolean_t));
+void            vm_map_print __P((vm_map_t, boolean_t));
+int             vm_map_protect __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, vm_prot_t, boolean_t));
+void            vm_map_reference __P((vm_map_t));
+int             vm_map_remove __P((vm_map_t, vm_offset_t, vm_offset_t));
+void            vm_map_simplify __P((vm_map_t, vm_offset_t));
+void            vm_map_simplify_entry __P((vm_map_t, vm_map_entry_t));
+void            vm_map_startup __P((void));
+int             vm_map_submap __P((vm_map_t,
+                   vm_offset_t, vm_offset_t, vm_map_t));
+#endif
+#endif /* _VM_MAP_ */