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