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