home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / mach / mach.defs < prev    next >
Text File  |  1991-08-16  |  30KB  |  1,046 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * All rights reserved.  The CMU software License Agreement specifies
  6.  * the terms and conditions for use and redistribution.
  7.  */
  8. /*
  9.  * HISTORY
  10.  * $Log:    mach.defs,v $
  11.  * 15-Aug-91    Gregg Kellogg (gk) at NeX!2F    Got rid of MACH_IPC_XXXHACK and uimport of <mach/mach_extra.h>
  12.  *
  13.  * Revision 2.11  89/10/11  14:37:34  dlb
  14.  *     Prefix host_info, slot_info, and cpu_control with xxx.
  15.  *     [88/11/28            dlb]
  16.  * 
  17.  * Revision 2.10  89/10/10  22:50:52  mwyoung
  18.  *     Move memory_object_get_attributes and
  19.  *     vm_set_default_memory_manager to unused msg IDs within the
  20.  *     mach subsystem ID range (they had been OUTSIDE the range).
  21.  *     Msg IDs used belong to the obsolete calls pager_data_lock
  22.  *     and pager_clean_request (removed as of 21-Jan-88, before the
  23.  *     external pager interface was even in experimental use).
  24.  * 
  25.  *     WARNING! There are NO more msg IDs left at the end of this
  26.  *     subsystem.
  27.  *     [89/09/06            dbg]
  28.  * 
  29.  * Revision 2.9  89/10/10  10:55:28  mwyoung
  30.  *     Correct the documentation for memory_object_lock_request().
  31.  *     [89/08/10            mwyoung]
  32.  * 
  33.  * Revision 2.8  89/05/06  02:57:49  rpd
  34.  *     Purged <kern/task_statistics.h>, <kern/thread_statistics.h>.
  35.  *     [89/05/05  20:43:26  rpd]
  36.  * 
  37.  * Revision 2.7  89/05/01  17:02:43  rpd
  38.  *     Do not define KERNEL_SERVER here; it is passed in now.
  39.  *     Removed port_set_select.
  40.  *     [89/05/01  14:52:15  rpd]
  41.  * 
  42.  * Revision 2.6  89/04/18  16:43:24  mwyoung
  43.  *     Add memory_object_get_attributes, vm_set_default_memory_manager.
  44.  *     [89/04/07            mwyoung]
  45.  * 
  46.  * Revision 2.5  89/04/08  23:40:22  rpd
  47.  *     Added IsLong to the variabled-sized inline arguments of
  48.  *     task_info, thread_info, thread_set_state, thread_get_state.
  49.  *     [89/04/08  22:53:40  rpd]
  50.  * 
  51.  * Revision 2.4  89/03/09  20:20:28  rpd
  52.  *     More cleanup.
  53.  * 
  54.  * Revision 2.3  89/02/25  18:13:43  gm0w
  55.  *     Changes for cleanup.
  56.  * 
  57.  * Revision 2.2  89/01/15  16:30:12  rpd
  58.  *     Moved from kern/ to mach/.
  59.  *     [89/01/15  14:39:26  rpd]
  60.  * 
  61.  * Revision 2.19  89/01/12  07:56:49  rpd
  62.  *     Moved ipc_statistics, callout_info, callout_statistics, fpa_counters
  63.  *     calls out to other interface files.
  64.  *     [89/01/12  04:47:56  rpd]
  65.  * 
  66.  * Revision 2.18  89/01/10  23:31:31  rpd
  67.  *     Changed MACH_IPCSTATS to MACH_IPC_STATS.
  68.  *     Added MACH_IPC_XXXHACK, which enables the xxx_port_* calls.
  69.  *     [89/01/10  23:08:52  rpd]
  70.  * 
  71.  * Revision 2.17  89/01/04  13:36:35  rpd
  72.  *     Added host_fpa_counters and host_fpa_counters_reset calls.
  73.  *     These are conditional on ROMP_FPA_COUNT, which an RT option.
  74.  *     [89/01/01  15:02:29  rpd]
  75.  * 
  76.  * Revisio!2G16  88/10/18  03:21:19  mwyoung
  77.  *     All the host_info call to be made on any kernel-provided object.
  78.  *     [88/09/23            mwyoung]
  79.  * 
  80.  * Revision 2.15  88/10/18  00:29:45  mwyoung
  81.  *     Changed the formal parameters in port_names and port_type
  82.  *     to be different than the routine names. Lint doesn't like 
  83.  *     the code that was generated.
  84.  *     [88/10/17  16:55:57  mrt]
  85.  * 
  86.  * Revision 2.14  88/10/11  10:19:18  rpd
  87.  *     Added port_set_backup.
  88.  *     [88/10/11  08:04:46  rpd]
  89.  * 
  90.  * Revision 2.13  88/10/01  21:56:58  rpd
  91.  *     Removed the kernel keyword.
  92.  *     [88/10/01  21:29:02  rpd]
  93.  * 
  94.  * Revision 2.12  88/09/25  22:14:59  rpd
  95.  *     Added new port_set_select call, the port set equivalent of port_select.
  96.  *     [88/09/19  16:27:14  rpd]
  97.  *     
  98.  *     Changed includes to the new style.
  99.  *     Added host_ipc_statistics_reset, host_callout_info,
  100.  *     host_callout_statistics, host_callout_statistics_reset.
  101.  *     [88/09/09  04:45:02  rpd]
  102.  * 
  103.  * Revision 2.11  88/08/30  17:28:07  mwyoung
  104.  *     So that transition compatibility code can temporarily use the
  105.  *     "xxx_" forms of the IPC routines, change the tag on which the
  106.  *     calls are generated.
  107.  *     [88/08/30            mwyoung]
  108.  * 
  109.  * Revision 2.10  88/08/25  18:16:23  mwyoung
  110.  *     Corrected include file references.
  111.  *     [88/08/22            mwyoung]
  112.  *     
  113.  *     Fixed documentation of port_extract_receive, embellished
  114.  *     port_set_allocate.
  115.  *     [88/08/20  03:02:39  mwyoung]
  116.  *     
  117.  *     Fill in memory_object_destroy call.  Adjust documentation for
  118.  *     thread_get_state.
  119.  *     [88/08/11  18:46:11  mwyoung]
  120.  * 
  121.  * Revision 2.9  88/08/03  15:34:47  dorr
  122.  * Turn off mach_device by default.  put task_set_emulation
  123.  * inside mach_emulation ifdef instead of mach_device.
  124.  * 
  125.  * Revision 2.8  88/07/22  07:35:21  rpd
  126.  * Conditionalize host_ipc_statistics call on MACH_IPCSTATS.
  127.  * 
  128.  * Revision 2.7  88/07/21  12:04:01  rpd
  129.  * Changed conditional on task_set_emulation to MACH_EMULATION.
  130.  * 
  131.  * Revision 2.6  88/07/21  00:33:47  rpd
  132.  * Made kernel keyword dependent on KERNEL_SERVER.
  133.  * Removed import of kern/mach_types.h, which is now in mach_types.defs.
  134.  * 
  135.  * Revision 2.5  88/07/20  16:38:13  rpd
  136.  * Made new port & port_set calls standard.
  137.  * 
  138.  * Revision 2.4  88/07/18  16:51:04  mwyoung
  139.  * Add space for memory_object_destroy; put tags on "skip" lines.
  140.  * 
  141.  * Revision 2.3  88/07/17  19:33:26  mwyoung
  142.  * *** emp!2Hog message ***
  143.  * 
  144.  * Revision 2.2.2.2  88/07/04  15:33:50  mwyoung
  145.  * Convert to use memory_object_-style names for routines that
  146.  * are expected to last.
  147.  * 
  148.  * Moved data type declarations to "mach_types.defs".
  149.  * 
  150.  * Use new type names for memory management interface.
  151.  * 
  152.  * Change pager_attributes to memory_object_set_attributes, rework
  153.  * arguments.
  154.  * 
  155.  * Revision 2.2.2.1  88/06/28  20:34:57  mwyoung
  156.  * Added vm_map, pager_attributes, pager_data_error calls.
  157.  * Merged rpd's IPC changes.
  158.  * Use conditional compilation for experimental interface parts.
  159.  * Documented the calls.
  160.  * 
  161.  * 26-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
  162.  *    Document the calls.
  163.  *
  164.  * 26-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
  165.  *    Add pager_attributes.
  166.  *
  167.  * 19-Jun-88  Michael Young (mwyoung) at Carnegie-Mellon University
  168.  *    Added vm_map, pager_data_error.  Removed obsolete entries.
  169.  *
  170.  * 28-Jan-88 Douglas Orr (dorr) at Carnegie-Mellon University
  171.  *    Added task_set_emulation. Note that task_set_emulation
  172.  *    only works in kernels with the MACH_EMULATION attribute on.
  173.  *    task_get_ioport only works in kernels with the MACH_DEVICE
  174.  *    attribute on.
  175.  *
  176.  * 21-Jan-88  David Golub (dbg) at Carnegie-Mellon University
  177.  *    Added new thread and task interfaces.  Obsolete interfaces
  178.  *    are prefixed with 'xxx_' but remain (temporarily) for binary
  179.  *    compatibility.  Made task_create no longer return the task's
  180.  *    data port (it doesn't exist).  Removed obsolete external pager
  181.  *    interfaces (per mwyoung): pager_data_lock, pager_clean_request,
  182.  *    pager_flush_request.
  183.  *
  184.  *  3-Dec-87  David Golub (dbg) at Carnegie-Mellon University
  185.  *    Added deallocator functions for task_t, thread_t, vm_map_t.
  186.  *
  187.  * 18-Nov-87  Avadis Tevanian (avie) at Carnegie-Mellon University
  188.  *    Reset history.
  189.  *
  190.  */
  191. /*
  192.  *    Matchmaker definitions file for Mach kernel interface.
  193.  */
  194. #ifdef    KERNEL
  195. #include <mach_xp.h>
  196. #include <mach_net.h>
  197. #include <mach_np.h>
  198. #else
  199. #define MACH_XP            0
  200. #define MACH_NET        1
  201. #define MACH_NP            1
  202. #endif    KERNEL
  203.  
  204. subsystem mach 2000;
  205.  
  206. #include <mach/std_types.defs>
  207. #include <mach/mach_types.defs>
  208.  
  209. #if    KERNEL_USER
  210. uimport <mach/mach_user_internal.h>;
  211. #endif    KERNEL_USER
  212.  
  213. skip;            /* old port_allocate */
  214. skip;            /* old port_deallocate */
  215. skip;            /* old port_enable */
  216. skip;            /* old port_disable */
  217. skip;            /* old port_selec!2I
  218. skip;            /* old port_set_backlog */
  219. skip;            /* old port_status */
  220.  
  221. /*
  222.  *    Create a new task with an empty set of IPC rights,
  223.  *    and having an address space constructed from the
  224.  *    target task (or empty, if inherit_memory is FALSE).
  225.  */
  226. routine task_create(
  227.         target_task    : task_t;
  228.         inherit_memory    : boolean_t;
  229.     out    child_task    : task_t);
  230.  
  231. /*
  232.  *    Destroy the target task, causing all of its threads
  233.  *    to be destroyed, all of its IPC rights to be deallocated,
  234.  *    and all of its address space to be deallocated.
  235.  */
  236. routine task_terminate(
  237.         target_task    : task_t);
  238.  
  239. skip;            /* old task suspend */
  240. skip;            /* old task_resume */
  241.  
  242. /*
  243.  *    Returns the set of threads belonging to the target task.
  244.  */
  245. routine task_threads(
  246.         target_task    : task_t;
  247.     out    thread_list    : thread_array_t);
  248.  
  249. skip;        /* task_ports: OBSOLETE */
  250. skip;        /* old task_status */
  251. skip;        /* old task_set_notify */
  252. skip;        /* old thread_create */
  253.  
  254. /*
  255.  *    Destroy the target thread.
  256.  */
  257. routine thread_terminate(
  258.         target_thread    : thread_t);
  259.  
  260. skip;        /* old thread_suspend */
  261. skip;        /* old thread_resume */
  262. skip;        /* old thread_status */
  263. skip;        /* old thread_mutate */
  264.  
  265. /*
  266.  *    Allocate zero-filled memory in the address space
  267.  *    of the target task, either at the specified address,
  268.  *    or wherever space can be found (if anywhere is TRUE),
  269.  *    of the specified size.  The address at which the
  270.  *    allocation actually took place is returned.
  271.  */
  272. routine vm_allocate(
  273.         target_task    : vm_task_t;
  274.     inout    address        : vm_address_t;
  275.         size        : vm_size_t;
  276.         anywhere    : boolean_t);
  277.  
  278. #if    NeXT
  279. skip;    // No external pagers.
  280. #else    NeXT
  281. /*
  282.  *    Map the user-defined memory object
  283.  *    into the target task's address space.  OBSOLETE --
  284.  *    use vm_map instead.
  285.  */
  286. routine vm_allocate_with_pager(
  287.         target_task    : vm_task_t;
  288.     inout    address        : vm_address_t;
  289.         size        : vm_size_t;
  290.         anywhere    : boolean_t;
  291.         memory_object    : memory_object_t;
  292.         offset        : vm_offset_t);
  293. #endif    NeXT
  294.  
  295. /*
  296.  *    Deallocate the specified range from the virtual
  297.  *    address space of the target task.
  298.  */
  299. routine vm_deallocate(
  300.         target_task    : vm_task_t;
  301.         address        : vm_address_t;
  302.         size        : vm_size_t);
  303.  
  304. /*
  305.  *    Set the current or maximum protection attribute
  306.  *    for the specified range of the virtual address
  307.  *    space of the target task.  The current protection
  308.  *    limits the memory access rights of threads within
  309.  *    the task; the maximum protection limits !2Paccesses
  310.  *    that may be given in the current protection.
  311.  *    Protections are specified as a set of {read, write, execute}
  312.  *    *permissions*.
  313.  */
  314. routine vm_protect(
  315.         target_task    : vm_task_t;
  316.         address        : vm_address_t;
  317.         size        : vm_size_t;
  318.         set_maximum    : boolean_t;
  319.         new_protection    : vm_prot_t);
  320.  
  321. /*
  322.  *    Set the inheritance attribute for the specified range
  323.  *    of the virtual address space of the target task.
  324.  *    The inheritance value is one of {none, copy, share}, and
  325.  *    specifies how the child address space should acquire
  326.  *    this memory at the time of a task_create call.
  327.  */
  328. routine vm_inherit(
  329.         target_task    : vm_task_t;
  330.         address        : vm_address_t;
  331.         size        : vm_size_t;
  332.         new_inheritance    : vm_inherit_t);
  333.  
  334. /*
  335.  *    Returns the contents of the specified range of the
  336.  *    virtual address space of the target task.  [The
  337.  *    range must be aligned on a virtual page boundary,
  338.  *    and must be a multiple of pages in extent.  The
  339.  *    protection on the specified range must permit reading.]
  340.  */
  341. routine vm_read(
  342.         target_task    : vm_task_t;
  343.         address        : vm_address_t;
  344.         size        : vm_size_t;
  345.     out    data        : pointer_t);
  346.  
  347. /*
  348.  *    Writes the contents of the specified range of the
  349.  *    virtual address space of the target task.  [The
  350.  *    range must be aligned on a virtual page boundary,
  351.  *    and must be a multiple of pages in extent.  The
  352.  *    protection on the specified range must permit writing.]
  353.  */
  354. routine vm_write(
  355.         target_task    : vm_task_t;
  356.         address        : vm_address_t;
  357.         data        : pointer_t);
  358.  
  359. /*
  360.  *    Copy the contents of the source range the virtual
  361.  *    address space of the target task to the destination
  362.  *    range in that same address space.  [Both of the
  363.  *    ranges must be aligned on a virtual page boundary,
  364.  *    and must be multiples of pages in extent.  The
  365.  *    protection on the source range must permit reading,
  366.  *    and the protection on the destination range must
  367.  *    permit writing.]
  368.  */
  369. routine vm_copy(
  370.         target_task    : vm_task_t;
  371.         source_address    : vm_address_t;
  372.         size        : vm_size_t;
  373.         dest_address    : vm_address_t);
  374.  
  375. /*
  376.  *    Returns information about the contents of the virtual
  377.  *    address space of the target task at the specified
  378.  *    address.  The returned protection, inheritance, sharing
  379.  *    and memory object values apply to the entire range described
  380.  *    by the address range returned; the memory object offset
  381.  *    corresponds to the beginning of the address range.!2Q[If the specified address is not allocated, the next
  382.  *    highest address range is described.  If no addresses beyond
  383.  *    the one specified are allocated, the call returns KERN_NO_SPACE.]
  384.  */
  385. routine vm_region(
  386.         target_task    : vm_task_t;
  387.     inout    address        : vm_address_t;
  388.     out    size        : vm_size_t;
  389.     out    protection    : vm_prot_t;
  390.     out    max_protection    : vm_prot_t;
  391.     out    inheritance    : vm_inherit_t;
  392.     out    is_shared    : boolean_t;
  393.     out    object_name    : memory_object_name_t;
  394.     out    offset        : vm_offset_t);
  395.  
  396. /*
  397.  *    Return virtual memory statistics for the host
  398.  *    on which the target task resides.  [Note that the
  399.  *    statistics are not specific to the target task.]
  400.  */
  401. routine vm_statistics(
  402.         target_task    : vm_task_t;
  403.     out    vm_stats    : vm_statistics_data_t);
  404.  
  405. /* RUBBISH */
  406. routine task_by_unix_pid(
  407.         target_task    : task_t;
  408.         process_id    : int;
  409.     out    result_task    : task_t);
  410.  
  411. skip;    /* preserve numbering */
  412.  
  413. #if    NeXT
  414. skip;    /* no mach_ports_register() */
  415. skip;    /* no mach_ports_lookup() */
  416. #else    NeXT
  417. /*
  418.  *    Stash a handful of ports for the target task; child
  419.  *    tasks inherit this stash at task_create time.
  420.  */
  421. routine    mach_ports_register(
  422.         target_task    : task_t;
  423.         init_port_set    : port_array_t);
  424.         
  425. /*
  426.  *    Retrieve the stashed ports for the target task.
  427.  */
  428. routine    mach_ports_lookup(
  429.         target_task    : task_t;
  430.     out    init_port_set    : port_array_t);
  431. #endif    NeXT
  432.  
  433. /* GARBAGE */
  434. routine unix_pid(
  435.         target_task    : task_t;
  436.     out    process_id    : int);
  437.  
  438. #if    MACH_NET
  439. /*
  440.  *    Redirect network IP messages to the specified Mach port.
  441.  */
  442. routine netipc_listen(
  443.         request_port    : port_t;
  444.         src_addr    : int;
  445.         dst_addr    : int;
  446.         src_port    : int;
  447.         dst_port    : int;
  448.         protocol    : int;
  449.         ipc_port    : port_t);
  450.  
  451. /*
  452.  *    Stop IP message redirection as set up by netipc_listen.
  453.  */
  454. routine netipc_ignore(
  455.         request_port    : port_t;
  456.         ipc_port    : port_t);
  457. #else    MACH_NET
  458. skip;
  459. skip;
  460. #endif    MACH_NET
  461.  
  462. #if    MACH_XP
  463. /*
  464.  *    Provide the data contents of a range of the given memory
  465.  *    object, with the access restriction specified.  [Only
  466.  *    whole virtual pages of data can be accepted; partial pages
  467.  *    will be discarded.  Data should be provided on request, but
  468.  *    may be provided in advance as desired.  When data already
  469.  *    held by this kernel is provided again, the new data is ignored.
  470.  *    The access restriction is the subset of {read, write, execute}
  471.  *    which are prohibited.  The kernel may not provide any data (o!2R    protection) consistency among pages with different virtual page
  472.  *    alignments within the same object.]
  473.  */
  474. simpleroutine memory_object_data_provided(
  475.         memory_control    : memory_object_control_t;
  476.         offset        : vm_offset_t;
  477.         data        : pointer_t;
  478.         lock_value    : vm_prot_t);
  479.  
  480. /*
  481.  *    Indicate that a range of the given temporary memory object does
  482.  *    not exist, and that the backing memory object should be used
  483.  *    instead (or zero-fill memory be used, if no backing object exists).
  484.  *    [This call is intended for use only by the default memory manager.
  485.  *    It should not be used to indicate a real error -- memory_object_data_error
  486.  *    should be used for that purpose.]
  487.  */
  488. simpleroutine memory_object_data_unavailable(
  489.         memory_control    : memory_object_control_t;
  490.         offset        : vm_offset_t;
  491.         size        : vm_size_t);
  492.  
  493. /*
  494.  *    Retrieves the attributes currently associated with
  495.  *    a memory object.
  496.  */
  497. routine memory_object_get_attributes(
  498.         memory_control    : memory_object_control_t;
  499.     out    object_ready    : boolean_t;
  500.     out    may_cache    : boolean_t;
  501.     out    copy_strategy    : memory_object_copy_strategy_t);
  502.  
  503.  
  504. /*
  505.  *    Sets the default memory manager, the port to which
  506.  *    newly-created temporary memory objects are delivered.
  507.  *    [See (memory_object_default)memory_object_create.]
  508.  *    The old memory manager port is returned.
  509.  */
  510. routine vm_set_default_memory_manager(
  511.         host        : task_t;    /* XXX */
  512.     inout    default_manager    : memory_object_t);
  513.  
  514. skip;    /* pager_flush_request : OBSOLETE */
  515.  
  516. /*
  517.  *    Control use of the data associated with the given
  518.  *    memory object.  For each page in the given range,
  519.  *    perform the following operations, in order:
  520.  *        1)  restrict access to the page (disallow
  521.  *            forms specified by "prot");
  522.  *        2)  write back modifications (if "should_clean"
  523.  *            is asserted, and the page is dirty); and,
  524.  *        3)  flush the cached copy (if "should_flush"
  525.  *            is asserted).
  526.  *    The set of pages is defined by a starting offset
  527.  *    ("offset") and size ("size").  Only pages with the
  528.  *    same page alignment as the starting offset are
  529.  *    considered.
  530.  *
  531.  *    A single acknowledgement is sent (to the "reply_to"
  532.  *    port) when these actions are complete.
  533.  */
  534. simpleroutine memory_object_lock_request(
  535.         memory_control    : memory_object_control_t;
  536.         offset        : vm_offset_t;
  537.         size        : vm_size_t;
  538.         should_clean    : boolean_t;
  539.         should_flush    : boolean_t;
  540.         lock_value    : vm_prot_t;!2Seply_to    : port_t);
  541.  
  542. /*
  543.  *    Specify whether data for the given memory object may be
  544.  *    retained by the kernel even after all address space
  545.  *    mappings of the object have been deallocated.
  546.  */
  547. simpleroutine pager_cache(
  548.         memory_control    : memory_object_control_t;
  549.         should_cache    : boolean_t);
  550. #else    MACH_XP
  551. skip;    /* memory_object_data_provided */
  552. skip;    /* memory_object_data_unavailable */
  553. skip;    /* memory_object_get_attributes */
  554. skip;    /* vm_set_default_memory_manager */
  555. skip;    /* pager_flush_request : OBSOLETE */
  556. skip;    /* memory_object_lock_request */
  557. skip;    /* pager_cache */
  558. #endif    MACH_XP
  559.  
  560. skip;        /* old thread_wait */
  561. skip;        /* old task_wait */
  562.  
  563. /*
  564.  *    Returns information about the host on which the
  565.  *    target object resides.  [This object may be
  566.  *    a task, thread, or memory_object_control port.]
  567.  */
  568. routine xxx_host_info(
  569.         target_task    : port_t;
  570.     out    info        : machine_info_data_t);
  571.     
  572. /*
  573.  *    Returns information about a particular processor on
  574.  *    the host on which the target task resides.
  575.  */
  576. routine xxx_slot_info(
  577.         target_task    : task_t;
  578.         slot        : int;
  579.     out    info        : machine_slot_data_t);
  580.  
  581. /*
  582.  *    Performs control operations (currently only
  583.  *    turning off or on) on a particular processor on
  584.  *    the host on which the target task resides.
  585.  */
  586. routine xxx_cpu_control(
  587.         target_task    : task_t;
  588.         cpu        : int;
  589.         running        : boolean_t);
  590.  
  591. skip;        /* old thread_statistics */
  592. skip;        /* old task_statistics */
  593.  
  594. #if    MACH_NP
  595. /*
  596.  *    Initialize the direct network IPC system.
  597.  */
  598. routine    netport_init(
  599.         request_port    : port_t);
  600.  
  601. /*
  602.  *    Enter an association between a network port
  603.  *    and a local Mach port.
  604.  */
  605. routine    netport_enter(
  606.         request_port    : port_t;
  607.         netport        : network_port_t;
  608.         port        : port_t;
  609.         local        : boolean_t);
  610.  
  611. /*
  612.  *    Remove an association established by netport_enter.
  613.  */
  614. routine    netport_remove(
  615.         request_port    : port_t;
  616.         netport        : network_port_t);
  617. #else    MACH_NP
  618. skip;
  619. skip;
  620. skip;
  621. #endif    MACH_NP
  622.  
  623. #if    MACH_XP
  624. /*
  625.  *    A form of the pager_data_provided call that takes its
  626.  *    data inline in the request message.
  627.  */
  628. simpleroutine pager_data_provided_inline(
  629.         memory_control    : memory_object_control_t;
  630.         offset        : vm_offset_t;
  631.         data        : vm_page_data_t;
  632.         lock_value    : vm_prot_t);
  633. #else    MACH_XP
  634. skip;
  635. #endif    MACH_XP
  636.  
  637. /*
  638.  *    Increment the suspend count for the target task.
  639.  *    No threads within a task may run when the suspend
  640.  *    count for that ta!2Ts non-zero.
  641.  */
  642. routine    task_suspend(
  643.         target_task    : task_t);
  644.  
  645. /*
  646.  *    Decrement the suspend count for the target task,
  647.  *    if the count is currently non-zero.  If the resulting
  648.  *    suspend    count is zero, then threads within the task
  649.  *    that also have non-zero suspend counts may execute.
  650.  */
  651. routine    task_resume(
  652.         target_task    : task_t);
  653.  
  654. /*
  655.  *    Returns the current value of the selected special port
  656.  *    associated with the target task.
  657.  */
  658. routine task_get_special_port(
  659.         task        : task_t;
  660.         which_port    : int;
  661.     out    special_port    : port_t);
  662.  
  663. /*
  664.  *    Set one of the special ports associated with the
  665.  *    target task.
  666.  */
  667. routine task_set_special_port(
  668.         task        : task_t;
  669.         which_port    : int;
  670.         special_port    : port_t);
  671.  
  672. /*
  673.  *    Returns information about the target task.
  674.  */
  675. routine    task_info(
  676.         target_task    : task_t;
  677.         flavor        : int;
  678.     out    task_info_out    : task_info_t, IsLong);
  679.  
  680.  
  681. /*
  682.  *    Create a new thread within the target task, returning
  683.  *    the port representing that new thread.  The
  684.  *    initial execution state of the thread is undefined.
  685.  */
  686. routine thread_create(
  687.         parent_task    : task_t;
  688.     out    child_thread    : thread_t);
  689.  
  690. /*
  691.  *    Increment the suspend count for the target thread.
  692.  *    Once this call has completed, the thread will not
  693.  *    execute any further user or meta- instructions.
  694.  *    Once suspended, a thread may not execute again until
  695.  *    its suspend count is zero, and the suspend count
  696.  *    for its task is also zero.
  697.  */
  698. routine    thread_suspend(
  699.         target_thread    : thread_t);
  700.  
  701. /*
  702.  *    Decrement the suspend count for the target thread,
  703.  *    if that count is not already zero.
  704.  */
  705. routine    thread_resume(
  706.         target_thread    : thread_t);
  707.  
  708. /*
  709.  *    Cause any user or meta- instructions currently being
  710.  *    executed by the target thread to be aborted.  [Meta-
  711.  *    instructions consist of the basic traps for IPC
  712.  *    (e.g., msg_send, msg_receive) and self-identification
  713.  *    (e.g., task_self, thread_self, thread_reply).  Calls
  714.  *    described by MiG interfaces are not meta-instructions
  715.  *    themselves.]
  716.  */
  717. routine thread_abort(
  718.         target_thread    : thread_t);
  719.  
  720. /*
  721.  *    Return the selected state information for the target
  722.  *    thread.  If the thread is currently executing, the results
  723.  *    may be stale.  [Flavor THREAD_STATE_FLAVOR_LIST provides a
  724.  *    list of valid flavors for the target thread.]
  725.  */
  726. routine thread_get_state(
  727.         target_thread    : thread_t;
  728.         flavor        : int;
  729.     out    old_stat!2Uthread_state_t, IsLong);
  730.  
  731. /*
  732.  *    Set the selected state information for the target thread.
  733.  *    If the thread is currently executing, the state change
  734.  *    may be ill-defined.
  735.  */
  736. routine    thread_set_state(
  737.         target_thread    : thread_t;
  738.         flavor        : int;
  739.         new_state    : thread_state_t, IsLong);
  740.  
  741. /*
  742.  *    Returns the current value of the selected special port
  743.  *    associated with the target thread.
  744.  */
  745. routine thread_get_special_port(
  746.         thread        : thread_t;
  747.         which_port    : int;
  748.     out    special_port    : port_t);
  749.  
  750. /*
  751.  *    Set one of the special ports associated with the
  752.  *    target thread.
  753.  */
  754. routine thread_set_special_port(
  755.         thread        : thread_t;
  756.         which_port    : int;
  757.         special_port    : port_t);
  758.  
  759. /*
  760.  *    Returns information about the target thread.
  761.  */
  762. routine    thread_info(
  763.         target_thread    : thread_t;
  764.         flavor        : int;
  765.     out    thread_info_out    : thread_info_t, IsLong);
  766.  
  767. skip;
  768.  
  769. skip;
  770.  
  771. skip;    /* old host_ipc_statistics */
  772.  
  773. /*
  774.  *    Returns the set of port and port set names
  775.  *    to which the target task has access, along with
  776.  *    the type (set or port) for each name.
  777.  */
  778. routine port_names(
  779.         task        : task_t;
  780.     out    port_names_p    : port_name_array_t;
  781.     out    port_types    : port_type_array_t);
  782.  
  783. /*
  784.  *    Returns the type (set or port) for the port name
  785.  *    within the target task.
  786.  */
  787. routine port_type(
  788.         task        : task_t;
  789.         port_name    : port_name_t;
  790.     out    port_type_p    : port_type_t);
  791.  
  792. /*
  793.  *    Changes the name by which a port (or port set) is known to
  794.  *    the target task.
  795.  */
  796. routine port_rename(
  797.         task        : task_t;
  798.         old_name    : port_name_t;
  799.         new_name    : port_name_t);
  800.  
  801. /*
  802.  *    Allocate a new port (with all rights) in the target task.
  803.  *    The port name in that task is returned.
  804.  */
  805. routine port_allocate(
  806.         task        : task_t;
  807.     out    port_name    : port_name_t);
  808.  
  809. /*
  810.  *    Deallocate the port with the given name from the target task.
  811.  */
  812. routine port_deallocate(
  813.         task        : task_t;
  814.         port_name    : port_name_t);
  815.  
  816. /*
  817.  *    Set the number of messages that may be queued to
  818.  *    the port in the target task with the given name
  819.  *    before further message queueing operations block.
  820.  *    The target task must hold receive rights for the
  821.  *    port named.
  822.  */
  823. routine port_set_backlog(
  824.         task        : task_t;
  825.         port_name    : port_name_t;
  826.         backlog        : int);
  827.  
  828. /*
  829.  *    Return information about the port with the given
  830.  *    name in the target task.  Only the ownership and
  831.  *    receive_rights results are meaningful unless the
  832.  *    target task holds!2Veive rights for the port.
  833.  */
  834. routine port_status(
  835.         task        : task_t;
  836.         port_name    : port_name_t;
  837.     out    enabled        : port_set_name_t;
  838.     out    num_msgs    : int;
  839.     out    backlog        : int;
  840.     out    ownership    : boolean_t;
  841.     out    receive_rights    : boolean_t);
  842.  
  843. /*
  844.  *    Allocate a new port set in the target task, returning
  845.  *    the name of that new port set.  [The new set is
  846.  *    initially empty.]
  847.  */
  848. routine port_set_allocate(
  849.         task        : task_t;
  850.     out    set_name    : port_set_name_t);
  851.  
  852. /*
  853.  *    Deallocate the named port set from the target task.
  854.  *    Ports that are currently members of the named port
  855.  *    set are first removed from the set.
  856.  */
  857. routine port_set_deallocate(
  858.         task        : task_t;
  859.         set_name    : port_set_name_t);
  860.  
  861. /*
  862.  *    Add the named port to the port set named within
  863.  *    the target task.  [If the port currently is a member
  864.  *    of another port set, it is removed from that set.]
  865.  */
  866. routine port_set_add(
  867.         task        : task_t;
  868.         set_name    : port_set_name_t;
  869.         port_name    : port_name_t);
  870.  
  871. /*
  872.  *    Remove the named port from the port set named within
  873.  *    the target task.
  874.  */
  875. routine port_set_remove(
  876.         task        : task_t;
  877.         port_name    : port_name_t);
  878.  
  879. /*
  880.  *    Returns the current set of ports that are members
  881.  *    of the named port set in the target task.
  882.  */
  883. routine port_set_status(
  884.         task        : task_t;
  885.         set_name    : port_set_name_t;
  886.     out    members        : port_name_array_t);
  887.  
  888. /*
  889.  *    Insert send rights for the specified port into
  890.  *    the target task with the specified port name.
  891.  *    [If the name is in use, or the target task already
  892.  *    has another name for the specified port, then
  893.  *    the operation will fail.]
  894.  */
  895. routine port_insert_send(
  896.         task        : task_t;
  897.         my_port        : port_t;
  898.         its_name    : port_name_t);
  899.  
  900. /*
  901.  *    Returns send rights for the named port in the
  902.  *    target task, removing that port name and port
  903.  *    send rights from the target task.  [If the
  904.  *    target task holds receive rights for this port,
  905.  *    the operation will fail.]
  906.  */
  907. routine port_extract_send(
  908.         task        : task_t;
  909.         its_name    : port_name_t;
  910.     out    its_port    : port_t);
  911.  
  912. /*
  913.  *    Insert receive rights for the specified port into
  914.  *    the target task with the specified port name.
  915.  *    [If the name is in use, or the target task already
  916.  *    has another name for the specified port, then
  917.  *    the operation will fail.
  918.  */
  919. routine port_insert_receive(
  920.         task        : task_t;
  921.         my_port        : port_t = MSG_TYPE_PORT_ALL;
  922.         its_name    : port_name_t);
  923.  
  924. /*
  925.  *    Returns receive rights for the named port in the
  926.  *    target task, removing that port name and all port
  927.  *    rights from the target task.
  928.  */
  929. routine port!2Dract_receive(
  930.         task        : task_t;
  931.         its_name    : port_name_t;
  932.     out    its_port    : port_t = MSG_TYPE_PORT_ALL);
  933.  
  934. #if    MACH_XP
  935. /*
  936.  *    Map a user-defined memory object into the virtual address
  937.  *    space of the target task.  If desired (anywhere is TRUE),
  938.  *    the kernel will find a suitable address range of the
  939.  *    specified size; else, the specific address will be allocated.
  940.  *
  941.  *    The beginning address of the range will be aligned on a virtual
  942.  *    page boundary, be at or beyond the address specified, and
  943.  *    meet the mask requirements (bits turned on in the mask must not
  944.  *    be turned on in the result); the size of the range, in bytes,
  945.  *    will be rounded    up to an integral number of virtual pages.
  946.  *
  947.  *    The memory in the resulting range will be associated with the
  948.  *    specified memory object, with the beginning of the memory range
  949.  *    referring to the specified offset into the memory object.
  950.  *
  951.  *    The mapping will take the current and maximum protections and
  952.  *    the inheritance attributes specified; see the vm_protect and
  953.  *    vm_inherit calls for a description of these attributes.
  954.  *
  955.  *    If desired (copy is TRUE), the memory range will be filled
  956.  *    with a copy of the data from the memory object; this copy will
  957.  *    be private to this mapping in this target task.  Otherwise,
  958.  *    the memory in this mapping will be shared with other mappings
  959.  *    of the same memory object at the same offset (in this task or
  960.  *    in other tasks).  [The Mach kernel only enforces shared memory
  961.  *    consistency among mappings on one host with similar page alignments.
  962.  *    The user-defined memory manager for this object is responsible
  963.  *    for further consistency.]
  964.  */
  965. routine vm_map(
  966.         target_task    : vm_task_t;
  967.     inout    address        : vm_address_t;
  968.         size        : vm_size_t;
  969.         mask        : vm_address_t;
  970.         anywhere    : boolean_t;
  971.         memory_object    : memory_object_t;
  972.         offset        : vm_offset_t;
  973.         copy        : boolean_t;
  974.         cur_protection    : vm_prot_t;
  975.         max_protection    : vm_prot_t;
  976.         inheritance    : vm_inherit_t);
  977.  
  978. /*
  979.  *    Indicate that a range of the specified memory object cannot
  980.  *    be provided at this time.  [Threads waiting for memory pages
  981.  *    specified by this call will experience a memory exception.
  982.  *    Only threads waiting at the time of the call are affected.]
  983.  */
  984. simpleroutine memory_object_data_error(
  985.         memory_control    : memory_object_control_t;
  986.         offset        : vm_offset_t;
  987.         size        : vm_size_t;
  988.         error!2Eue    : kern_return_t);
  989.  
  990. /*
  991.  *    Make decisions regarding the use of the specified
  992.  *    memory object.
  993.  */
  994. simpleroutine memory_object_set_attributes(
  995.         memory_control    : memory_object_control_t;
  996.         object_ready    : boolean_t;
  997.         may_cache    : boolean_t;
  998.         copy_strategy    : memory_object_copy_strategy_t);
  999.  
  1000. /*
  1001.  */
  1002. simpleroutine memory_object_destroy(
  1003.         memory_control    : memory_object_control_t;
  1004.         reason        : kern_return_t);
  1005.  
  1006. #else    MACH_XP
  1007. skip;    /* vm_map */
  1008. skip;    /* memory_object_data_error */
  1009. skip;    /* memory_object_set_attributes */
  1010. skip;    /* memory_object_destroy */
  1011. #endif    MACH_XP
  1012.  
  1013. skip;    /* old host_ipc_statistics_reset */
  1014. skip;    /* old host_callout_info */
  1015. skip;    /* old host_callout_statistics */
  1016. skip;    /* old host_callout_statistics_reset */
  1017. skip;    /* old port_set_select */
  1018.  
  1019. /*
  1020.  *    Sets a backup port for the named port.  The task
  1021.  *    must have receive rights for the named port.
  1022.  *    Returns the previous backup port, if any.
  1023.  */
  1024. routine port_set_backup(
  1025.         task        : task_t;
  1026.         port_name    : port_name_t;
  1027.         backup        : port_t;
  1028.     out    previous    : port_t);
  1029.  
  1030. skip;    /* old host_fpa_counters */
  1031. skip;    /* old host_fpa_counters_reset */
  1032.  
  1033. /*
  1034.  *  Synchronize the contents of an address space with backing store.
  1035.  *  Dirty pages in the address range are written to their appropriate
  1036.  *  backing store.  All pageouts are attempted.  If any pageout causes
  1037.  *  an error, vm_synchronize returns KERN_FAILURE.  If a page would be
  1038.  *  written to the default pager (swapfile), that page is skipped and
  1039.  *  KERN_FAILURE is returned.  This call is synchronous.
  1040.  */
  1041. routine vm_synchronize(
  1042.         target_task    : vm_task_t;
  1043.         address        : vm_address_t;
  1044.         size        : vm_size_t);
  1045.  
  1046.