|
|
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_COPYRIGHT@ ! 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: */ ! 52: /* ! 53: * File: mach/memory_object.defs ! 54: * ! 55: * Abstract: ! 56: * Basic Mach external memory management interface declaration. ! 57: */ ! 58: ! 59: subsystem ! 60: #if KERNEL_USER ! 61: KernelUser ! 62: #endif KERNEL_USER ! 63: #if KERNEL_SERVER ! 64: KernelServer ! 65: #endif KERNEL_SERVER ! 66: memory_object_control 2000; ! 67: ! 68: #ifdef MACH_KERNEL ! 69: #include <advisory_pageout.h> ! 70: #endif /* MACH_KERNEL */ ! 71: ! 72: #include <mach/std_types.defs> ! 73: #include <mach/mach_types.defs> ! 74: ! 75: /* ! 76: * JMM - For now we define back-and-forth paging until we get the code ! 77: * cleaned up. ! 78: */ ! 79: #define _BACK_AND_FORTH_PAGING_ ! 80: ! 81: /* ! 82: * Retrieves the attributes currently associated with ! 83: * a memory object. ! 84: */ ! 85: routine memory_object_get_attributes( ! 86: memory_control : vm_object_t; ! 87: flavor : memory_object_flavor_t; ! 88: out attributes : memory_object_info_t, CountInOut); ! 89: ! 90: ! 91: simpleroutine memory_object_change_attributes( ! 92: memory_control : vm_object_t; ! 93: flavor : memory_object_flavor_t; ! 94: attributes : memory_object_info_t ! 95: #ifdef _BACK_AND_FORTH_PAGING_ ! 96: ; reply_to : mach_port_t = ! 97: MACH_MSG_TYPE_MAKE_SEND|polymorphic ! 98: #endif ! 99: ); ! 100: ! 101: simpleroutine memory_object_synchronize_completed ( ! 102: memory_control : vm_object_t; ! 103: offset : vm_offset_t; ! 104: length : vm_offset_t); ! 105: ! 106: /* ! 107: * Indicate that a range of the given temporary memory object does ! 108: * not exist, and that the backing memory object should be used ! 109: * instead (or zero-fill memory be used, if no backing object exists). ! 110: * [This call is intended for use only by the default memory manager. ! 111: * It should not be used to indicate a real error -- ! 112: * memory_object_data_error should be used for that purpose.] ! 113: */ ! 114: simpleroutine memory_object_data_unavailable( ! 115: memory_control : vm_object_t; ! 116: offset : vm_offset_t; ! 117: size : vm_size_t); ! 118: ! 119: ! 120: /* ! 121: * Control use of the data associated with the given ! 122: * memory object. For each page in the given range, ! 123: * perform the following operations, in order: ! 124: * 1) restrict access to the page (disallow ! 125: * forms specified by "prot"); ! 126: * 2) write back modifications (if "should_return" ! 127: * is RETURN_DIRTY and the page is dirty, or ! 128: * "should_return" is RETURN_ALL and the page ! 129: * is either dirty or precious); and, ! 130: * 3) flush the cached copy (if "should_flush" ! 131: * is asserted). ! 132: * The set of pages is defined by a starting offset ! 133: * ("offset") and size ("size"). Only pages with the ! 134: * same page alignment as the starting offset are ! 135: * considered. ! 136: * ! 137: * A single acknowledgement is sent (to the "reply_to" ! 138: * port) when these actions are complete. ! 139: * ! 140: * There are two versions of this routine because IPC distinguishes ! 141: * between booleans and integers (a 2-valued integer is NOT a ! 142: * boolean). The new routine is backwards compatible at the C ! 143: * language interface. ! 144: */ ! 145: simpleroutine memory_object_lock_request( ! 146: memory_control : vm_object_t; ! 147: offset : vm_offset_t; ! 148: size : vm_size_t; ! 149: should_return : memory_object_return_t; ! 150: should_flush : boolean_t; ! 151: lock_value : vm_prot_t ! 152: #ifdef _BACK_AND_FORTH_PAGING_ ! 153: ; reply_to : mach_port_t = ! 154: MACH_MSG_TYPE_MAKE_SEND|polymorphic ! 155: #endif ! 156: ); ! 157: ! 158: ! 159: /* ! 160: * Indicate that a range of the specified memory object cannot ! 161: * be provided at this time. [Threads waiting for memory pages ! 162: * specified by this call will experience a memory exception. ! 163: * Only threads waiting at the time of the call are affected.] ! 164: */ ! 165: simpleroutine memory_object_data_error( ! 166: memory_control : vm_object_t; ! 167: offset : vm_offset_t; ! 168: size : vm_size_t; ! 169: error_value : kern_return_t); ! 170: ! 171: /* ! 172: */ ! 173: simpleroutine memory_object_destroy( ! 174: memory_control : vm_object_t; ! 175: reason : kern_return_t); ! 176: ! 177: /* ! 178: * Provide the data contents of a range of the given memory ! 179: * object, with the access restriction specified, optional ! 180: * precious attribute, and reply message. [Only ! 181: * whole virtual pages of data can be accepted; partial pages ! 182: * will be discarded. Data should be provided on request, but ! 183: * may be provided in advance as desired. When data already ! 184: * held by this kernel is provided again, the new data is ignored. ! 185: * The access restriction is the subset of {read, write, execute} ! 186: * which are prohibited. The kernel may not provide any data (or ! 187: * protection) consistency among pages with different virtual page ! 188: * alignments within the same object. The precious value controls ! 189: * how the kernel treats the data. If it is FALSE, the kernel treats ! 190: * its copy as a temporary and may throw it away if it hasn't been ! 191: * changed. If the precious value is TRUE, the kernel treats its ! 192: * copy as a data repository and promises to return it to the manager; ! 193: * the manager may tell the kernel to throw it away instead by flushing ! 194: * and not cleaning the data -- see memory_object_lock_request. The ! 195: * reply_to port is for a compeletion message; it will be ! 196: * memory_object_supply_completed.] ! 197: */ ! 198: simpleroutine memory_object_data_supply( ! 199: memory_control : vm_object_t; ! 200: offset : vm_offset_t; ! 201: data : pointer_t, Dealloc[]; ! 202: lock_value : vm_prot_t; ! 203: precious : boolean_t ! 204: #ifdef _BACK_AND_FORTH_PAGING_ ! 205: ; reply_to : mach_port_t = ! 206: MACH_MSG_TYPE_MAKE_SEND|polymorphic ! 207: #endif ! 208: ); ! 209: ! 210: #if !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT ! 211: /* ! 212: * Reply to a memory_object_discard_request(). ! 213: * The pages from "discard_offset" to "discard_offset+discard_size" will ! 214: * be flushed. If these pages are not the same as those requested, the ! 215: * kernel will cancel the discard_request on the requested pages, provided ! 216: * that at least an equivalent number of pages are actually flushed in the ! 217: * same time. ! 218: * The "should_return" flag has the same meaning as in the ! 219: * memory_object_lock_request() interface. ! 220: * A memory_object_lock_completed() message is sent to the "reply_to" port ! 221: * if provided. ! 222: */ ! 223: simpleroutine memory_object_discard_reply( ! 224: memory_control : vm_object_t; ! 225: requested_offset: vm_offset_t; ! 226: requested_size : vm_size_t; ! 227: discard_offset : vm_offset_t; ! 228: discard_size : vm_size_t; ! 229: should_return : memory_object_return_t ! 230: #ifdef _BACK_AND_FORTH_PAGING_ ! 231: ; reply_to : mach_port_t = ! 232: MACH_MSG_TYPE_MAKE_SEND|polymorphic ! 233: #endif ! 234: ); ! 235: #else /* !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT */ ! 236: skip; ! 237: #endif /* !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT */ ! 238: ! 239: routine vm_object_upl_request( ! 240: object :vm_object_entry_t; ! 241: in offset :memory_object_offset_t; ! 242: in size :vm_size_t; ! 243: out upl :mach_port_move_send_t; ! 244: out page_list :upl_page_list_ptr_t, CountInOut; ! 245: in cntrl_flags :integer_t); ! 246: ! 247: routine vm_pager_upl_request( ! 248: object :vm_object_entry_t; ! 249: in offset :memory_object_offset_t; ! 250: in size :vm_size_t; ! 251: in super_size :vm_size_t; ! 252: out upl :mach_port_move_send_t; ! 253: out page_list :upl_page_list_ptr_t, CountInOut; ! 254: in cntrl_flags :integer_t); ! 255: ! 256: routine vm_upl_map( ! 257: map :vm_task_entry_t; ! 258: in upl :upl_object_t; ! 259: inout dst_addr :vm_offset_t); ! 260: ! 261: routine vm_upl_unmap( ! 262: map :vm_task_entry_t; ! 263: in upl :upl_object_t); ! 264: ! 265: routine vm_upl_abort( ! 266: upl_object :upl_object_entry_t; ! 267: in abort_cond :integer_t); ! 268: ! 269: routine vm_upl_commit( ! 270: upl_object :upl_object_entry_t; ! 271: in page_list :upl_page_list_ptr_t); ! 272: ! 273: routine vm_upl_commit_range( ! 274: upl_object :upl_object_entry_t; ! 275: offset :vm_offset_t; ! 276: size :vm_size_t; ! 277: in page_list :upl_page_list_ptr_t);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.