|
|
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 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: mach.defs,v $
1.1.1.2 ! root 53: * Revision 1.3 1999/07/22 20:04:00 wsanchez
! 54: * Update APSL
! 55: *
! 56: * Revision 1.2 1999/03/25 09:19:40 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:38 wsanchez
61: * Substitute License
62: *
63: * Revision 1.1.1.1.666.3 1999/03/16 15:28:02 wsanchez
64: * Substitute copyright
65: *
66: * Revision 1.1.1.1.666.2 1999/03/16 10:37:38 umeshv
67: * Fixed errors in previous commit.
68: *
69: * Revision 1.1.1.1.666.1 1999/03/11 09:52:49 umeshv
70: * Added copyrights.
71: *
72: * Revision 1.1.1.1 1997/09/30 02:44:50 wsanchez
73: * Import of kernel from umeshv/kernel
74: *
75: * Revision 2.15 93/01/21 12:23:14 danner
76: * New interface for task_ras_control.
77: * [93/01/19 16:35:06 bershad]
78: *
79: * Revision 2.14 92/07/20 13:33:09 cmaeda
80: * Added definition for task_set_ras_pc.
81: * Uses message number recycled from old task_get_io_port.
82: * [92/05/11 14:37:53 cmaeda]
83: *
84: * Revision 2.13 92/01/15 13:45:00 rpd
85: * Changed MACH_IPC_COMPAT conditionals to default to not present.
86: *
87: * Revision 2.12 92/01/14 16:45:18 rpd
88: * Changed mach_port_array_t usages to remain compatible,
89: * because the definition of the type changed incompatibly.
90: * [92/01/13 rpd]
91: * Updated vm_region for new memory_object_name_t definition.
92: * [91/12/31 rpd]
93: *
94: * Revision 2.11 92/01/03 20:20:53 dbg
95: * Changed (new) task_get_emulation_vector,
96: * task_set_emulation_vector to pass data out-of-line. Old
97: * routines still pass data in-line, for compatibility.
98: * [92/01/03 dbg]
99: *
100: * Add 'CountInOut' tag to routines returning variable-length
101: * inline arrays. Remove 'IsLong' tag from routines passing or
102: * returning variable-length arrays. Old routines left under
103: * 'xxx_' names. REMOVE THESE SOON!
104: *
105: * I used the message IDs from the Mach 1.5 thread calls (before
106: * the real thread support went in) - they haven't been used since
107: * 1988.
108: * [91/11/26 dbg]
109: *
110: * Revision 2.10 91/08/28 11:15:04 jsb
111: * Precious page support: Add new version of memory_object_lock_request.
112: * Add memory_object_{ready,change_attributes}.
113: * [91/07/03 14:03:34 dlb]
114: * Added KERNEL_USER definitions (for NORMA support).
115: * [91/08/15 09:58:13 jsb]
116: *
117: * Revision 2.9 91/07/31 17:53:17 dbg
118: * Added user-settable 'dealloc' flag to data argument of
119: * memory_object_data_supply. Needs new MiG.
120: * USERS OF THIS FUNCTION MUST RE-LINK!!
121: * [91/07/29 dbg]
122: *
123: * MACH_IPC_COMPAT: set C type for backup argument to
124: * port_set_backup to be 'mach_port_t'. If mach_interface.h is
125: * included with MACH_IPC_COMPAT == 0, the type 'port_t' is not
126: * defined.
127: *
128: * Removed vm_pageable.
129: * [91/06/24 dbg]
130: *
131: * Revision 2.8 91/07/01 08:25:09 jsb
132: * From David Black at OSF: added memory_object_data_supply.
133: * [91/06/29 14:59:47 jsb]
134: *
135: * Revision 2.7 91/06/06 17:07:51 jsb
136: * Added task_get_emulation_vector, task_set_emulation_vector.
137: * [91/05/24 18:26:01 jsb]
138: *
139: * Revision 2.6 91/05/14 16:54:18 mrt
140: * Correcting copyright
141: *
142: * Revision 2.5 91/02/05 17:33:12 mrt
143: * Changed to new Mach copyright
144: * [91/02/01 17:17:41 mrt]
145: *
146: * Revision 2.4 90/06/02 14:58:09 rpd
147: * Changed reply_to argument of memory_object_lock_request
148: * to default to a send-once right but still allow send rights.
149: * [90/05/31 rpd]
150: *
151: * Changes for the emulator: remove vm_allocate, redefine vm_map.
152: *
153: * Obsoleted vm_allocate_with_pager.
154: * [90/04/08 rpd]
155: * Converted to new IPC. Purged MACH_NP, MACH_NET.
156: * Moved vm_set_default_memory_manager, memory_object_get_attributes.
157: * [90/03/26 22:31:41 rpd]
158: *
159: *
160: * Condensed history:
161: * Added vm_machine_attribute (af).
162: * Added memory_object_get_attributes (mwyoung).
163: * Added vm_set_default_memory_manager (mwyoung).
164: * Added thread_set_priority (dbg).
165: * Added vm_pageable (dbg).
166: * Added port_set_backup (rpd).
167: * Added memory_object_destroy (mwyoung).
168: * Converted to memory_object_* names (mwyoung).
169: * New port and port set calls (rpd).
170: * Added documentation (mwyoung).
171: * Added vm_map, pager_attributes, pager_data_error (mwyoung).
172: * Added task_set_emulation and task_get_io_port (dorr).
173: * Added new thread and task interfaces (dbg).
174: * Reset history (avie).
175: */
176:
177: /*
178: * Matchmaker definitions file for Mach kernel interface.
179: */
180:
181: subsystem
182: #if KERNEL_USER && defined(MACH_IPC_FLAVOR)
183: KernelUser
184: #endif KERNEL_USER
185: #if KERNEL_SERVER && defined(MACH_IPC_FLAVOR)
186: KernelServer
187: #endif KERNEL_SERVER
188: mach 2000;
189:
190: #include <mach/std_types.defs>
191: #include <mach/mach_types.defs>
192:
193: skip; /* old port_allocate */
194: skip; /* old port_deallocate */
195: skip; /* old port_enable */
196: skip; /* old port_disable */
197: skip; /* old port_select */
198: skip; /* old port_set_backlog */
199: skip; /* old port_status */
200:
201: /*
202: * Create a new task with an empty set of IPC rights,
203: * and having an address space constructed from the
204: * target task (or empty, if inherit_memory is FALSE).
205: */
206: routine task_create(
207: target_task : task_t;
208: inherit_memory : boolean_t;
209: out child_task : task_t);
210:
211: /*
212: * Destroy the target task, causing all of its threads
213: * to be destroyed, all of its IPC rights to be deallocated,
214: * and all of its address space to be deallocated.
215: */
216: routine task_terminate(
217: target_task : task_t);
218:
219: skip; /* task_get_emulation_vector */
220: skip; /* task_set_emulation_vector */
221:
222: /*
223: * Returns the set of threads belonging to the target task.
224: */
225: routine task_threads(
226: target_task : task_t;
227: out thread_list : thread_array_t);
228:
229: skip; /* task_info: MACH 3.0 */
230: skip; /* old task_status */
231: skip; /* old task_set_notify */
232: skip; /* old thread_create */
233:
234: /*
235: * Destroy the target thread.
236: */
237: routine thread_terminate(
238: target_thread : thread_t);
239:
240: skip; /* thread_get_state: MACH 3.0 */
241: skip; /* thread_set_state: MACH 3.0 */
242: skip; /* thread_info: MACH 3.0 */
243: skip; /* old thread_mutate */
244:
245: /*
246: * Allocate zero-filled memory in the address space
247: * of the target task, either at the specified address,
248: * or wherever space can be found (if anywhere is TRUE),
249: * of the specified size. The address at which the
250: * allocation actually took place is returned.
251: */
252: routine vm_allocate(
253: target_task : vm_task_t;
254: inout address : vm_address_t;
255: size : vm_size_t;
256: anywhere : boolean_t);
257:
258: skip; /* old vm_allocate_with_pager */
259:
260: /*
261: * Deallocate the specified range from the virtual
262: * address space of the target task.
263: */
264: routine vm_deallocate(
265: target_task : vm_task_t;
266: address : vm_address_t;
267: size : vm_size_t);
268:
269: /*
270: * Set the current or maximum protection attribute
271: * for the specified range of the virtual address
272: * space of the target task. The current protection
273: * limits the memory access rights of threads within
274: * the task; the maximum protection limits the accesses
275: * that may be given in the current protection.
276: * Protections are specified as a set of {read, write, execute}
277: * *permissions*.
278: */
279: routine vm_protect(
280: target_task : vm_task_t;
281: address : vm_address_t;
282: size : vm_size_t;
283: set_maximum : boolean_t;
284: new_protection : vm_prot_t);
285:
286: /*
287: * Set the inheritance attribute for the specified range
288: * of the virtual address space of the target task.
289: * The inheritance value is one of {none, copy, share}, and
290: * specifies how the child address space should acquire
291: * this memory at the time of a task_create call.
292: */
293: routine vm_inherit(
294: target_task : vm_task_t;
295: address : vm_address_t;
296: size : vm_size_t;
297: new_inheritance : vm_inherit_t);
298:
299: /*
300: * Returns the contents of the specified range of the
301: * virtual address space of the target task. [The
302: * range must be aligned on a virtual page boundary,
303: * and must be a multiple of pages in extent. The
304: * protection on the specified range must permit reading.]
305: */
306: routine vm_read(
307: target_task : vm_task_t;
308: address : vm_address_t;
309: size : vm_size_t;
310: out data : pointer_t);
311:
312: /*
313: * Writes the contents of the specified range of the
314: * virtual address space of the target task. [The
315: * range must be aligned on a virtual page boundary,
316: * and must be a multiple of pages in extent. The
317: * protection on the specified range must permit writing.]
318: */
319: routine vm_write(
320: target_task : vm_task_t;
321: address : vm_address_t;
322: data : pointer_t);
323:
324: /*
325: * Copy the contents of the source range of the virtual
326: * address space of the target task to the destination
327: * range in that same address space. [Both of the
328: * ranges must be aligned on a virtual page boundary,
329: * and must be multiples of pages in extent. The
330: * protection on the source range must permit reading,
331: * and the protection on the destination range must
332: * permit writing.]
333: */
334: routine vm_copy(
335: target_task : vm_task_t;
336: source_address : vm_address_t;
337: size : vm_size_t;
338: dest_address : vm_address_t);
339:
340: /*
341: * Returns information about the contents of the virtual
342: * address space of the target task at the specified
343: * address. The returned protection, inheritance, sharing
344: * and memory object values apply to the entire range described
345: * by the address range returned; the memory object offset
346: * corresponds to the beginning of the address range.
347: * [If the specified address is not allocated, the next
348: * highest address range is described. If no addresses beyond
349: * the one specified are allocated, the call returns KERN_NO_SPACE.]
350: */
351: routine vm_region(
352: target_task : vm_task_t;
353: inout address : vm_address_t;
354: out size : vm_size_t;
355: out protection : vm_prot_t;
356: out max_protection : vm_prot_t;
357: out inheritance : vm_inherit_t;
358: out is_shared : boolean_t;
359: #ifdef MACH_IPC_FLAVOR
360: /* avoid out-translation of the argument */
361: out object_name : memory_object_name_t =
362: MACH_MSG_TYPE_MOVE_SEND
363: ctype: mach_port_t;
364: #else /* MACH_IPC_FLAVOR */
365: out object_name : memory_object_name_t;
366: #endif /* MACH_IPC_FLAVOR */
367: out offset : vm_offset_t);
368:
369: /*
370: * Return virtual memory statistics for the host
371: * on which the target task resides. [Note that the
372: * statistics are not specific to the target task.]
373: */
374: routine vm_statistics(
375: target_task : vm_task_t;
376: out vm_stats : vm_statistics_data_t);
377:
378: routine task_by_unix_pid(
379: target_task : task_t;
380: process_id : int;
381: out result_task : task_t);
382:
383: skip; /* old vm_pageable */
384: skip; /* mach_ports_register */
385: skip; /* mach_ports_lookup */
386:
387: routine unix_pid(
388: target_task : task_t;
389: out process_id : int);
390:
391: /*
392: * Redirect network IP messages to the specified Mach port.
393: */
394: routine netipc_listen(
395: request_port : port_t;
396: src_addr : int;
397: dst_addr : int;
398: src_port : int;
399: dst_port : int;
400: protocol : int;
401: ipc_port : port_t);
402:
403: /*
404: * Stop IP message redirection as set up by netipc_listen.
405: */
406: routine netipc_ignore(
407: request_port : port_t;
408: ipc_port : port_t);
409:
410: #ifdef MACH_IPC_FLAVOR_and_XP
411: /*
412: * Provide the data contents of a range of the given memory
413: * object, with the access restriction specified. [Only
414: * whole virtual pages of data can be accepted; partial pages
415: * will be discarded. Data should be provided on request, but
416: * may be provided in advance as desired. When data already
417: * held by this kernel is provided again, the new data is ignored.
418: * The access restriction is the subset of {read, write, execute}
419: * which are prohibited. The kernel may not provide any data (or
420: * protection) consistency among pages with different virtual page
421: * alignments within the same object.]
422: */
423: simpleroutine memory_object_data_provided(
424: memory_control : memory_object_control_t;
425: offset : vm_offset_t;
426: data : pointer_t;
427: lock_value : vm_prot_t);
428: #else /* MACH_IPC_FLAVOR */
429: skip; /* memory_object_data_provided */
430: #endif /* MACH_IPC_FLAVOR */
431:
432: #ifdef MACH_IPC_FLAVOR_and_XP
433: /*
434: * Indicate that a range of the given temporary memory object does
435: * not exist, and that the backing memory object should be used
436: * instead (or zero-fill memory be used, if no backing object exists).
437: * [This call is intended for use only by the default memory manager.
438: * It should not be used to indicate a real error --
439: * memory_object_data_error should be used for that purpose.]
440: */
441: simpleroutine memory_object_data_unavailable(
442: memory_control : memory_object_control_t;
443: offset : vm_offset_t;
444: size : vm_size_t);
445: #else /* MACH_IPC_FLAVOR */
446: skip; /* memory_object_data_unavailable */
447: #endif /* MACH_IPC_FLAVOR */
448:
449: #ifdef MACH_IPC_FLAVOR_and_XP
450: /*
451: * Retrieves the attributes currently associated with
452: * a memory object.
453: */
454: routine memory_object_get_attributes(
455: memory_control : memory_object_control_t;
456: out object_ready : boolean_t;
457: out may_cache : boolean_t;
458: out copy_strategy : memory_object_copy_strategy_t);
459: #else /* MACH_IPC_FLAVOR */
460: skip; /* memory_object_get_attributes */
461: #endif /* MACH_IPC_FLAVOR */
462:
463: #ifdef MACH_IPC_FLAVOR_and_XP
464: /*
465: * Sets the default memory manager, the port to which
466: * newly-created temporary memory objects are delivered.
467: * [See (memory_object_default)memory_object_create.]
468: * The old memory manager port is returned.
469: */
470: routine vm_set_default_memory_manager(
471: host_priv : host_priv_t;
472: inout default_manager : mach_port_make_send_t);
473: #else /* MACH_IPC_FLAVOR */
474: skip; /* vm_set_default_memory_manager */
475: #endif /* MACH_IPC_FLAVOR */
476:
477: skip; /* old pager_flush_request */
478:
479: #ifdef MACH_IPC_FLAVOR_and_XP
480: /*
481: * Control use of the data associated with the given
482: * memory object. For each page in the given range,
483: * perform the following operations, in order:
484: * 1) restrict access to the page (disallow
485: * forms specified by "prot");
486: * 2) write back modifications (if "should_return"
487: * is RETURN_DIRTY and the page is dirty, or
488: * "should_return" is RETURN_ALL and the page
489: * is either dirty or precious); and,
490: * 3) flush the cached copy (if "should_flush"
491: * is asserted).
492: * The set of pages is defined by a starting offset
493: * ("offset") and size ("size"). Only pages with the
494: * same page alignment as the starting offset are
495: * considered.
496: *
497: * A single acknowledgement is sent (to the "reply_to"
498: * port) when these actions are complete.
499: *
500: * There are two versions of this routine because IPC distinguishes
501: * between booleans and integers (a 2-valued integer is NOT a
502: * boolean). The new routine is backwards compatible at the C
503: * language interface.
504: */
505: skip; /* xxx_memory_object_lock_request */
506:
507: simpleroutine memory_object_lock_request(
508: memory_control : memory_object_control_t;
509: offset : vm_offset_t;
510: size : vm_size_t;
511: should_return : memory_object_return_t;
512: should_flush : boolean_t;
513: lock_value : vm_prot_t;
514: reply_to : mach_port_t =
515: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
516: #else /* MACH_IPC_FLAVOR */
517: skip; /* xxx_memory_object_lock_request */
518: skip; /* memory_object_lock_request */
519: #endif /* MACH_IPC_FLAVOR */
520:
521: skip; /* xxx_task_get_emulation_vector */
522: skip; /* xxx_task_set_emulation_vector */
523:
524: /*
525: * Returns information about the host on which the
526: * target object resides. [This object may be
527: * a task, thread, or memory_object_control port.]
528: */
529: routine xxx_host_info(
530: #ifdef MACH_IPC_FLAVOR
531: target_task : mach_port_t;
532: #else /* MACH_IPC_FLAVOR */
533: target_task : port_t;
534: #endif /* MACH_IPC_FLAVOR */
535: out info : machine_info_data_t);
536:
537: /*
538: * Returns information about a particular processor on
539: * the host on which the target task resides.
540: */
541: routine xxx_slot_info(
542: target_task : task_t;
543: slot : int;
544: out info : machine_slot_data_t);
545:
546: /*
547: * Performs control operations (currently only
548: * turning off or on) on a particular processor on
549: * the host on which the target task resides.
550: */
551: routine xxx_cpu_control(
552: target_task : task_t;
553: cpu : int;
554: running : boolean_t);
555:
556: skip; /* old thread_statistics */
557: skip; /* old task_statistics */
558: skip; /* old netport_init */
559: skip; /* old netport_enter */
560: skip; /* old netport_remove */
561: skip; /* old thread_set_priority */
562:
563: /*
564: * Increment the suspend count for the target task.
565: * No threads within a task may run when the suspend
566: * count for that task is non-zero.
567: */
568: routine task_suspend(
569: target_task : task_t);
570:
571: /*
572: * Decrement the suspend count for the target task,
573: * if the count is currently non-zero. If the resulting
574: * suspend count is zero, then threads within the task
575: * that also have non-zero suspend counts may execute.
576: */
577: routine task_resume(
578: target_task : task_t);
579:
580: /*
581: * Returns the current value of the selected special port
582: * associated with the target task.
583: */
584: routine task_get_special_port(
585: task : task_t;
586: which_port : int;
587: #ifdef MACH_IPC_FLAVOR
588: out special_port : mach_port_t);
589: #else /* MACH_IPC_FLAVOR */
590: out special_port : port_t);
591: #endif /* MACH_IPC_FLAVOR */
592:
593: /*
594: * Set one of the special ports associated with the
595: * target task.
596: */
597: routine task_set_special_port(
598: task : task_t;
599: which_port : int;
600: #ifdef MACH_IPC_FLAVOR
601: special_port : mach_port_t);
602: #else /* MACH_IPC_FLAVOR */
603: special_port : port_t);
604: #endif /* MACH_IPC_FLAVOR */
605:
606: /*
607: * Returns information about the target task.
608: */
609: routine task_info(
610: target_task : task_t;
611: flavor : int;
612: #if MACH_IPC_FLAVOR == UNTYPED
613: out task_info_out : task_info_t, CountInOut);
614: #else /* MACH_IPC_FLAVOR */
615: out task_info_out : task_info_t, IsLong);
616: #endif /* MACH_IPC_FLAVOR */
617:
618:
619: /*
620: * Create a new thread within the target task, returning
621: * the port representing that new thread. The
622: * initial execution state of the thread is undefined.
623: */
624: routine thread_create(
625: parent_task : task_t;
626: out child_thread : thread_t);
627:
628: /*
629: * Increment the suspend count for the target thread.
630: * Once this call has completed, the thread will not
631: * execute any further user or meta- instructions.
632: * Once suspended, a thread may not execute again until
633: * its suspend count is zero, and the suspend count
634: * for its task is also zero.
635: */
636: routine thread_suspend(
637: target_thread : thread_t);
638:
639: /*
640: * Decrement the suspend count for the target thread,
641: * if that count is not already zero.
642: */
643: routine thread_resume(
644: target_thread : thread_t);
645:
646: /*
647: * Cause any user or meta- instructions currently being
648: * executed by the target thread to be aborted. [Meta-
649: * instructions consist of the basic traps for IPC
650: * (e.g., msg_send, msg_receive) and self-identification
651: * (e.g., task_self, thread_self, thread_reply). Calls
652: * described by MiG interfaces are not meta-instructions
653: * themselves.]
654: */
655: routine thread_abort(
656: target_thread : thread_t);
657:
658: /*
659: * Return the selected state information for the target
660: * thread. If the thread is currently executing, the results
661: * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
662: * list of valid flavors for the target thread.]
663: */
664: routine thread_get_state(
665: target_thread : thread_t;
666: flavor : int;
667: #if MACH_IPC_FLAVOR == UNTYPED
668: out old_state : thread_state_t, CountInOut);
669: #else /* MACH_IPC_FLAVOR */
670: out old_state : thread_state_t, IsLong);
671: #endif /* MACH_IPC_FLAVOR */
672:
673: /*
674: * Set the selected state information for the target thread.
675: * If the thread is currently executing, the state change
676: * may be ill-defined.
677: */
678: routine thread_set_state(
679: target_thread : thread_t;
680: flavor : int;
681: #if MACH_IPC_FLAVOR == UNTYPED
682: new_state : thread_state_t);
683: #else /* MACH_IPC_FLAVOR */
684: new_state : thread_state_t, IsLong);
685: #endif /* MACH_IPC_FLAVOR */
686:
687: /*
688: * Returns the current value of the selected special port
689: * associated with the target thread.
690: */
691: routine thread_get_special_port(
692: thread : thread_t;
693: which_port : int;
694: #ifdef MACH_IPC_FLAVOR
695: out special_port : mach_port_t);
696: #else /* MACH_IPC_FLAVOR */
697: out special_port : port_t);
698: #endif /* MACH_IPC_FLAVOR */
699:
700: /*
701: * Set one of the special ports associated with the
702: * target thread.
703: */
704: routine thread_set_special_port(
705: thread : thread_t;
706: which_port : int;
707: #ifdef MACH_IPC_FLAVOR
708: special_port : mach_port_t);
709: #else /* MACH_IPC_FLAVOR */
710: special_port : port_t);
711: #endif /* MACH_IPC_FLAVOR */
712:
713: /*
714: * Returns information about the target thread.
715: */
716: routine thread_info(
717: target_thread : thread_t;
718: flavor : int;
719: #if MACH_IPC_FLAVOR == UNTYPED
720: out thread_info_out : thread_info_t, CountInOut);
721: #else /* MACH_IPC_FLAVOR */
722: out thread_info_out : thread_info_t, IsLong);
723: #endif /* MACH_IPC_FLAVOR */
724:
725: skip; /* task_set_emulation */
726: skip; /* task_ras_control */
727: skip; /* old host_ipc_statistics */
728:
729: /*
730: * Returns the set of port and port set names
731: * to which the target task has access, along with
732: * the type (set or port) for each name.
733: */
734: routine port_names(
735: #ifdef MACH_IPC_FLAVOR
736: task : ipc_space_t;
737: #else /* MACH_IPC_FLAVOR */
738: task : task_t;
739: #endif /* MACH_IPC_FLAVOR */
740: out port_names_p : port_name_array_t;
741: out port_types : port_type_array_t);
742:
743: /*
744: * Returns the type (set or port) for the port name
745: * within the target task.
746: */
747: routine port_type(
748: #ifdef MACH_IPC_FLAVOR
749: task : ipc_space_t;
750: #else /* MACH_IPC_FLAVOR */
751: task : task_t;
752: #endif /* MACH_IPC_FLAVOR */
753: port_name : port_name_t;
754: out port_type_p : port_type_t);
755:
756: /*
757: * Changes the name by which a port (or port set) is known to
758: * the target task.
759: */
760: routine port_rename(
761: #ifdef MACH_IPC_FLAVOR
762: task : ipc_space_t;
763: #else /* MACH_IPC_FLAVOR */
764: task : task_t;
765: #endif /* MACH_IPC_FLAVOR */
766: old_name : port_name_t;
767: new_name : port_name_t);
768:
769: /*
770: * Allocate a new port (with all rights) in the target task.
771: * The port name in that task is returned.
772: */
773: routine port_allocate(
774: #ifdef MACH_IPC_FLAVOR
775: task : ipc_space_t;
776: #else /* MACH_IPC_FLAVOR */
777: task : task_t;
778: #endif /* MACH_IPC_FLAVOR */
779: out port_name : port_name_t);
780:
781: /*
782: * Deallocate the port with the given name from the target task.
783: */
784: routine port_deallocate(
785: #ifdef MACH_IPC_FLAVOR
786: task : ipc_space_t;
787: #else /* MACH_IPC_FLAVOR */
788: task : task_t;
789: #endif /* MACH_IPC_FLAVOR */
790: port_name : port_name_t);
791:
792: /*
793: * Set the number of messages that may be queued to
794: * the port in the target task with the given name
795: * before further message queueing operations block.
796: * The target task must hold receive rights for the
797: * port named.
798: */
799: routine port_set_backlog(
800: #ifdef MACH_IPC_FLAVOR
801: task : ipc_space_t;
802: #else /* MACH_IPC_FLAVOR */
803: task : task_t;
804: #endif /* MACH_IPC_FLAVOR */
805: port_name : port_name_t;
806: backlog : int);
807:
808: /*
809: * Return information about the port with the given
810: * name in the target task. Only the ownership and
811: * receive_rights results are meaningful unless the
812: * target task holds receive rights for the port.
813: */
814: routine port_status(
815: #ifdef MACH_IPC_FLAVOR
816: task : ipc_space_t;
817: #else /* MACH_IPC_FLAVOR */
818: task : task_t;
819: #endif /* MACH_IPC_FLAVOR */
820: port_name : port_name_t;
821: out enabled : port_set_name_t;
822: out num_msgs : int;
823: out backlog : int;
824: out ownership : boolean_t;
825: out receive_rights : boolean_t);
826:
827: /*
828: * Allocate a new port set in the target task, returning
829: * the name of that new port set. [The new set is
830: * initially empty.]
831: */
832: routine port_set_allocate(
833: #ifdef MACH_IPC_FLAVOR
834: task : ipc_space_t;
835: #else /* MACH_IPC_FLAVOR */
836: task : task_t;
837: #endif /* MACH_IPC_FLAVOR */
838: out set_name : port_set_name_t);
839:
840: /*
841: * Deallocate the named port set from the target task.
842: * Ports that are currently members of the named port
843: * set are first removed from the set.
844: */
845: routine port_set_deallocate(
846: #ifdef MACH_IPC_FLAVOR
847: task : ipc_space_t;
848: #else /* MACH_IPC_FLAVOR */
849: task : task_t;
850: #endif /* MACH_IPC_FLAVOR */
851: set_name : port_set_name_t);
852:
853: /*
854: * Add the named port to the port set named within
855: * the target task. [If the port currently is a member
856: * of another port set, it is removed from that set.]
857: */
858: routine port_set_add(
859: #ifdef MACH_IPC_FLAVOR
860: task : ipc_space_t;
861: #else /* MACH_IPC_FLAVOR */
862: task : task_t;
863: #endif /* MACH_IPC_FLAVOR */
864: set_name : port_set_name_t;
865: port_name : port_name_t);
866:
867: /*
868: * Remove the named port from the port set named within
869: * the target task.
870: */
871: routine port_set_remove(
872: #ifdef MACH_IPC_FLAVOR
873: task : ipc_space_t;
874: #else /* MACH_IPC_FLAVOR */
875: task : task_t;
876: #endif /* MACH_IPC_FLAVOR */
877: port_name : port_name_t);
878:
879: /*
880: * Returns the current set of ports that are members
881: * of the named port set in the target task.
882: */
883: routine port_set_status(
884: #ifdef MACH_IPC_FLAVOR
885: task : ipc_space_t;
886: #else /* MACH_IPC_FLAVOR */
887: task : task_t;
888: #endif /* MACH_IPC_FLAVOR */
889: set_name : port_set_name_t;
890: out members : port_name_array_t);
891:
892: /*
893: * Insert send rights for the specified port into
894: * the target task with the specified port name.
895: * [If the name is in use, or the target task already
896: * has another name for the specified port, then
897: * the operation will fail.]
898: */
899: routine port_insert_send(
900: #ifdef MACH_IPC_FLAVOR
901: task : ipc_space_t;
902: #else /* MACH_IPC_FLAVOR */
903: task : task_t;
904: #endif /* MACH_IPC_FLAVOR */
905: my_port : port_t;
906: his_name : port_name_t);
907:
908: /*
909: * Returns send rights for the named port in the
910: * target task, removing that port name and port
911: * send rights from the target task. [If the
912: * target task holds receive rights for this port,
913: * the operation will fail.]
914: */
915: routine port_extract_send(
916: #ifdef MACH_IPC_FLAVOR
917: task : ipc_space_t;
918: #else /* MACH_IPC_FLAVOR */
919: task : task_t;
920: #endif /* MACH_IPC_FLAVOR */
921: his_name : port_name_t;
922: out his_port : port_t);
923:
924: /*
925: * Insert receive rights for the specified port into
926: * the target task with the specified port name.
927: * [If the name is in use, or the target task already
928: * has another name for the specified port, then
929: * the operation will fail.
930: */
931: routine port_insert_receive(
932: #ifdef MACH_IPC_FLAVOR
933: task : ipc_space_t;
934: #else /* MACH_IPC_FLAVOR */
935: task : task_t;
936: #endif /* MACH_IPC_FLAVOR */
937: my_port : port_all_t;
938: his_name : port_name_t);
939:
940: /*
941: * Returns receive rights for the named port in the
942: * target task, removing that port name and all port
943: * rights from the target task.
944: */
945: routine port_extract_receive(
946: #ifdef MACH_IPC_FLAVOR
947: task : ipc_space_t;
948: #else /* MACH_IPC_FLAVOR */
949: task : task_t;
950: #endif /* MACH_IPC_FLAVOR */
951: his_name : port_name_t;
952: out his_port : port_all_t);
953:
954: #ifdef MACH_IPC_FLAVOR_and_XP
955: /*
956: * Map a user-defined memory object into the virtual address
957: * space of the target task. If desired (anywhere is TRUE),
958: * the kernel will find a suitable address range of the
959: * specified size; else, the specific address will be allocated.
960: *
961: * The beginning address of the range will be aligned on a virtual
962: * page boundary, be at or beyond the address specified, and
963: * meet the mask requirements (bits turned on in the mask must not
964: * be turned on in the result); the size of the range, in bytes,
965: * will be rounded up to an integral number of virtual pages.
966: *
967: * The memory in the resulting range will be associated with the
968: * specified memory object, with the beginning of the memory range
969: * referring to the specified offset into the memory object.
970: *
971: * The mapping will take the current and maximum protections and
972: * the inheritance attributes specified; see the vm_protect and
973: * vm_inherit calls for a description of these attributes.
974: *
975: * If desired (copy is TRUE), the memory range will be filled
976: * with a copy of the data from the memory object; this copy will
977: * be private to this mapping in this target task. Otherwise,
978: * the memory in this mapping will be shared with other mappings
979: * of the same memory object at the same offset (in this task or
980: * in other tasks). [The Mach kernel only enforces shared memory
981: * consistency among mappings on one host with similar page alignments.
982: * The user-defined memory manager for this object is responsible
983: * for further consistency.]
984: */
985: routine vm_map(
986: target_task : vm_task_t;
987: inout address : vm_address_t;
988: size : vm_size_t;
989: mask : vm_address_t;
990: anywhere : boolean_t;
991: memory_object : memory_object_t;
992: offset : vm_offset_t;
993: copy : boolean_t;
994: cur_protection : vm_prot_t;
995: max_protection : vm_prot_t;
996: inheritance : vm_inherit_t);
997: #else /* MACH_IPC_FLAVOR */
998: skip; /* vm_map */
999: #endif /* MACH_IPC_FLAVOR */
1000:
1001: #ifdef MACH_IPC_FLAVOR_and_XP
1002: /*
1003: * Indicate that a range of the specified memory object cannot
1004: * be provided at this time. [Threads waiting for memory pages
1005: * specified by this call will experience a memory exception.
1006: * Only threads waiting at the time of the call are affected.]
1007: */
1008: simpleroutine memory_object_data_error(
1009: memory_control : memory_object_control_t;
1010: offset : vm_offset_t;
1011: size : vm_size_t;
1012: error_value : kern_return_t);
1013: #else /* MACH_IPC_FLAVOR */
1014: skip; /* memory_object_data_error */
1015: #endif /* MACH_IPC_FLAVOR */
1016:
1017: #ifdef MACH_IPC_FLAVOR_and_XP
1018: /*
1019: * Make decisions regarding the use of the specified
1020: * memory object.
1021: */
1022: simpleroutine memory_object_set_attributes(
1023: memory_control : memory_object_control_t;
1024: object_ready : boolean_t;
1025: may_cache : boolean_t;
1026: copy_strategy : memory_object_copy_strategy_t);
1027: #else /* MACH_IPC_FLAVOR */
1028: skip; /* memory_object_set_attributes */
1029: #endif /* MACH_IPC_FLAVOR */
1030:
1031: #ifdef MACH_IPC_FLAVOR_and_XP
1032: /*
1033: */
1034: simpleroutine memory_object_destroy(
1035: memory_control : memory_object_control_t;
1036: reason : kern_return_t);
1037: #else /* MACH_IPC_FLAVOR */
1038: skip; /* memory_object_destroy */
1039: #endif /* MACH_IPC_FLAVOR */
1040:
1041: #ifdef MACH_IPC_FLAVOR_and_XP
1042: /*
1043: * Provide the data contents of a range of the given memory
1044: * object, with the access restriction specified, optional
1045: * precious attribute, and reply message. [Only
1046: * whole virtual pages of data can be accepted; partial pages
1047: * will be discarded. Data should be provided on request, but
1048: * may be provided in advance as desired. When data already
1049: * held by this kernel is provided again, the new data is ignored.
1050: * The access restriction is the subset of {read, write, execute}
1051: * which are prohibited. The kernel may not provide any data (or
1052: * protection) consistency among pages with different virtual page
1053: * alignments within the same object. The precious value controls
1054: * how the kernel treats the data. If it is FALSE, the kernel treats
1055: * its copy as a temporary and may throw it away if it hasn't been
1056: * changed. If the precious value is TRUE, the kernel treats its
1057: * copy as a data repository and promises to return it to the manager;
1058: * the manager may tell the kernel to throw it away instead by flushing
1059: * and not cleaning the data -- see memory_object_lock_request. The
1060: * reply_to port is for a compeletion message; it will be
1061: * memory_object_supply_completed.]
1062: */
1063: simpleroutine memory_object_data_supply(
1064: memory_control : memory_object_control_t;
1065: offset : vm_offset_t;
1066: data : pointer_t, Dealloc[];
1067: lock_value : vm_prot_t;
1068: precious : boolean_t;
1069: reply_to : mach_port_t =
1070: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
1071: #else /* MACH_IPC_FLAVOR */
1072: skip; /* memory_object_data_supply */
1073: #endif /* MACH_IPC_FLAVOR */
1074:
1075: #ifdef MACH_IPC_FLAVOR_and_XP
1076: /*
1077: */
1078: simpleroutine memory_object_ready(
1079: memory_control : memory_object_control_t;
1080: may_cache : boolean_t;
1081: copy_strategy : memory_object_copy_strategy_t);
1082: #else /* MACH_IPC_FLAVOR */
1083: skip; /* memory_object_ready */
1084: #endif /* MACH_IPC_FLAVOR */
1085:
1086: #ifdef MACH_IPC_FLAVOR_and_XP
1087: /*
1088: */
1089: simpleroutine memory_object_change_attributes(
1090: memory_control : memory_object_control_t;
1091: may_cache : boolean_t;
1092: copy_strategy : memory_object_copy_strategy_t;
1093: reply_to : mach_port_t =
1094: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
1095: #else /* MACH_IPC_FLAVOR */
1096: skip; /* memory_object_change_attributes */
1097: #endif /* MACH_IPC_FLAVOR */
1098:
1099: skip; /* old host_callout_statistics_reset */
1100: skip; /* old port_set_select */
1101:
1102: /*
1103: * Sets a backup port for the named port. The task
1104: * must have receive rights for the named port.
1105: * Returns the previous backup port, if any.
1106: */
1107: routine port_set_backup(
1108: #ifdef MACH_IPC_FLAVOR
1109: task : ipc_space_t;
1110: #else /* MACH_IPC_FLAVOR */
1111: task : task_t;
1112: #endif /* MACH_IPC_FLAVOR */
1113: port_name : port_name_t;
1114: #ifdef NEW_IPC_IPC
1115: backup : port_t = MACH_MSG_TYPE_MAKE_SEND
1116: ctype: mach_port_t;
1117: #else /* MACH_IPC_FLAVOR */
1118: backup : port_t;
1119: #endif /* MACH_IPC_FLAVOR */
1120: out previous : port_t);
1121:
1122: /*
1123: * Set/Get special properties of memory associated
1124: * to some virtual address range, such as cachability,
1125: * migrability, replicability. Machine-dependent.
1126: */
1127: routine vm_machine_attribute(
1128: target_task : vm_task_t;
1129: address : vm_address_t;
1130: size : vm_size_t;
1131: attribute : vm_machine_attribute_t;
1132: inout value : vm_machine_attribute_val_t);
1133:
1134: skip; /* old host_fpa_counters_reset */
1135:
1136: /*
1137: * There is no more room in this interface for additional calls.
1138: */
1139:
1140: /* HMM .... */
1141:
1142: /*
1143: * Synchronize the contents of an address space with backing store.
1144: * Dirty pages in the address range are written to their appropriate
1145: * backing store. All pageouts are attempted. If any pageout causes
1146: * an error, vm_synchronize returns KERN_FAILURE. If a page would be
1147: * written to the default pager (swapfile), that page is skipped and
1148: * KERN_FAILURE is returned. This call is synchronous.
1149: */
1150: routine vm_synchronize(
1151: target_task : vm_task_t;
1152: address : vm_address_t;
1153: size : vm_size_t);
1154:
1155: routine vm_set_policy(
1156: target_task : vm_task_t;
1157: address : vm_address_t;
1158: size : vm_size_t;
1159: policy : int);
1160:
1161: routine vm_deactivate(
1162: target_task : vm_task_t;
1163: address : vm_address_t;
1164: size : vm_size_t;
1165: when : int);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.