Annotation of XNU/osfmk/mach/vm_task.defs, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:  * @OSF_FREE_COPYRIGHT@
                     24:  */
                     25: /* 
                     26:  * Mach Operating System
                     27:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
                     28:  * All Rights Reserved.
                     29:  * 
                     30:  * Permission to use, copy, modify and distribute this software and its
                     31:  * documentation is hereby granted, provided that both the copyright
                     32:  * notice and this permission notice appear in all copies of the
                     33:  * software, derivative works or modified versions, and any portions
                     34:  * thereof, and that both notices appear in supporting documentation.
                     35:  * 
                     36:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     37:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     38:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     39:  * 
                     40:  * Carnegie Mellon requests users of this software to return to
                     41:  * 
                     42:  *  Software Distribution Coordinator  or  [email protected]
                     43:  *  School of Computer Science
                     44:  *  Carnegie Mellon University
                     45:  *  Pittsburgh PA 15213-3890
                     46:  * 
                     47:  * any improvements or extensions that they make and grant Carnegie Mellon
                     48:  * the rights to redistribute these changes.
                     49:  */
                     50: /*
                     51:  */
                     52: /*
                     53:  *     File:   mach/mach_port.defs
                     54:  *     Author: Rich Draves
                     55:  *
                     56:  *     Exported kernel calls.
                     57:  */
                     58: 
                     59: subsystem
                     60: #if    KERNEL_SERVER
                     61:          KernelServer
                     62: #endif KERNEL_SERVER
                     63:          vm_task 3800;
                     64: 
                     65: #include <mach/std_types.defs>
                     66: #include <mach/mach_types.defs>
                     67: #include <mach_debug/mach_debug_types.defs>
                     68: 
                     69: /*
                     70:  *      Returns information about the contents of the virtual
                     71:  *      address space of the target task at the specified
                     72:  *      address.  The returned protection, inheritance, sharing
                     73:  *      and memory object values apply to the entire range described
                     74:  *      by the address range returned; the memory object offset
                     75:  *      corresponds to the beginning of the address range.
                     76:  *      [If the specified address is not allocated, the next
                     77:  *      highest address range is described.  If no addresses beyond
                     78:  *      the one specified are allocated, the call returns KERN_NO_SPACE.]
                     79:  */
                     80: routine vm_region(
                     81:                 target_task     : vm_map_t;
                     82:        inout   address         : vm_address_t;
                     83:         out     size            : vm_size_t;
                     84:                flavor          : vm_region_flavor_t;
                     85:        out     info            : vm_region_info_t, CountInOut;
                     86:         out     object_name     : memory_object_name_t =
                     87:                                         MACH_MSG_TYPE_MOVE_SEND
                     88:                                         ctype: mach_port_t);
                     89: 
                     90: /*
                     91:  *     Allocate zero-filled memory in the address space
                     92:  *     of the target task, either at the specified address,
                     93:  *     or wherever space can be found (if anywhere is TRUE),
                     94:  *     of the specified size.  The address at which the
                     95:  *     allocation actually took place is returned.
                     96:  */
                     97: routine vm_allocate(
                     98:                target_task     : vm_task_entry_t;
                     99:        inout   address         : vm_address_t;
                    100:                size            : vm_size_t;
                    101:                flags           : int);
                    102: 
                    103: /*
                    104:  *     Deallocate the specified range from the virtual
                    105:  *     address space of the target task.
                    106:  */
                    107: routine vm_deallocate(
                    108:                target_task     : vm_task_entry_t;
                    109:                address         : vm_address_t;
                    110:                size            : vm_size_t);
                    111: 
                    112: /*
                    113:  *     Set the current or maximum protection attribute
                    114:  *     for the specified range of the virtual address
                    115:  *     space of the target task.  The current protection
                    116:  *     limits the memory access rights of threads within
                    117:  *     the task; the maximum protection limits the accesses
                    118:  *     that may be given in the current protection.
                    119:  *     Protections are specified as a set of {read, write, execute}
                    120:  *     *permissions*.
                    121:  */
                    122: routine vm_protect(
                    123:                target_task     : vm_task_entry_t;
                    124:                address         : vm_address_t;
                    125:                size            : vm_size_t;
                    126:                set_maximum     : boolean_t;
                    127:                new_protection  : vm_prot_t);
                    128: 
                    129: /*
                    130:  *     Set the inheritance attribute for the specified range
                    131:  *     of the virtual address space of the target task.
                    132:  *     The inheritance value is one of {none, copy, share}, and
                    133:  *     specifies how the child address space should acquire
                    134:  *     this memory at the time of a task_create call.
                    135:  */
                    136: routine vm_inherit(
                    137:                target_task     : vm_task_entry_t;
                    138:                address         : vm_address_t;
                    139:                size            : vm_size_t;
                    140:                new_inheritance : vm_inherit_t);
                    141: 
                    142: /*
                    143:  *     Returns the contents of the specified range of the
                    144:  *     virtual address space of the target task.  [The
                    145:  *     range must be aligned on a virtual page boundary,
                    146:  *     and must be a multiple of pages in extent.  The
                    147:  *     protection on the specified range must permit reading.]
                    148:  */
                    149: routine vm_read(
                    150:                target_task     : vm_map_t;
                    151:                address         : vm_address_t;
                    152:                size            : vm_size_t;
                    153:        out     data            : pointer_t);
                    154: 
                    155: /* 
                    156:  * List corrollary to vm_read, returns mapped contents of specified
                    157:  * ranges within target address space.
                    158:  */
                    159: routine vm_read_list(
                    160:                target_task     : vm_map_t;
                    161:        inout   data_list       : vm_read_entry_t;
                    162:                count           : natural_t);
                    163: 
                    164: /*
                    165:  *     Writes the contents of the specified range of the
                    166:  *     virtual address space of the target task.  [The
                    167:  *     range must be aligned on a virtual page boundary,
                    168:  *     and must be a multiple of pages in extent.  The
                    169:  *     protection on the specified range must permit writing.]
                    170:  */
                    171: routine vm_write(
                    172:                target_task     : vm_map_t;
                    173:                address         : vm_address_t;
                    174:                data            : pointer_t);
                    175: 
                    176: /*
                    177:  *     Copy the contents of the source range of the virtual
                    178:  *     address space of the target task to the destination
                    179:  *     range in that same address space.  [Both of the
                    180:  *     ranges must be aligned on a virtual page boundary,
                    181:  *     and must be multiples of pages in extent.  The
                    182:  *     protection on the source range must permit reading,
                    183:  *     and the protection on the destination range must
                    184:  *     permit writing.]
                    185:  */
                    186: routine vm_copy(
                    187:                target_task     : vm_map_t;
                    188:                source_address  : vm_address_t;
                    189:                size            : vm_size_t;
                    190:                dest_address    : vm_address_t);
                    191: 
                    192: /*
                    193:  *     Returns the contents of the specified range of the
                    194:  *     virtual address space of the target task.  [There
                    195:  *     are no alignment restrictions, and the results will
                    196:  *      overwrite the area pointed to by data - which must
                    197:  *      already exist. The protection on the specified range
                    198:  *     must permit reading.]
                    199:  */
                    200: routine vm_read_overwrite(
                    201:                target_task     : vm_map_t;
                    202:                address         : vm_address_t;
                    203:                size            : vm_size_t;
                    204:                data            : vm_address_t;
                    205:        out     outsize         : vm_size_t);
                    206: 
                    207: 
                    208: routine vm_msync(
                    209:                target_task     : vm_map_t;
                    210:                address         : vm_address_t;
                    211:                size            : vm_size_t;
                    212:                sync_flags      : vm_sync_t );
                    213: 
                    214: /*
                    215:  *     Set the paging behavior attribute for the specified range
                    216:  *     of the virtual address space of the target task.
                    217:  *     The behavior value is one of {default, random, forward 
                    218:  *     sequential, reverse sequential} and indicates the expected
                    219:  *     page reference pattern for the specified range.
                    220:  */
                    221: routine vm_behavior_set(
                    222:                target_task     : vm_map_t;
                    223:                address         : vm_address_t;
                    224:                size            : vm_size_t;
                    225:                new_behavior    : vm_behavior_t);
                    226: 
                    227: 
                    228: /*
                    229:  *     Map a user-defined memory object into the virtual address
                    230:  *     space of the target task.  If desired (anywhere is TRUE),
                    231:  *     the kernel will find a suitable address range of the
                    232:  *     specified size; else, the specific address will be allocated.
                    233:  *
                    234:  *     The beginning address of the range will be aligned on a virtual
                    235:  *     page boundary, be at or beyond the address specified, and
                    236:  *     meet the mask requirements (bits turned on in the mask must not
                    237:  *     be turned on in the result); the size of the range, in bytes,
                    238:  *     will be rounded up to an integral number of virtual pages.
                    239:  *
                    240:  *     The memory in the resulting range will be associated with the
                    241:  *     specified memory object, with the beginning of the memory range
                    242:  *     referring to the specified offset into the memory object.
                    243:  *
                    244:  *     The mapping will take the current and maximum protections and
                    245:  *     the inheritance attributes specified; see the vm_protect and
                    246:  *     vm_inherit calls for a description of these attributes.
                    247:  *
                    248:  *     If desired (copy is TRUE), the memory range will be filled
                    249:  *     with a copy of the data from the memory object; this copy will
                    250:  *     be private to this mapping in this target task.  Otherwise,
                    251:  *     the memory in this mapping will be shared with other mappings
                    252:  *     of the same memory object at the same offset (in this task or
                    253:  *     in other tasks).  [The Mach kernel only enforces shared memory
                    254:  *     consistency among mappings on one host with similar page alignments.
                    255:  *     The user-defined memory manager for this object is responsible
                    256:  *     for further consistency.]
                    257:  */
                    258: routine vm_map(
                    259:                target_task     : vm_task_entry_t;
                    260:        inout   address         : vm_address_t;
                    261:                size            : vm_size_t;
                    262:                mask            : vm_address_t;
                    263:                flags           : int;
                    264:                memory_object   : memory_object_t;
                    265:                offset          : vm_offset_t;
                    266:                copy            : boolean_t;
                    267:                cur_protection  : vm_prot_t;
                    268:                max_protection  : vm_prot_t;
                    269:                inheritance     : vm_inherit_t);
                    270: 
                    271: /*
                    272:  *     Set/Get special properties of memory associated
                    273:  *     to some virtual address range, such as cachability, 
                    274:  *     migrability, replicability.  Machine-dependent.
                    275:  */
                    276: routine vm_machine_attribute(
                    277:                target_task     : vm_map_t;
                    278:                address         : vm_address_t;
                    279:                size            : vm_size_t;
                    280:                attribute       : vm_machine_attribute_t;
                    281:        inout   value           : vm_machine_attribute_val_t);
                    282: 
                    283: /*
                    284:  *      Map portion of a task's address space.
                    285:  */
                    286: routine vm_remap(
                    287:                target_task     : vm_map_t;
                    288:        inout   target_address  : vm_address_t;
                    289:                size            : vm_size_t;
                    290:                mask            : vm_address_t;
                    291:                anywhere        : boolean_t;
                    292:                src_task        : vm_map_t;
                    293:                src_address     : vm_address_t;
                    294:                copy            : boolean_t;
                    295:        out     cur_protection  : vm_prot_t;
                    296:        out     max_protection  : vm_prot_t;
                    297:                inheritance     : vm_inherit_t);
                    298: 
                    299: /*
                    300:  *     Require that all future virtual memory allocation
                    301:  *     allocates wired memory.  Setting must_wire to FALSE
                    302:  *     disables the wired future feature.
                    303:  */
                    304: routine task_wire(
                    305:                target_task     : vm_map_t;
                    306:                must_wire       : boolean_t);
                    307: 
                    308:        
                    309: /*
                    310:  *     Allow application level processes to create named entries which
                    311:  *     correspond to mapped portions of their address space.  These named
                    312:  *     entries can then be manipulated, shared with other processes in
                    313:  *     other address spaces and ultimately mapped in ohter address spaces
                    314:  */
                    315: 
                    316: routine mach_make_memory_entry(
                    317:                target_task     :vm_map_t;
                    318:        inout   size            :vm_size_t;
                    319:                offset          :vm_offset_t;
                    320:                permission      :vm_prot_t;
                    321:        out     object_handle   :mach_port_move_send_t;
                    322:                parent_entry    :mem_entry_name_port_t);
                    323: 
                    324: /*
                    325:  *      Give the caller information on the given location in a virtual
                    326:  *      address space.  If a page is mapped return ref and dirty info.
                    327:  */
                    328: routine vm_map_page_query(
                    329:                 target_map      :vm_map_t;
                    330:                 offset          :vm_offset_t;
                    331:         out     disposition     :integer_t;
                    332:         out     ref_count       :integer_t);
                    333: 
                    334: /*
                    335:  *     Returns information about a region of memory.
                    336:  *     Includes info about the chain of objects rooted at that region.
                    337:  *      Only available in MACH_VM_DEBUG compiled kernels,
                    338:  *      otherwise returns KERN_FAILURE.
                    339:  */
                    340: routine mach_vm_region_info(
                    341:                task            : vm_map_t;
                    342:                address         : vm_address_t;
                    343:        out     region          : vm_info_region_t;
                    344:        out     objects         : vm_info_object_array_t);
                    345: 
                    346: routine        vm_mapped_pages_info(
                    347:                task            : vm_map_t;
                    348:        out     pages           : page_address_array_t);
                    349: 
                    350: /*
                    351:  *    Allow application level processes to create named entries which
                    352:  *    are backed by sub-maps which describe regions of address space.
                    353:  *    These regions of space can have objects mapped into them and
                    354:  *    in turn, can be mapped into target address spaces 
                    355:  */
                    356: 
                    357: 
                    358: routine        vm_region_object_create(
                    359:                target_task     :vm_map_t;
                    360:        in      size            :vm_size_t;
                    361:        out     region_object   :mach_port_move_send_t);

unix.superglobalmegacorp.com

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