Annotation of Gnu-Mach/vm/vm_map.h, revision 1.1.1.5

1.1       root        1: /*
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University.
                      4:  * Copyright (c) 1993,1994 The University of Utah and
                      5:  * the Computer Systems Laboratory (CSL).
                      6:  * All rights reserved.
                      7:  *
                      8:  * Permission to use, copy, modify and distribute this software and its
                      9:  * documentation is hereby granted, provided that both the copyright
                     10:  * notice and this permission notice appear in all copies of the
                     11:  * software, derivative works or modified versions, and any portions
                     12:  * thereof, and that both notices appear in supporting documentation.
                     13:  *
                     14:  * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
                     15:  * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
                     16:  * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
                     17:  * THIS SOFTWARE.
                     18:  *
                     19:  * Carnegie Mellon requests users of this software to return to
                     20:  *
                     21:  *  Software Distribution Coordinator  or  [email protected]
                     22:  *  School of Computer Science
                     23:  *  Carnegie Mellon University
                     24:  *  Pittsburgh PA 15213-3890
                     25:  *
                     26:  * any improvements or extensions that they make and grant Carnegie Mellon
                     27:  * the rights to redistribute these changes.
                     28:  */
                     29: /*
                     30:  *     File:   vm/vm_map.h
                     31:  *     Author: Avadis Tevanian, Jr., Michael Wayne Young
                     32:  *     Date:   1985
                     33:  *
                     34:  *     Virtual memory map module definitions.
                     35:  *
                     36:  * Contributors:
                     37:  *     avie, dlb, mwyoung
                     38:  */
                     39: 
                     40: #ifndef        _VM_VM_MAP_H_
                     41: #define _VM_VM_MAP_H_
                     42: 
                     43: #include <mach/kern_return.h>
                     44: #include <mach/boolean.h>
                     45: #include <mach/machine/vm_types.h>
1.1.1.3   root       46: #include <mach/vm_attributes.h>
1.1       root       47: #include <mach/vm_prot.h>
                     48: #include <mach/vm_inherit.h>
                     49: #include <vm/pmap.h>
                     50: #include <vm/vm_object.h>
                     51: #include <vm/vm_page.h>
1.1.1.3   root       52: #include <vm/vm_types.h>
1.1       root       53: #include <kern/lock.h>
1.1.1.3   root       54: #include <kern/rbtree.h>
1.1.1.5 ! root       55: #include <kern/macros.h>
1.1       root       56: 
1.1.1.3   root       57: /* TODO: make it dynamic */
1.1.1.4   root       58: #define KENTRY_DATA_SIZE (256*PAGE_SIZE)
1.1.1.3   root       59: 
1.1       root       60: /*
                     61:  *     Types defined:
                     62:  *
                     63:  *     vm_map_entry_t          an entry in an address map.
                     64:  *     vm_map_version_t        a timestamp of a map, for use with vm_map_lookup
                     65:  *     vm_map_copy_t           represents memory copied from an address map,
                     66:  *                              used for inter-map copy operations
                     67:  */
                     68: 
                     69: /*
                     70:  *     Type:           vm_map_object_t [internal use only]
                     71:  *
                     72:  *     Description:
                     73:  *             The target of an address mapping, either a virtual
                     74:  *             memory object or a sub map (of the kernel map).
                     75:  */
                     76: typedef union vm_map_object {
                     77:        struct vm_object        *vm_object;     /* object object */
                     78:        struct vm_map           *sub_map;       /* belongs to another map */
                     79: } vm_map_object_t;
                     80: 
                     81: /*
                     82:  *     Type:           vm_map_entry_t [internal use only]
                     83:  *
                     84:  *     Description:
                     85:  *             A single mapping within an address map.
                     86:  *
                     87:  *     Implementation:
                     88:  *             Address map entries consist of start and end addresses,
                     89:  *             a VM object (or sub map) and offset into that object,
                     90:  *             and user-exported inheritance and protection information.
                     91:  *             Control information for virtual copy operations is also
                     92:  *             stored in the address map entry.
                     93:  */
                     94: struct vm_map_links {
                     95:        struct vm_map_entry     *prev;          /* previous entry */
                     96:        struct vm_map_entry     *next;          /* next entry */
                     97:        vm_offset_t             start;          /* start address */
                     98:        vm_offset_t             end;            /* end address */
                     99: };
                    100: 
                    101: struct vm_map_entry {
                    102:        struct vm_map_links     links;          /* links to other entries */
                    103: #define vme_prev               links.prev
                    104: #define vme_next               links.next
                    105: #define vme_start              links.start
                    106: #define vme_end                        links.end
1.1.1.3   root      107:        struct rbtree_node      tree_node;      /* links to other entries in tree */
1.1       root      108:        union vm_map_object     object;         /* object I point to */
                    109:        vm_offset_t             offset;         /* offset into object */
                    110:        unsigned int
                    111:        /* boolean_t */         is_shared:1,    /* region is shared */
                    112:        /* boolean_t */         is_sub_map:1,   /* Is "object" a submap? */
                    113:        /* boolean_t */         in_transition:1, /* Entry being changed */
                    114:        /* boolean_t */         needs_wakeup:1,  /* Waiters on in_transition */
                    115:                /* Only used when object is a vm_object: */
                    116:        /* boolean_t */         needs_copy:1;    /* does object need to be copied */
                    117: 
                    118:                /* Only in task maps: */
                    119:        vm_prot_t               protection;     /* protection code */
                    120:        vm_prot_t               max_protection; /* maximum protection */
                    121:        vm_inherit_t            inheritance;    /* inheritance */
                    122:        unsigned short          wired_count;    /* can be paged if = 0 */
                    123:        unsigned short          user_wired_count; /* for vm_wire */
                    124:        struct vm_map_entry     *projected_on;  /* 0 for normal map entry
                    125:            or persistent kernel map projected buffer entry;
                    126:            -1 for non-persistent kernel map projected buffer entry;
                    127:            pointer to corresponding kernel map entry for user map
                    128:            projected buffer entry */
                    129: };
                    130: 
                    131: typedef struct vm_map_entry    *vm_map_entry_t;
                    132: 
                    133: #define VM_MAP_ENTRY_NULL      ((vm_map_entry_t) 0)
                    134: 
                    135: /*
                    136:  *     Type:           struct vm_map_header
                    137:  *
                    138:  *     Description:
                    139:  *             Header for a vm_map and a vm_map_copy.
                    140:  */
                    141: struct vm_map_header {
                    142:        struct vm_map_links     links;          /* first, last, min, max */
1.1.1.3   root      143:        struct rbtree           tree;           /* Sorted tree of entries */
1.1       root      144:        int                     nentries;       /* Number of entries */
                    145:        boolean_t               entries_pageable;
                    146:                                                /* are map entries pageable? */
                    147: };
                    148: 
                    149: /*
                    150:  *     Type:           vm_map_t [exported; contents invisible]
                    151:  *
                    152:  *     Description:
                    153:  *             An address map -- a directory relating valid
                    154:  *             regions of a task's address space to the corresponding
                    155:  *             virtual memory objects.
                    156:  *
                    157:  *     Implementation:
                    158:  *             Maps are doubly-linked lists of map entries, sorted
1.1.1.3   root      159:  *             by address.  They're also contained in a red-black tree.
                    160:  *             One hint is used to start searches again at the last
                    161:  *             successful search, insertion, or removal.  If the hint
                    162:  *             lookup failed (i.e. the hint didn't refer to the requested
                    163:  *             entry), a BST lookup is performed.  Another hint is used to
1.1       root      164:  *             quickly find free space.
                    165:  */
                    166: struct vm_map {
                    167:        lock_data_t             lock;           /* Lock for map data */
                    168:        struct vm_map_header    hdr;            /* Map entry header */
                    169: #define min_offset             hdr.links.start /* start of range */
                    170: #define max_offset             hdr.links.end   /* end of range */
                    171:        pmap_t                  pmap;           /* Physical map */
                    172:        vm_size_t               size;           /* virtual size */
1.1.1.5 ! root      173:        vm_size_t               user_wired;     /* wired by user size */
1.1       root      174:        int                     ref_count;      /* Reference count */
                    175:        decl_simple_lock_data(, ref_lock)       /* Lock for ref_count field */
                    176:        vm_map_entry_t          hint;           /* hint for quick lookups */
                    177:        decl_simple_lock_data(, hint_lock)      /* lock for hint storage */
                    178:        vm_map_entry_t          first_free;     /* First free space hint */
1.1.1.4   root      179: 
                    180:        /* Flags */
                    181:        unsigned int    wait_for_space:1,       /* Should callers wait
1.1       root      182:                                                   for space? */
1.1.1.4   root      183:        /* boolean_t */ wiring_required:1;      /* All memory wired? */
                    184: 
1.1       root      185:        unsigned int            timestamp;      /* Version number */
                    186: };
                    187: 
                    188: #define vm_map_to_entry(map)   ((struct vm_map_entry *) &(map)->hdr.links)
                    189: #define vm_map_first_entry(map)        ((map)->hdr.links.next)
                    190: #define vm_map_last_entry(map) ((map)->hdr.links.prev)
                    191: 
                    192: /*
                    193:  *     Type:           vm_map_version_t [exported; contents invisible]
                    194:  *
                    195:  *     Description:
                    196:  *             Map versions may be used to quickly validate a previous
                    197:  *             lookup operation.
                    198:  *
                    199:  *     Usage note:
                    200:  *             Because they are bulky objects, map versions are usually
                    201:  *             passed by reference.
                    202:  *
                    203:  *     Implementation:
                    204:  *             Just a timestamp for the main map.
                    205:  */
                    206: typedef struct vm_map_version {
                    207:        unsigned int    main_timestamp;
                    208: } vm_map_version_t;
                    209: 
                    210: /*
                    211:  *     Type:           vm_map_copy_t [exported; contents invisible]
                    212:  *
                    213:  *     Description:
                    214:  *             A map copy object represents a region of virtual memory
                    215:  *             that has been copied from an address map but is still
                    216:  *             in transit.
                    217:  *
                    218:  *             A map copy object may only be used by a single thread
                    219:  *             at a time.
                    220:  *
                    221:  *     Implementation:
1.1.1.2   root      222:  *             There are three formats for map copy objects.
1.1       root      223:  *             The first is very similar to the main
                    224:  *             address map in structure, and as a result, some
                    225:  *             of the internal maintenance functions/macros can
                    226:  *             be used with either address maps or map copy objects.
                    227:  *
                    228:  *             The map copy object contains a header links
                    229:  *             entry onto which the other entries that represent
                    230:  *             the region are chained.
                    231:  *
                    232:  *             The second format is a single vm object.  This is used
                    233:  *             primarily in the pageout path.  The third format is a
                    234:  *             list of vm pages.  An optional continuation provides
                    235:  *             a hook to be called to obtain more of the memory,
                    236:  *             or perform other operations.  The continuation takes 3
                    237:  *             arguments, a saved arg buffer, a pointer to a new vm_map_copy
                    238:  *             (returned) and an abort flag (abort if TRUE).
                    239:  */
                    240: 
                    241: #define VM_MAP_COPY_PAGE_LIST_MAX      64
                    242: 
                    243: typedef struct vm_map_copy {
                    244:        int                     type;
                    245: #define VM_MAP_COPY_ENTRY_LIST 1
                    246: #define VM_MAP_COPY_OBJECT     2
                    247: #define VM_MAP_COPY_PAGE_LIST  3
                    248:        vm_offset_t             offset;
                    249:        vm_size_t               size;
                    250:        union {
                    251:            struct vm_map_header        hdr;    /* ENTRY_LIST */
                    252:            struct {                            /* OBJECT */
                    253:                vm_object_t             object;
                    254:            } c_o;
                    255:            struct {                            /* PAGE_LIST */
                    256:                vm_page_t               page_list[VM_MAP_COPY_PAGE_LIST_MAX];
                    257:                int                     npages;
                    258:                kern_return_t           (*cont)();
                    259:                char                    *cont_args;
                    260:            } c_p;
                    261:        } c_u;
                    262: } *vm_map_copy_t;
                    263: 
                    264: #define cpy_hdr                        c_u.hdr
                    265: 
                    266: #define cpy_object             c_u.c_o.object
                    267: 
                    268: #define cpy_page_list          c_u.c_p.page_list
                    269: #define cpy_npages             c_u.c_p.npages
                    270: #define cpy_cont               c_u.c_p.cont
                    271: #define cpy_cont_args          c_u.c_p.cont_args
                    272: 
                    273: #define        VM_MAP_COPY_NULL        ((vm_map_copy_t) 0)
                    274: 
                    275: /*
                    276:  *     Useful macros for entry list copy objects
                    277:  */
                    278: 
                    279: #define vm_map_copy_to_entry(copy)             \
                    280:                ((struct vm_map_entry *) &(copy)->cpy_hdr.links)
                    281: #define vm_map_copy_first_entry(copy)          \
                    282:                ((copy)->cpy_hdr.links.next)
                    283: #define vm_map_copy_last_entry(copy)           \
                    284:                ((copy)->cpy_hdr.links.prev)
                    285: 
                    286: /*
                    287:  *     Continuation macros for page list copy objects
                    288:  */
                    289: 
                    290: #define        vm_map_copy_invoke_cont(old_copy, new_copy, result)             \
                    291: MACRO_BEGIN                                                            \
                    292:        vm_map_copy_page_discard(old_copy);                             \
                    293:        *result = (*((old_copy)->cpy_cont))((old_copy)->cpy_cont_args,  \
                    294:                                            new_copy);                  \
                    295:        (old_copy)->cpy_cont = (kern_return_t (*)()) 0;                 \
                    296: MACRO_END
                    297: 
                    298: #define        vm_map_copy_invoke_extend_cont(old_copy, new_copy, result)      \
                    299: MACRO_BEGIN                                                            \
                    300:        *result = (*((old_copy)->cpy_cont))((old_copy)->cpy_cont_args,  \
                    301:                                            new_copy);                  \
                    302:        (old_copy)->cpy_cont = (kern_return_t (*)()) 0;                 \
                    303: MACRO_END
                    304: 
                    305: #define vm_map_copy_abort_cont(old_copy)                               \
                    306: MACRO_BEGIN                                                            \
                    307:        vm_map_copy_page_discard(old_copy);                             \
                    308:        (*((old_copy)->cpy_cont))((old_copy)->cpy_cont_args,            \
                    309:                                  (vm_map_copy_t *) 0);                 \
                    310:        (old_copy)->cpy_cont = (kern_return_t (*)()) 0;                 \
                    311:        (old_copy)->cpy_cont_args = (char *) 0;                         \
                    312: MACRO_END
                    313: 
                    314: #define vm_map_copy_has_cont(copy)                                     \
                    315:     (((copy)->cpy_cont) != (kern_return_t (*)()) 0)
                    316: 
                    317: /*
                    318:  *     Continuation structures for vm_map_copyin_page_list.
                    319:  */
                    320: 
                    321: typedef        struct {
                    322:        vm_map_t        map;
                    323:        vm_offset_t     src_addr;
                    324:        vm_size_t       src_len;
                    325:        vm_offset_t     destroy_addr;
                    326:        vm_size_t       destroy_len;
                    327:        boolean_t       steal_pages;
                    328: }  vm_map_copyin_args_data_t, *vm_map_copyin_args_t;
                    329: 
                    330: #define        VM_MAP_COPYIN_ARGS_NULL ((vm_map_copyin_args_t) 0)
                    331: 
                    332: /*
                    333:  *     Macros:         vm_map_lock, etc. [internal use only]
                    334:  *     Description:
                    335:  *             Perform locking on the data portion of a map.
                    336:  */
                    337: 
                    338: #define vm_map_lock_init(map)                  \
                    339: MACRO_BEGIN                                    \
                    340:        lock_init(&(map)->lock, TRUE);          \
                    341:        (map)->timestamp = 0;                   \
                    342: MACRO_END
                    343: 
                    344: #define vm_map_lock(map)                       \
                    345: MACRO_BEGIN                                    \
                    346:        lock_write(&(map)->lock);               \
                    347:        (map)->timestamp++;                     \
                    348: MACRO_END
                    349: 
                    350: #define vm_map_unlock(map)     lock_write_done(&(map)->lock)
                    351: #define vm_map_lock_read(map)  lock_read(&(map)->lock)
                    352: #define vm_map_unlock_read(map)        lock_read_done(&(map)->lock)
                    353: #define vm_map_lock_write_to_read(map) \
                    354:                lock_write_to_read(&(map)->lock)
                    355: #define vm_map_lock_read_to_write(map) \
                    356:                (lock_read_to_write(&(map)->lock) || (((map)->timestamp++), 0))
                    357: #define vm_map_lock_set_recursive(map) \
                    358:                lock_set_recursive(&(map)->lock)
                    359: #define vm_map_lock_clear_recursive(map) \
                    360:                lock_clear_recursive(&(map)->lock)
                    361: 
                    362: /*
                    363:  *     Exported procedures that operate on vm_map_t.
                    364:  */
                    365: 
                    366: extern vm_offset_t     kentry_data;
1.1.1.3   root      367: extern vm_size_t       kentry_data_size;
1.1       root      368: extern int             kentry_count;
1.1.1.3   root      369: /* Initialize the module */
                    370: extern void            vm_map_init(void);
1.1       root      371: 
1.1.1.3   root      372: /* Initialize an empty map */
                    373: extern void            vm_map_setup(vm_map_t, pmap_t, vm_offset_t, vm_offset_t,
                    374:                                     boolean_t);
                    375: /* Create an empty map */
                    376: extern vm_map_t                vm_map_create(pmap_t, vm_offset_t, vm_offset_t,
                    377:                                      boolean_t);
                    378: /* Create a map in the image of an existing map */
                    379: extern vm_map_t                vm_map_fork(vm_map_t);
                    380: 
                    381: /* Gain a reference to an existing map */
                    382: extern void            vm_map_reference(vm_map_t);
                    383: /* Lose a reference */
                    384: extern void            vm_map_deallocate(vm_map_t);
                    385: 
                    386: /* Enter a mapping */
                    387: extern kern_return_t   vm_map_enter(vm_map_t, vm_offset_t *, vm_size_t,
                    388:                                     vm_offset_t, boolean_t, vm_object_t,
                    389:                                     vm_offset_t, boolean_t, vm_prot_t,
                    390:                                     vm_prot_t, vm_inherit_t);
                    391: /* Enter a mapping primitive */
                    392: extern kern_return_t   vm_map_find_entry(vm_map_t, vm_offset_t *, vm_size_t,
                    393:                                          vm_offset_t, vm_object_t,
                    394:                                          vm_map_entry_t *);
                    395: /* Deallocate a region */
                    396: extern kern_return_t   vm_map_remove(vm_map_t, vm_offset_t, vm_offset_t);
                    397: /* Change protection */
                    398: extern kern_return_t   vm_map_protect(vm_map_t, vm_offset_t, vm_offset_t,
                    399:                                       vm_prot_t, boolean_t);
                    400: /* Change inheritance */
                    401: extern kern_return_t   vm_map_inherit(vm_map_t, vm_offset_t, vm_offset_t,
                    402:                                       vm_inherit_t);
                    403: 
                    404: /* Look up an address */
                    405: extern kern_return_t   vm_map_lookup(vm_map_t *, vm_offset_t, vm_prot_t,
                    406:                                      vm_map_version_t *, vm_object_t *,
                    407:                                      vm_offset_t *, vm_prot_t *, boolean_t *);
                    408: /* Find a map entry */
                    409: extern boolean_t       vm_map_lookup_entry(vm_map_t, vm_offset_t,
                    410:                                            vm_map_entry_t *);
                    411: /* Verify that a previous lookup is still valid */
                    412: extern boolean_t       vm_map_verify(vm_map_t, vm_map_version_t *);
1.1       root      413: /* vm_map_verify_done is now a macro -- see below */
1.1.1.3   root      414: /* Make a copy of a region */
                    415: extern kern_return_t   vm_map_copyin(vm_map_t, vm_offset_t, vm_size_t,
                    416:                                      boolean_t, vm_map_copy_t *);
                    417: /* Make a copy of a region using a page list copy */
                    418: extern kern_return_t   vm_map_copyin_page_list(vm_map_t, vm_offset_t,
                    419:                                                vm_size_t, boolean_t,
                    420:                                                boolean_t, vm_map_copy_t *,
                    421:                                                boolean_t);
                    422: /* Place a copy into a map */
                    423: extern kern_return_t   vm_map_copyout(vm_map_t, vm_offset_t *, vm_map_copy_t);
                    424: /* Overwrite existing memory with a copy */
                    425: extern kern_return_t   vm_map_copy_overwrite(vm_map_t, vm_offset_t,
                    426:                                              vm_map_copy_t, boolean_t);
                    427: /* Discard a copy without using it */
                    428: extern void            vm_map_copy_discard(vm_map_copy_t);
                    429: extern void            vm_map_copy_page_discard(vm_map_copy_t);
                    430: extern vm_map_copy_t   vm_map_copy_copy(vm_map_copy_t);
                    431: /* Page list continuation version of previous */
                    432: extern kern_return_t   vm_map_copy_discard_cont(vm_map_copyin_args_t,
                    433:                                                 vm_map_copy_t *);
                    434: 
                    435: /* Add or remove machine- dependent attributes from map regions */
                    436: extern kern_return_t   vm_map_machine_attribute(vm_map_t, vm_offset_t,
                    437:                                                 vm_size_t,
                    438:                                                 vm_machine_attribute_t,
                    439:                                                 vm_machine_attribute_val_t *);
                    440: 
                    441: /* Delete entry from map */
                    442: extern void            vm_map_entry_delete(vm_map_t, vm_map_entry_t);
1.1       root      443: 
1.1.1.4   root      444: kern_return_t vm_map_delete(
                    445:     vm_map_t           map,
                    446:     vm_offset_t        start,
                    447:     vm_offset_t        end);
                    448: 
                    449: kern_return_t vm_map_copyout_page_list(
                    450:     vm_map_t           dst_map,
                    451:     vm_offset_t        *dst_addr,  /* OUT */
                    452:     vm_map_copy_t      copy);
                    453: 
                    454: void vm_map_copy_page_discard (vm_map_copy_t copy);
                    455: 
                    456: boolean_t vm_map_lookup_entry(
                    457:        vm_map_t        map,
                    458:        vm_offset_t     address,
                    459:        vm_map_entry_t  *entry); /* OUT */
                    460: 
1.1       root      461: /*
                    462:  *     Functions implemented as macros
                    463:  */
                    464: #define                vm_map_min(map)         ((map)->min_offset)
                    465:                                                /* Lowest valid address in
                    466:                                                 * a map */
                    467: 
                    468: #define                vm_map_max(map)         ((map)->max_offset)
                    469:                                                /* Highest valid address */
                    470: 
                    471: #define                vm_map_pmap(map)        ((map)->pmap)
                    472:                                                /* Physical map associated
                    473:                                                 * with this address map */
                    474: 
                    475: #define                vm_map_verify_done(map, version)    (vm_map_unlock_read(map))
                    476:                                                /* Operation that required
                    477:                                                 * a verified lookup is
                    478:                                                 * now complete */
                    479: /*
                    480:  *     Pageability functions.  Includes macro to preserve old interface.
                    481:  */
1.1.1.3   root      482: extern kern_return_t   vm_map_pageable_common(vm_map_t, vm_offset_t,
                    483:                                               vm_offset_t, vm_prot_t,
                    484:                                               boolean_t);
1.1       root      485: 
                    486: #define vm_map_pageable(map, s, e, access)     \
                    487:                vm_map_pageable_common(map, s, e, access, FALSE)
                    488: 
                    489: #define vm_map_pageable_user(map, s, e, access)        \
                    490:                vm_map_pageable_common(map, s, e, access, TRUE)
                    491: 
                    492: /*
                    493:  *     Submap object.  Must be used to create memory to be put
                    494:  *     in a submap by vm_map_submap.
                    495:  */
                    496: extern vm_object_t     vm_submap_object;
                    497: 
                    498: /*
1.1.1.3   root      499:  *  vm_map_copyin_object:
                    500:  *
                    501:  *  Create a copy object from an object.
                    502:  *  Our caller donates an object reference.
                    503:  */
                    504: extern kern_return_t vm_map_copyin_object(
                    505:     vm_object_t object,
                    506:     vm_offset_t offset,     /* offset of region in object */
                    507:     vm_size_t   size,       /* size of region in object */
                    508:     vm_map_copy_t   *copy_result);   /* OUT */
                    509: 
                    510: /*
                    511:  *  vm_map_submap:      [ kernel use only ]
                    512:  *
                    513:  *  Mark the given range as handled by a subordinate map.
                    514:  *
                    515:  *  This range must have been created with vm_map_find using
                    516:  *  the vm_submap_object, and no other operations may have been
                    517:  *  performed on this range prior to calling vm_map_submap.
                    518:  *
                    519:  *  Only a limited number of operations can be performed
                    520:  *  within this rage after calling vm_map_submap:
                    521:  *      vm_fault
                    522:  *  [Don't try vm_map_copyin!]
                    523:  *
                    524:  *  To remove a submapping, one must first remove the
                    525:  *  range from the superior map, and then destroy the
                    526:  *  submap (if desired).  [Better yet, don't try it.]
                    527:  */
                    528: extern kern_return_t vm_map_submap(
                    529:     vm_map_t   map,
                    530:     vm_offset_t    start,
                    531:     vm_offset_t    end,
                    532:     vm_map_t        submap);
                    533: 
                    534: /*
1.1       root      535:  *     Wait and wakeup macros for in_transition map entries.
                    536:  */
                    537: #define vm_map_entry_wait(map, interruptible)          \
                    538:         MACRO_BEGIN                                     \
                    539:         assert_wait((event_t)&(map)->hdr, interruptible);      \
                    540:         vm_map_unlock(map);                             \
                    541:        thread_block((void (*)()) 0);                   \
                    542:         MACRO_END
                    543: 
                    544: #define vm_map_entry_wakeup(map)        thread_wakeup((event_t)&(map)->hdr)
                    545: 
1.1.1.3   root      546: /*
                    547:  *      This routine is called only when it is known that
                    548:  *      the entry must be split.
                    549:  */
                    550: extern void _vm_map_clip_start(
                    551:         struct vm_map_header *map_header,
                    552:         vm_map_entry_t entry,
                    553:         vm_offset_t start);
                    554: 
                    555: /*
                    556:  *      vm_map_clip_end:        [ internal use only ]
                    557:  *
                    558:  *      Asserts that the given entry ends at or before
                    559:  *      the specified address; if necessary,
                    560:  *      it splits the entry into two.
                    561:  */
1.1.1.4   root      562: void _vm_map_clip_end(
                    563:        struct vm_map_header    *map_header,
                    564:        vm_map_entry_t          entry,
                    565:        vm_offset_t             end);
1.1.1.3   root      566: 
1.1.1.2   root      567: #endif /* _VM_VM_MAP_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.