|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University.
4: * Copyright (c) 1993,1994 The University of Utah and
5: * the Computer Systems Laboratory (CSL).
6: * All rights reserved.
7: *
8: * Permission to use, copy, modify and distribute this software and its
9: * documentation is hereby granted, provided that both the copyright
10: * notice and this permission notice appear in all copies of the
11: * software, derivative works or modified versions, and any portions
12: * thereof, and that both notices appear in supporting documentation.
13: *
14: * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
15: * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
16: * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
17: * THIS SOFTWARE.
18: *
19: * Carnegie Mellon requests users of this software to return to
20: *
21: * Software Distribution Coordinator or [email protected]
22: * School of Computer Science
23: * Carnegie Mellon University
24: * Pittsburgh PA 15213-3890
25: *
26: * any improvements or extensions that they make and grant Carnegie Mellon
27: * the rights to redistribute these changes.
28: */
29: /*
30: * Matchmaker definitions file for Mach kernel interface.
31: */
32:
33: subsystem
34: #if KERNEL_USER
35: KernelUser
36: #endif /* KERNEL_USER */
37: #if KERNEL_SERVER
38: KernelServer
39: #endif /* KERNEL_SERVER */
40: mach 2000;
41:
42: #ifdef KERNEL_USER
43: userprefix r_;
44: #endif /* KERNEL_USER */
45:
46: #include <mach/std_types.defs>
47: #include <mach/mach_types.defs>
48:
1.1.1.4 ! root 49: #ifdef MACH_IMPORTS
! 50: MACH_IMPORTS
! 51: #endif
! 52:
1.1 root 53: skip; /* old port_allocate */
54: skip; /* old port_deallocate */
55: skip; /* old port_enable */
56: skip; /* old port_disable */
57: skip; /* old port_select */
58: skip; /* old port_set_backlog */
59: skip; /* old port_status */
60:
61: /*
62: * Create a new task with an empty set of IPC rights,
63: * and having an address space constructed from the
64: * target task (or empty, if inherit_memory is FALSE).
65: */
66: routine task_create(
67: target_task : task_t;
68: inherit_memory : boolean_t;
69: out child_task : task_t);
70:
71: /*
72: * Destroy the target task, causing all of its threads
73: * to be destroyed, all of its IPC rights to be deallocated,
74: * and all of its address space to be deallocated.
75: */
76: routine task_terminate(
77: target_task : task_t);
78:
79: /*
80: * Get user-level handler entry points for all
81: * emulated system calls.
82: */
83: routine task_get_emulation_vector(
84: task : task_t;
85: out vector_start : int;
86: out emulation_vector: emulation_vector_t);
87:
88: /*
89: * Establish user-level handlers for the specified
90: * system calls. Non-emulated system calls are specified
91: * with emulation_vector[i] == EML_ROUTINE_NULL.
92: */
93: routine task_set_emulation_vector(
94: task : task_t;
95: vector_start : int;
96: emulation_vector: emulation_vector_t);
97:
98:
99: /*
100: * Returns the set of threads belonging to the target task.
101: */
102: routine task_threads(
103: target_task : task_t;
104: out thread_list : thread_array_t);
105:
106: /*
107: * Returns information about the target task.
108: */
109: routine task_info(
110: target_task : task_t;
111: flavor : int;
112: out task_info_out : task_info_t, CountInOut);
113:
114:
115: skip; /* old task_status */
116: skip; /* old task_set_notify */
117: skip; /* old thread_create */
118:
119: /*
120: * Destroy the target thread.
121: */
122: routine thread_terminate(
123: target_thread : thread_t);
124:
125: /*
126: * Return the selected state information for the target
127: * thread. If the thread is currently executing, the results
128: * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
129: * list of valid flavors for the target thread.]
130: */
131: routine thread_get_state(
132: target_thread : thread_t;
133: flavor : int;
134: out old_state : thread_state_t, CountInOut);
135:
136: /*
137: * Set the selected state information for the target thread.
138: * If the thread is currently executing, the state change
139: * may be ill-defined.
140: */
141: routine thread_set_state(
142: target_thread : thread_t;
143: flavor : int;
144: new_state : thread_state_t);
145:
146: /*
147: * Returns information about the target thread.
148: */
149: routine thread_info(
150: target_thread : thread_t;
151: flavor : int;
152: out thread_info_out : thread_info_t, CountInOut);
153:
154: skip; /* old thread_mutate */
155:
156: /*
157: * Allocate zero-filled memory in the address space
158: * of the target task, either at the specified address,
159: * or wherever space can be found (if anywhere is TRUE),
160: * of the specified size. The address at which the
161: * allocation actually took place is returned.
162: */
163: #ifdef EMULATOR
164: skip; /* the emulator redefines vm_allocate using vm_map */
1.1.1.2 root 165: #else /* EMULATOR */
1.1 root 166: routine vm_allocate(
167: target_task : vm_task_t;
168: inout address : vm_address_t;
169: size : vm_size_t;
170: anywhere : boolean_t);
1.1.1.2 root 171: #endif /* EMULATOR */
1.1 root 172:
173: skip; /* old vm_allocate_with_pager */
174:
175: /*
176: * Deallocate the specified range from the virtual
177: * address space of the target task.
178: */
179: routine vm_deallocate(
180: target_task : vm_task_t;
181: address : vm_address_t;
182: size : vm_size_t);
183:
184: /*
185: * Set the current or maximum protection attribute
186: * for the specified range of the virtual address
187: * space of the target task. The current protection
188: * limits the memory access rights of threads within
189: * the task; the maximum protection limits the accesses
190: * that may be given in the current protection.
191: * Protections are specified as a set of {read, write, execute}
192: * *permissions*.
193: */
194: routine vm_protect(
195: target_task : vm_task_t;
196: address : vm_address_t;
197: size : vm_size_t;
198: set_maximum : boolean_t;
199: new_protection : vm_prot_t);
200:
201: /*
202: * Set the inheritance attribute for the specified range
203: * of the virtual address space of the target task.
204: * The inheritance value is one of {none, copy, share}, and
205: * specifies how the child address space should acquire
206: * this memory at the time of a task_create call.
207: */
208: routine vm_inherit(
209: target_task : vm_task_t;
210: address : vm_address_t;
211: size : vm_size_t;
212: new_inheritance : vm_inherit_t);
213:
214: /*
215: * Returns the contents of the specified range of the
216: * virtual address space of the target task. [The
217: * range must be aligned on a virtual page boundary,
218: * and must be a multiple of pages in extent. The
219: * protection on the specified range must permit reading.]
220: */
221: routine vm_read(
222: target_task : vm_task_t;
223: address : vm_address_t;
224: size : vm_size_t;
225: out data : pointer_t);
226:
227: /*
228: * Writes the contents of the specified range of the
229: * virtual address space of the target task. [The
230: * range must be aligned on a virtual page boundary,
231: * and must be a multiple of pages in extent. The
232: * protection on the specified range must permit writing.]
233: */
234: routine vm_write(
235: target_task : vm_task_t;
236: address : vm_address_t;
237: data : pointer_t);
238:
239: /*
240: * Copy the contents of the source range of the virtual
241: * address space of the target task to the destination
242: * range in that same address space. [Both of the
243: * ranges must be aligned on a virtual page boundary,
244: * and must be multiples of pages in extent. The
245: * protection on the source range must permit reading,
246: * and the protection on the destination range must
247: * permit writing.]
248: */
249: routine vm_copy(
250: target_task : vm_task_t;
251: source_address : vm_address_t;
252: size : vm_size_t;
253: dest_address : vm_address_t);
254:
255: /*
256: * Returns information about the contents of the virtual
257: * address space of the target task at the specified
258: * address. The returned protection, inheritance, sharing
259: * and memory object values apply to the entire range described
260: * by the address range returned; the memory object offset
261: * corresponds to the beginning of the address range.
262: * [If the specified address is not allocated, the next
263: * highest address range is described. If no addresses beyond
264: * the one specified are allocated, the call returns KERN_NO_SPACE.]
265: */
266: routine vm_region(
267: target_task : vm_task_t;
268: inout address : vm_address_t;
269: out size : vm_size_t;
270: out protection : vm_prot_t;
271: out max_protection : vm_prot_t;
272: out inheritance : vm_inherit_t;
273: out is_shared : boolean_t;
274: /* avoid out-translation of the argument */
275: out object_name : memory_object_name_t =
276: MACH_MSG_TYPE_MOVE_SEND
277: ctype: mach_port_t;
278: out offset : vm_offset_t);
279:
280: /*
281: * Return virtual memory statistics for the host
282: * on which the target task resides. [Note that the
283: * statistics are not specific to the target task.]
284: */
285: routine vm_statistics(
286: target_task : vm_task_t;
287: out vm_stats : vm_statistics_data_t);
288:
289: skip; /* old task_by_u*x_pid */
290: skip; /* old vm_pageable */
291:
292: /*
293: * Stash a handful of ports for the target task; child
294: * tasks inherit this stash at task_create time.
295: */
296: routine mach_ports_register(
297: target_task : task_t;
298: init_port_set : mach_port_array_t =
299: ^array[] of mach_port_t);
300:
301: /*
302: * Retrieve the stashed ports for the target task.
303: */
304: routine mach_ports_lookup(
305: target_task : task_t;
306: out init_port_set : mach_port_array_t =
307: ^array[] of mach_port_t);
308:
309: skip; /* old u*x_pid */
310: skip; /* old netipc_listen */
311: skip; /* old netipc_ignore */
312:
313: /*
314: * Provide the data contents of a range of the given memory
315: * object, with the access restriction specified. [Only
316: * whole virtual pages of data can be accepted; partial pages
317: * will be discarded. Data should be provided on request, but
318: * may be provided in advance as desired. When data already
319: * held by this kernel is provided again, the new data is ignored.
320: * The access restriction is the subset of {read, write, execute}
321: * which are prohibited. The kernel may not provide any data (or
322: * protection) consistency among pages with different virtual page
323: * alignments within the same object.]
324: */
325: simpleroutine memory_object_data_provided(
326: memory_control : memory_object_control_t;
327: offset : vm_offset_t;
328: data : pointer_t;
329: lock_value : vm_prot_t);
330:
331: /*
332: * Indicate that a range of the given temporary memory object does
333: * not exist, and that the backing memory object should be used
334: * instead (or zero-fill memory be used, if no backing object exists).
335: * [This call is intended for use only by the default memory manager.
336: * It should not be used to indicate a real error --
337: * memory_object_data_error should be used for that purpose.]
338: */
339: simpleroutine memory_object_data_unavailable(
340: memory_control : memory_object_control_t;
341: offset : vm_offset_t;
342: size : vm_size_t);
343:
344: /*
345: * Retrieves the attributes currently associated with
346: * a memory object.
347: */
348: routine memory_object_get_attributes(
349: memory_control : memory_object_control_t;
350: out object_ready : boolean_t;
351: out may_cache : boolean_t;
352: out copy_strategy : memory_object_copy_strategy_t);
353:
354: /*
355: * Sets the default memory manager, the port to which
356: * newly-created temporary memory objects are delivered.
357: * [See (memory_object_default)memory_object_create.]
358: * The old memory manager port is returned.
359: */
360: routine vm_set_default_memory_manager(
361: host_priv : host_priv_t;
362: inout default_manager : mach_port_make_send_t);
363:
364: skip; /* old pager_flush_request */
365:
366: /*
367: * Control use of the data associated with the given
368: * memory object. For each page in the given range,
369: * perform the following operations, in order:
370: * 1) restrict access to the page (disallow
371: * forms specified by "prot");
372: * 2) write back modifications (if "should_return"
373: * is RETURN_DIRTY and the page is dirty, or
374: * "should_return" is RETURN_ALL and the page
375: * is either dirty or precious); and,
376: * 3) flush the cached copy (if "should_flush"
377: * is asserted).
378: * The set of pages is defined by a starting offset
379: * ("offset") and size ("size"). Only pages with the
380: * same page alignment as the starting offset are
381: * considered.
382: *
383: * A single acknowledgement is sent (to the "reply_to"
384: * port) when these actions are complete.
385: *
386: * There are two versions of this routine because IPC distinguishes
387: * between booleans and integers (a 2-valued integer is NOT a
388: * boolean). The new routine is backwards compatible at the C
389: * language interface.
390: */
391:
1.1.1.3 root 392: skip; /* old xxx_memory_object_lock_request */
1.1 root 393:
394: simpleroutine memory_object_lock_request(
395: memory_control : memory_object_control_t;
396: offset : vm_offset_t;
397: size : vm_size_t;
398: should_return : memory_object_return_t;
399: should_flush : boolean_t;
400: lock_value : vm_prot_t;
401: reply_to : mach_port_t =
402: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
403:
1.1.1.3 root 404: skip; /* old xxx_task_get_emulation_vector */
405: skip; /* old xxx_task_set_emulation_vector */
406: skip; /* old xxx_host_info */
407: skip; /* old xxx_slot_info */
408: skip; /* old xxx_cpu_control */
1.1 root 409: skip; /* old thread_statistics */
410: skip; /* old task_statistics */
411: skip; /* old netport_init */
412: skip; /* old netport_enter */
413: skip; /* old netport_remove */
414: skip; /* old thread_set_priority */
415:
416: /*
417: * Increment the suspend count for the target task.
418: * No threads within a task may run when the suspend
419: * count for that task is non-zero.
420: */
421: routine task_suspend(
422: target_task : task_t);
423:
424: /*
425: * Decrement the suspend count for the target task,
426: * if the count is currently non-zero. If the resulting
427: * suspend count is zero, then threads within the task
428: * that also have non-zero suspend counts may execute.
429: */
430: routine task_resume(
431: target_task : task_t);
432:
433: /*
434: * Returns the current value of the selected special port
435: * associated with the target task.
436: */
437: routine task_get_special_port(
438: task : task_t;
439: which_port : int;
440: out special_port : mach_port_t);
441:
442: /*
443: * Set one of the special ports associated with the
444: * target task.
445: */
446: routine task_set_special_port(
447: task : task_t;
448: which_port : int;
449: special_port : mach_port_t);
450:
1.1.1.3 root 451: skip; /* old xxx_task_info */
1.1 root 452:
453:
454: /*
455: * Create a new thread within the target task, returning
456: * the port representing that new thread. The
457: * initial execution state of the thread is undefined.
458: */
459: routine thread_create(
460: parent_task : task_t;
461: out child_thread : thread_t);
462:
463: /*
464: * Increment the suspend count for the target thread.
465: * Once this call has completed, the thread will not
466: * execute any further user or meta- instructions.
467: * Once suspended, a thread may not execute again until
468: * its suspend count is zero, and the suspend count
469: * for its task is also zero.
470: */
471: routine thread_suspend(
472: target_thread : thread_t);
473:
474: /*
475: * Decrement the suspend count for the target thread,
476: * if that count is not already zero.
477: */
478: routine thread_resume(
479: target_thread : thread_t);
480:
481: /*
482: * Cause any user or meta- instructions currently being
483: * executed by the target thread to be aborted. [Meta-
484: * instructions consist of the basic traps for IPC
485: * (e.g., msg_send, msg_receive) and self-identification
486: * (e.g., task_self, thread_self, thread_reply). Calls
487: * described by MiG interfaces are not meta-instructions
488: * themselves.]
489: */
490: routine thread_abort(
491: target_thread : thread_t);
492:
1.1.1.3 root 493: skip; /* old xxx_thread_get_state */
494: skip; /* old xxx_thread_set_state */
1.1 root 495:
496: /*
497: * Returns the current value of the selected special port
498: * associated with the target thread.
499: */
500: routine thread_get_special_port(
501: thread : thread_t;
502: which_port : int;
503: out special_port : mach_port_t);
504:
505: /*
506: * Set one of the special ports associated with the
507: * target thread.
508: */
509: routine thread_set_special_port(
510: thread : thread_t;
511: which_port : int;
512: special_port : mach_port_t);
513:
1.1.1.3 root 514: skip; /* old xxx_thread_info */
1.1 root 515:
516: /*
517: * Establish a user-level handler for the specified
518: * system call.
519: */
520: routine task_set_emulation(
521: target_port : task_t;
522: routine_entry_pt: vm_address_t;
1.1.1.2 root 523: routine_number : int);
1.1 root 524:
525: /*
526: * Establish restart pc for interrupted atomic sequences.
527: * This reuses the message number for the old task_get_io_port.
528: * See task_info.h for description of flavors.
1.1.1.2 root 529: *
1.1 root 530: */
531: routine task_ras_control(
532: target_task : task_t;
533: basepc : vm_address_t;
534: boundspc : vm_address_t;
535: flavor : int);
1.1.1.2 root 536:
537:
1.1 root 538:
539: skip; /* old host_ipc_statistics */
540: skip; /* old port_names */
541: skip; /* old port_type */
542: skip; /* old port_rename */
543: skip; /* old port_allocate */
544: skip; /* old port_deallocate */
545: skip; /* old port_set_backlog */
546: skip; /* old port_status */
547: skip; /* old port_set_allocate */
548: skip; /* old port_set_deallocate */
549: skip; /* old port_set_add */
550: skip; /* old port_set_remove */
551: skip; /* old port_set_status */
552: skip; /* old port_insert_send */
553: skip; /* old port_extract_send */
554: skip; /* old port_insert_receive */
555: skip; /* old port_extract_receive */
556:
557: /*
558: * Map a user-defined memory object into the virtual address
559: * space of the target task. If desired (anywhere is TRUE),
560: * the kernel will find a suitable address range of the
561: * specified size; else, the specific address will be allocated.
562: *
563: * The beginning address of the range will be aligned on a virtual
564: * page boundary, be at or beyond the address specified, and
565: * meet the mask requirements (bits turned on in the mask must not
566: * be turned on in the result); the size of the range, in bytes,
567: * will be rounded up to an integral number of virtual pages.
568: *
569: * The memory in the resulting range will be associated with the
570: * specified memory object, with the beginning of the memory range
571: * referring to the specified offset into the memory object.
572: *
573: * The mapping will take the current and maximum protections and
574: * the inheritance attributes specified; see the vm_protect and
575: * vm_inherit calls for a description of these attributes.
576: *
577: * If desired (copy is TRUE), the memory range will be filled
578: * with a copy of the data from the memory object; this copy will
579: * be private to this mapping in this target task. Otherwise,
580: * the memory in this mapping will be shared with other mappings
581: * of the same memory object at the same offset (in this task or
582: * in other tasks). [The Mach kernel only enforces shared memory
583: * consistency among mappings on one host with similar page alignments.
584: * The user-defined memory manager for this object is responsible
585: * for further consistency.]
586: */
587: #ifdef EMULATOR
588: routine htg_vm_map(
589: target_task : vm_task_t;
590: ureplyport reply_port : mach_port_make_send_once_t;
591: inout address : vm_address_t;
592: size : vm_size_t;
593: mask : vm_address_t;
594: anywhere : boolean_t;
595: memory_object : memory_object_t;
596: offset : vm_offset_t;
597: copy : boolean_t;
598: cur_protection : vm_prot_t;
599: max_protection : vm_prot_t;
600: inheritance : vm_inherit_t);
1.1.1.2 root 601: #else /* EMULATOR */
1.1 root 602: routine vm_map(
603: target_task : vm_task_t;
604: inout address : vm_address_t;
605: size : vm_size_t;
606: mask : vm_address_t;
607: anywhere : boolean_t;
608: memory_object : memory_object_t;
609: offset : vm_offset_t;
610: copy : boolean_t;
611: cur_protection : vm_prot_t;
612: max_protection : vm_prot_t;
613: inheritance : vm_inherit_t);
1.1.1.2 root 614: #endif /* EMULATOR */
1.1 root 615:
616: /*
617: * Indicate that a range of the specified memory object cannot
618: * be provided at this time. [Threads waiting for memory pages
619: * specified by this call will experience a memory exception.
620: * Only threads waiting at the time of the call are affected.]
621: */
622: simpleroutine memory_object_data_error(
623: memory_control : memory_object_control_t;
624: offset : vm_offset_t;
625: size : vm_size_t;
626: error_value : kern_return_t);
627:
628: /*
629: * Make decisions regarding the use of the specified
630: * memory object.
631: */
632: simpleroutine memory_object_set_attributes(
633: memory_control : memory_object_control_t;
634: object_ready : boolean_t;
635: may_cache : boolean_t;
636: copy_strategy : memory_object_copy_strategy_t);
637:
638: /*
639: */
640: simpleroutine memory_object_destroy(
641: memory_control : memory_object_control_t;
642: reason : kern_return_t);
643:
644: /*
645: * Provide the data contents of a range of the given memory
646: * object, with the access restriction specified, optional
647: * precious attribute, and reply message. [Only
648: * whole virtual pages of data can be accepted; partial pages
649: * will be discarded. Data should be provided on request, but
650: * may be provided in advance as desired. When data already
651: * held by this kernel is provided again, the new data is ignored.
652: * The access restriction is the subset of {read, write, execute}
653: * which are prohibited. The kernel may not provide any data (or
654: * protection) consistency among pages with different virtual page
655: * alignments within the same object. The precious value controls
656: * how the kernel treats the data. If it is FALSE, the kernel treats
657: * its copy as a temporary and may throw it away if it hasn't been
658: * changed. If the precious value is TRUE, the kernel treats its
659: * copy as a data repository and promises to return it to the manager;
660: * the manager may tell the kernel to throw it away instead by flushing
661: * and not cleaning the data -- see memory_object_lock_request. The
662: * reply_to port is for a compeletion message; it will be
663: * memory_object_supply_completed.]
664: */
665:
666: simpleroutine memory_object_data_supply(
667: memory_control : memory_object_control_t;
668: offset : vm_offset_t;
669: data : pointer_t, Dealloc[];
670: lock_value : vm_prot_t;
671: precious : boolean_t;
672: reply_to : mach_port_t =
673: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
674:
675: simpleroutine memory_object_ready(
676: memory_control : memory_object_control_t;
677: may_cache : boolean_t;
678: copy_strategy : memory_object_copy_strategy_t);
679:
680: simpleroutine memory_object_change_attributes(
681: memory_control : memory_object_control_t;
682: may_cache : boolean_t;
683: copy_strategy : memory_object_copy_strategy_t;
684: reply_to : mach_port_t =
685: MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
686:
687: skip; /* old host_callout_statistics_reset */
688: skip; /* old port_set_select */
689: skip; /* old port_set_backup */
690:
691: /*
692: * Set/Get special properties of memory associated
1.1.1.2 root 693: * to some virtual address range, such as cachability,
1.1 root 694: * migrability, replicability. Machine-dependent.
695: */
696: routine vm_machine_attribute(
697: target_task : vm_task_t;
698: address : vm_address_t;
699: size : vm_size_t;
700: attribute : vm_machine_attribute_t;
701: inout value : vm_machine_attribute_val_t);
702:
703: skip; /* old host_fpa_counters_reset */
704:
705: /*
706: * There is no more room in this interface for additional calls.
707: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.