Annotation of kernel/mach/memory_object.defs, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* 
                     26:  * Mach Operating System
                     27:  * Copyright (c) 1991,1990,1989,1988,1987 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:  * HISTORY
                     52:  * $Log: memory_object.defs,v $
1.1.1.2 ! root       53:  * Revision 1.3  1999/07/22 20:04:01  wsanchez
        !            54:  * Update APSL
        !            55:  *
        !            56:  * Revision 1.2  1999/03/25 09:19:42  wsanchez
        !            57:  * Merge kernel-copyrights.
        !            58:  * Undelete drvAdaptecU2SCSI.
        !            59:  *
1.1       root       60:  * Revision 1.1.1.1.666.4  1999/03/16 17:05:40  wsanchez
                     61:  * Substitute License
                     62:  *
                     63:  * Revision 1.1.1.1.666.3  1999/03/16 15:28:03  wsanchez
                     64:  * Substitute copyright
                     65:  *
                     66:  * Revision 1.1.1.1.666.2  1999/03/16 10:37:39  umeshv
                     67:  * Fixed errors in previous commit.
                     68:  *
                     69:  * Revision 1.1.1.1.666.1  1999/03/11 09:52:50  umeshv
                     70:  * Added copyrights.
                     71:  *
                     72:  * Revision 1.1.1.1  1997/09/30 02:44:51  wsanchez
                     73:  * Import of kernel from umeshv/kernel
                     74:  *
                     75:  * Revision 2.9  91/08/28  11:15:19  jsb
                     76:  *     Added conditionalized sequence number support.
                     77:  *     [91/08/13            rpd]
                     78:  *     Fixed memory_object_supply_completed and memory_object_data_return
                     79:  *     to use mach_port_t as the C type name for port arguments.
                     80:  *     [91/08/02            rpd]
                     81:  *     Update types in new memory object routines.  Add
                     82:  *     memory_object_change_completed.
                     83:  *     [91/07/03  14:05:39  dlb]
                     84:  * 
                     85:  * Revision 2.8  91/07/01  08:25:16  jsb
                     86:  *     From David Black at OSF: added memory_object_supply_completed
                     87:  *     and memory_object_data_return.
                     88:  *     [91/06/29  14:54:47  jsb]
                     89:  * 
                     90:  * Revision 2.7  91/06/25  10:30:30  rpd
                     91:  *     Changed the port-based type declarations
                     92:  *     to use mach_port_t as the C type name.
                     93:  *     [91/05/23            rpd]
                     94:  * 
                     95:  * Revision 2.6  91/06/17  15:47:26  jsb
                     96:  *     If KERNEL and NORMA_VM, then use a userprefix (to allow interposition).
                     97:  *     [91/06/17  10:55:06  jsb]
                     98:  * 
                     99:  * Revision 2.5  91/05/14  16:55:36  mrt
                    100:  *     Correcting copyright
                    101:  * 
                    102:  * Revision 2.4  91/02/05  17:33:53  mrt
                    103:  *     Changed to new Mach copyright
                    104:  *     [91/02/01  17:19:02  mrt]
                    105:  * 
                    106:  * Revision 2.3  90/08/06  17:06:11  rpd
                    107:  *     For compatibility with Mach 2.5, added dealloc to
                    108:  *     arguments of memory_object_terminate and memory_object_copy.
                    109:  *     [90/08/04            rpd]
                    110:  * 
                    111:  * Revision 2.2  90/06/02  14:58:51  rpd
                    112:  *     Changed memory_object argument to memory_object_lock_completed
                    113:  *     to default to a send-once right but still allow send rights.
                    114:  *     [90/05/31            rpd]
                    115:  * 
                    116:  *     Converted to new IPC.
                    117:  *     [90/03/26  22:35:02  rpd]
                    118:  * 
                    119:  * Revision 2.1  89/08/03  17:18:02  rwd
                    120:  * Created.
                    121:  * 
                    122:  * Revision 2.3  89/02/25  18:38:17  gm0w
                    123:  *     Changes for cleanup.
                    124:  * 
                    125:  * Revision 2.2  89/01/15  16:31:06  rpd
                    126:  *     Moved from kern/ to mach/.
                    127:  *     [89/01/15  14:40:04  rpd]
                    128:  * 
                    129:  * Revision 2.6  89/01/12  07:58:12  rpd
                    130:  *     Fixed includes.
                    131:  *     [89/01/12  04:52:21  rpd]
                    132:  * 
                    133:  * Revision 2.5  88/12/19  02:46:15  mwyoung
                    134:  *     Change argument to memory_object_init to avoid lint in the MiG
                    135:  *     output.
                    136:  *     [88/12/18            mwyoung]
                    137:  *     
                    138:  *     Add memory_object_copy.
                    139:  *     [88/11/07            mwyoung]
                    140:  * 
                    141:  * Revision 2.4  88/08/25  18:16:54  mwyoung
                    142:  *     Add memory_object_terminate.
                    143:  *     [88/08/11  18:46:46  mwyoung]
                    144:  * 
                    145:  * 29-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
                    146:  *     Use new types.
                    147:  *
                    148:  * 29-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
                    149:  *     Moved data type declarations to "mach_types.defs".
                    150:  *
                    151:  *  9-Dec-87  Michael Young (mwyoung) at Carnegie-Mellon University
                    152:  *     Split that part of the interface applicable only to default
                    153:  *     pagers into a separate interface definition.
                    154:  *
                    155:  *     Documented the interface.
                    156:  *     
                    157:  *     Purged history.  Contributors so far: jle, mwyoung, bolosky.
                    158:  *
                    159:  */
                    160: /*
                    161:  * File:       mach/memory_object.defs
                    162:  *
                    163:  * Abstract:
                    164:  *     Basic Mach external memory management interface declaration.
                    165:  */
                    166: 
                    167: subsystem
                    168: #if    KERNEL_USER
                    169:          KernelUser
                    170: #endif KERNEL_USER
                    171: #if    KERNEL_SERVER
                    172:          KernelServer
                    173: #endif KERNEL_SERVER
                    174:                     memory_object 2200;
                    175: 
                    176: #include <mach/std_types.defs>
                    177: #include <mach/mach_types.defs>
                    178: 
                    179: #if    SEQNOS
                    180: serverprefix seqnos_;
                    181: serverdemux seqnos_memory_object_server;
                    182: #endif SEQNOS
                    183: 
                    184: /*
                    185:  *     Initialize the specified memory object, providing
                    186:  *     a reqeust port on which control calls can be made, and
                    187:  *     a name port that identifies this object to callers of
                    188:  *     vm_regions.
                    189:  *     [To allow the mapping of this object to be used, the
                    190:  *     memory manager must call memory_object_set_attributes,
                    191:  *     specifying the "ready" parameter as TRUE.  To reject
                    192:  *     all mappings of this object, the memory manager may
                    193:  *     use memory_object_destroy.]
                    194:  */
                    195: simpleroutine  memory_object_init(
                    196:                memory_object           : memory_object_t;
                    197: #if    SEQNOS
                    198:        msgseqno seqno                  : mach_port_seqno_t;
                    199: #endif SEQNOS
                    200:                memory_control          : memory_object_control_t =
                    201:                                                MACH_MSG_TYPE_MAKE_SEND
                    202:                                                ctype: mach_port_t;
                    203:                memory_object_name      : memory_object_name_t =
                    204:                                                MACH_MSG_TYPE_MAKE_SEND
                    205:                                                ctype: mach_port_t;
                    206:                memory_object_page_size : vm_size_t);
                    207: 
                    208: /*
                    209:  *     Indicates that the specified memory object is no longer
                    210:  *     mapped (or cached -- see memory_object_set_attributes),
                    211:  *     and that further mappings will cause another memory_object_init
                    212:  *     call to be made.  No further calls will be made on
                    213:  *     the memory object by this kernel.
                    214:  *
                    215:  *     [All rights to the control and name ports are included
                    216:  *     in this call.  The memory manager should use port_deallocate
                    217:  *     to release them once they are no longer needed.]
                    218:  */
                    219: simpleroutine  memory_object_terminate(
                    220:                memory_object           : memory_object_t =
                    221:                                                MACH_MSG_TYPE_MOVE_SEND
                    222:                                                ctype: mach_port_t;
                    223: #if    SEQNOS
                    224:        msgseqno seqno                  : mach_port_seqno_t;
                    225: #endif SEQNOS
                    226:                memory_control          : memory_object_control_t =
                    227:                                                MACH_MSG_TYPE_MOVE_RECEIVE
                    228:                                                ctype: mach_port_t
                    229: #if    KERNEL_USER
                    230:                /* for compatibility with Mach 2.5 kernels */
                    231:                                                , dealloc
                    232: #endif KERNEL_USER
                    233:                                                ;
                    234:                memory_object_name      : memory_object_name_t =
                    235:                                                MACH_MSG_TYPE_MOVE_RECEIVE
                    236:                                                ctype: mach_port_t
                    237: #if    KERNEL_USER
                    238:                /* for compatibility with Mach 2.5 kernels */
                    239:                                                , dealloc
                    240: #endif KERNEL_USER
                    241:                                                );
                    242: 
                    243: /*
                    244:  *     Indicates that a copy has been made of the specified range of
                    245:  *     the given original memory object.  The kernel will use the new
                    246:  *     memory object, control and name ports to refer to the new copy
                    247:  *     (once the memory manager has asserted its "ready" attribute).
                    248:  *
                    249:  *     Cached pages from the original memory object at the time of
                    250:  *     the copy operation are handled as follows:
                    251:  *             Readable pages may be silently copied to the new
                    252:  *              memory object (with all access permissions).
                    253:  *             Pages not copied are locked to prevent write access.
                    254:  *
                    255:  *     This call includes only the new memory object itself; a
                    256:  *     memory_object_init call will be made on the new memory
                    257:  *     object after the actions above are completed.
                    258:  *
                    259:  *     The new memory object is *temporary*, meaning that the
                    260:  *     memory manager should not change its contents or allow
                    261:  *     the memory object to be mapped in another client.  The
                    262:  *     memory manager may use the memory_object_data_unavailable
                    263:  *     call to indicate that the appropriate page of the original
                    264:  *     memory object may be used to fulfill a data request.
                    265:  *
                    266:  *     [Reply should be memory_object_set_attributes on the
                    267:  *     new memory object control port to indicate readiness.]
                    268:  */
                    269: simpleroutine  memory_object_copy(
                    270:                old_memory_object       : memory_object_t;
                    271: #if    SEQNOS
                    272:        msgseqno seqno                  : mach_port_seqno_t;
                    273: #endif SEQNOS
                    274:                old_memory_control      : memory_object_control_t =
                    275:                                                MACH_MSG_TYPE_MAKE_SEND
                    276:                                                ctype: mach_port_t;
                    277:                offset                  : vm_offset_t;
                    278:                length                  : vm_size_t;
                    279:                new_memory_object       : memory_object_t =
                    280:                                                MACH_MSG_TYPE_MOVE_RECEIVE
                    281:                                                ctype: mach_port_t
                    282: #if    KERNEL_USER
                    283:                /* for compatibility with Mach 2.5 kernels */
                    284:                                                , dealloc
                    285: #endif KERNEL_USER
                    286:                                                );
                    287: 
                    288: /*
                    289:  *     Request data from this memory object.  At least
                    290:  *     the specified data should be returned with at
                    291:  *     least the specified access permitted.
                    292:  *
                    293:  *     [Reply should be memory_object_data_provided.]
                    294:  */
                    295: simpleroutine  memory_object_data_request(
                    296:                memory_object           : memory_object_t;
                    297: #if    SEQNOS
                    298:        msgseqno seqno                  : mach_port_seqno_t;
                    299: #endif SEQNOS
                    300:                memory_control          : memory_object_control_t =
                    301:                                                MACH_MSG_TYPE_MAKE_SEND
                    302:                                                ctype: mach_port_t;
                    303:                offset                  : vm_offset_t;
                    304:                length                  : vm_size_t;
                    305:                desired_access          : vm_prot_t);
                    306: 
                    307: /*
                    308:  *     Request that the specified portion of this
                    309:  *     memory object be unlocked to allow the specified
                    310:  *     forms of access; the kernel already has the data.
                    311:  *
                    312:  *     [Reply should be memory_object_lock_request.]
                    313:  */
                    314: simpleroutine  memory_object_data_unlock(
                    315:                memory_object           : memory_object_t;
                    316: #if    SEQNOS
                    317:        msgseqno seqno                  : mach_port_seqno_t;
                    318: #endif SEQNOS
                    319:                memory_control          : memory_object_control_t =
                    320:                                                MACH_MSG_TYPE_MAKE_SEND
                    321:                                                ctype: mach_port_t;
                    322:                offset                  : vm_offset_t;
                    323:                length                  : vm_size_t;
                    324:                desired_access          : vm_prot_t);
                    325: 
                    326: /*
                    327:  *     Write back modifications made to this portion of
                    328:  *     the memory object while in memory.
                    329:  *
                    330:  *     Unless explicitly requested by a memory_object_lock_request
                    331:  *     (clean, but not flush), the kernel will not retain
                    332:  *     the data.
                    333:  *
                    334:  *     [Reply should be vm_deallocate to release the data.]
                    335:  */
                    336: simpleroutine  memory_object_data_write(
                    337:                memory_object           : memory_object_t;
                    338: #if    SEQNOS
                    339:        msgseqno seqno                  : mach_port_seqno_t;
                    340: #endif SEQNOS
                    341:                memory_control          : memory_object_control_t =
                    342:                                                MACH_MSG_TYPE_MAKE_SEND
                    343:                                                ctype: mach_port_t;
                    344:                offset                  : vm_offset_t;
                    345:                data                    : pointer_t);
                    346: 
                    347: /*
                    348:  *     Indicate that a previous memory_object_lock_reqeust has been
                    349:  *     completed.  Note that this call is made on whatever
                    350:  *     port is specified in the memory_object_lock_request; that port
                    351:  *     need not be the memory object port itself.
                    352:  *
                    353:  *     [No reply expected.]
                    354:  */
                    355: simpleroutine  memory_object_lock_completed(
                    356:                memory_object           : memory_object_t =
                    357:                        polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
                    358:                        ctype: mach_port_t;
                    359: #if    SEQNOS
                    360:        msgseqno seqno                  : mach_port_seqno_t;
                    361: #endif SEQNOS
                    362:                memory_control          : memory_object_control_t =
                    363:                                                MACH_MSG_TYPE_MAKE_SEND
                    364:                                                ctype: mach_port_t;
                    365:                offset                  : vm_offset_t;
                    366:                length                  : vm_size_t);
                    367: 
                    368: /*
                    369:  *     Indicate that a previous memory_object_data_supply has been
                    370:  *     completed.  Note that this call is made on whatever
                    371:  *     port is specified in the memory_object_data_supply; that port
                    372:  *     need not be the memory object port itself.
                    373:  *
                    374:  *     The result parameter indicates what happened during the supply.
                    375:  *     If it is not KERN_SUCCESS, then error_offset identifies the
                    376:  *     first offset at which a problem occurred.  The pagein operation
                    377:  *     stopped at this point.  Note that the only failures reported
                    378:  *     by this mechanism are KERN_MEMORY_PRESENT.  All other failures
                    379:  *     (invalid argument, error on pagein of supplied data in manager's
                    380:  *     address space) cause the entire operation to fail.
                    381:  *
                    382:  *     XXX Check what actually happens in latter case!
                    383:  *
                    384:  *     [No reply expected.]
                    385:  */
                    386: simpleroutine  memory_object_supply_completed(
                    387:                memory_object           : memory_object_t =
                    388:                        polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
                    389:                        ctype: mach_port_t;
                    390: #if    SEQNOS
                    391:        msgseqno seqno                  : mach_port_seqno_t;
                    392: #endif SEQNOS
                    393:                memory_control          : memory_object_control_t =
                    394:                                                MACH_MSG_TYPE_MAKE_SEND
                    395:                                                ctype: mach_port_t;
                    396:                offset                  : vm_offset_t;
                    397:                length                  : vm_size_t;
                    398:                result                  : kern_return_t;
                    399:                error_offset            : vm_offset_t);
                    400: 
                    401: /*
                    402:  *     Return data to manager.  This call is used in place of data_write
                    403:  *     for objects initialized by object_ready instead of set_attributes.
                    404:  *     This call indicates whether the returned data is dirty and whether
                    405:  *     the kernel kept a copy.  Precious data remains precious if the
                    406:  *     kernel keeps a copy.  The indication that the kernel kept a copy
                    407:  *     is only a hint if the data is not precious; the cleaned copy may
                    408:  *     be discarded without further notifying the manager.
                    409:  *
                    410:  *     [Reply should be vm_deallocate to release the data.]
                    411:  */
                    412: simpleroutine   memory_object_data_return(
                    413:                memory_object           : memory_object_t;
                    414: #if    SEQNOS
                    415:        msgseqno seqno                  : mach_port_seqno_t;
                    416: #endif SEQNOS
                    417:                memory_control          : memory_object_control_t =
                    418:                                                MACH_MSG_TYPE_MAKE_SEND
                    419:                                                ctype: mach_port_t;
                    420:                offset                  : vm_offset_t;
                    421:                data                    : pointer_t;
                    422:                dirty                   : boolean_t;
                    423:                kernel_copy             : boolean_t);
                    424: 
                    425: /*
                    426:  * XXX Warning:  This routine does NOT contain a memory_object_control_t
                    427:  * XXX because the memory_object_change_attributes call may cause
                    428:  * XXX  memory object termination (by uncaching the object).  This would
                    429:  * XXX  yield an invalid port.
                    430:  */
                    431: 
                    432: simpleroutine  memory_object_change_completed(
                    433:                memory_object           : memory_object_t =
                    434:                        polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
                    435:                        ctype: mach_port_t;
                    436: #if    SEQNOS
                    437:        msgseqno seqno                  : mach_port_seqno_t;
                    438: #endif SEQNOS
                    439:                may_cache               : boolean_t;
                    440:                copy_strategy           : memory_object_copy_strategy_t);

unix.superglobalmegacorp.com

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