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