diff options
Diffstat (limited to 'include')
35 files changed, 345 insertions, 100 deletions
diff --git a/include/cache.h b/include/cache.h new file mode 100644 index 00000000..6260366a --- /dev/null +++ b/include/cache.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2013 Free Software Foundation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _MACH_CACHE_H_ +#define _MACH_CACHE_H_ + +/* This macro can be used to align statically allocated objects so + that they start at a cache line. */ +#define __cacheline_aligned __attribute__((aligned(1 << CPU_L1_SHIFT))) + +#endif /* _MACH_CACHE_H_ */ diff --git a/include/device/device.defs b/include/device/device.defs index d9234e39..409146f5 100644 --- a/include/device/device.defs +++ b/include/device/device.defs @@ -45,14 +45,29 @@ subsystem serverprefix ds_; type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic - ctype: mach_port_t; + ctype: mach_port_t +#ifndef KERNEL_SERVER +#ifdef MACH_PAYLOAD_TO_PORT + intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT +#endif /* MACH_PAYLOAD_TO_PORT */ +#endif /* KERNEL_SERVER */ +; routine device_open( master_port : mach_port_t; sreplyport reply_port : reply_port_t; mode : dev_mode_t; name : dev_name_t; - out device : device_t + out device : device_t = + MACH_MSG_TYPE_PORT_SEND + ctype: mach_port_t +#if KERNEL_SERVER + outtran: mach_port_t convert_device_to_port(device_t) +#else +#ifdef DEVICE_OUTTRAN + outtran: DEVICE_OUTTRAN +#endif +#endif /* KERNEL_SERVER */ ); routine device_close( diff --git a/include/device/device_reply.defs b/include/device/device_reply.defs index 34156776..5a325075 100644 --- a/include/device/device_reply.defs +++ b/include/device/device_reply.defs @@ -54,7 +54,13 @@ serverdemux seqnos_device_reply_server; #endif /* SEQNOS */ type reply_port_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifndef KERNEL_SERVER +#ifdef MACH_PAYLOAD_TO_PORT + intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT +#endif /* MACH_PAYLOAD_TO_PORT */ +#endif /* KERNEL_SERVER */ +; simpleroutine device_open_reply( reply_port : reply_port_t; diff --git a/include/device/device_request.defs b/include/device/device_request.defs index e8aab2a6..7ea8637c 100644 --- a/include/device/device_request.defs +++ b/include/device/device_request.defs @@ -37,7 +37,13 @@ subsystem device_request 2800; /* to match device.defs */ serverprefix ds_; type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifndef KERNEL_SERVER +#ifdef MACH_PAYLOAD_TO_PORT + intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT +#endif /* MACH_PAYLOAD_TO_PORT */ +#endif /* KERNEL_SERVER */ +; simpleroutine device_open_request( device_server_port : mach_port_t; diff --git a/include/device/device_types.defs b/include/device/device_types.defs index 79e4c5b0..49cc2717 100644 --- a/include/device/device_types.defs +++ b/include/device/device_types.defs @@ -39,6 +39,10 @@ #include <mach/std_types.defs> +#ifdef DEVICE_IMPORTS +DEVICE_IMPORTS +#endif + type recnum_t = unsigned32; type dev_mode_t = unsigned32; type dev_flavor_t = unsigned32; @@ -55,6 +59,19 @@ type device_t = mach_port_t intran: device_t dev_port_lookup(mach_port_t) outtran: mach_port_t convert_device_to_port(device_t) destructor: device_deallocate(device_t) +#else /* KERNEL_SERVER */ +#ifdef DEVICE_INTRAN + intran: DEVICE_INTRAN +#endif +#ifdef DEVICE_INTRAN_PAYLOAD + intranpayload: DEVICE_INTRAN_PAYLOAD +#endif +#ifdef DEVICE_OUTTRAN + outtran: DEVICE_OUTTRAN +#endif +#ifdef DEVICE_DESTRUCTOR + destructor: DEVICE_DESTRUCTOR +#endif #endif /* KERNEL_SERVER */ ; diff --git a/include/device/device_types.h b/include/device/device_types.h index caf4fc04..a6db051e 100644 --- a/include/device/device_types.h +++ b/include/device/device_types.h @@ -135,4 +135,6 @@ typedef int io_return_t; #define D_NO_MEMORY 2508 /* memory allocation failure */ #define D_READ_ONLY 2509 /* device cannot be written to */ +void device_deallocate(device_t); + #endif /* DEVICE_TYPES_H */ diff --git a/include/device/tape_status.h b/include/device/tape_status.h index 97cb098a..603d76c5 100644 --- a/include/device/tape_status.h +++ b/include/device/tape_status.h @@ -137,4 +137,4 @@ struct mtget { #define MTIOCEEOT _IO('m', 4) /* enable EOT error */ -#endif _TAPE_STATUS_H_ +#endif /* _TAPE_STATUS_H_ */ diff --git a/include/device/tty_status.h b/include/device/tty_status.h index 15249a40..2eed5d03 100644 --- a/include/device/tty_status.h +++ b/include/device/tty_status.h @@ -30,6 +30,9 @@ * Status information for tty. */ +#ifndef _DEVICE_TTY_STATUS_H_ +#define _DEVICE_TTY_STATUS_H_ + struct tty_status { int tt_ispeed; /* input speed */ int tt_ospeed; /* output speed */ @@ -127,3 +130,5 @@ struct tty_status { /* clear break condition */ #define TTY_SET_TRANSLATION (dev_flavor_t)(('t'<<16) + 8) /* set translation table */ + +#endif /* _DEVICE_TTY_STATUS_H_ */ diff --git a/include/mach/alert.h b/include/mach/alert.h index 8232f9ef..e8eb3713 100644 --- a/include/mach/alert.h +++ b/include/mach/alert.h @@ -34,4 +34,4 @@ #define ALERT_USER 0xffff0000 /* User-defined alert bits */ -#endif _MACH_ALERT_H_ +#endif /* _MACH_ALERT_H_ */ diff --git a/include/mach/boot.h b/include/mach/boot.h index d3e141fa..7f14cc4b 100644 --- a/include/mach/boot.h +++ b/include/mach/boot.h @@ -65,7 +65,7 @@ struct boot_rendezvous int code; }; -#endif !__ASSEMBLER__ +#endif /* !__ASSEMBLER__ */ /* This is the magic value that must appear in boot_module.magic. */ @@ -90,4 +90,4 @@ struct boot_rendezvous #define BRZV_DATA 'D' -#endif _MACH_BOOT_ +#endif /* _MACH_BOOT_ */ diff --git a/include/mach/default_pager_types.defs b/include/mach/default_pager_types.defs index 3164f047..bee7c259 100644 --- a/include/mach/default_pager_types.defs +++ b/include/mach/default_pager_types.defs @@ -41,4 +41,4 @@ type default_pager_filename_t = (MACH_MSG_TYPE_STRING_C, 8*256); import <mach/default_pager_types.h>; -#endif _MACH_DEFAULT_PAGER_TYPES_DEFS_ +#endif /* _MACH_DEFAULT_PAGER_TYPES_DEFS_ */ diff --git a/include/mach/default_pager_types.h b/include/mach/default_pager_types.h index 99e43ce3..f5ce5a4f 100644 --- a/include/mach/default_pager_types.h +++ b/include/mach/default_pager_types.h @@ -55,4 +55,4 @@ typedef default_pager_page_t *default_pager_page_array_t; typedef char default_pager_filename_t[256]; -#endif _MACH_DEFAULT_PAGER_TYPES_H_ +#endif /* _MACH_DEFAULT_PAGER_TYPES_H_ */ diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs index 73313343..dd4da870 100644 --- a/include/mach/gnumach.defs +++ b/include/mach/gnumach.defs @@ -27,6 +27,11 @@ subsystem #include <mach/std_types.defs> #include <mach/mach_types.defs> +#include <mach_debug/mach_debug_types.defs> + +#ifdef GNUMACH_IMPORTS +GNUMACH_IMPORTS +#endif type vm_cache_statistics_data_t = struct[11] of integer_t; @@ -37,3 +42,45 @@ type vm_cache_statistics_data_t = struct[11] of integer_t; routine vm_cache_statistics( target_task : vm_task_t; out vm_cache_stats : vm_cache_statistics_data_t); + +/* + * Terminate a thread and release rights and memory. + * + * Intended to be used by threading libraries to provide a clean way for + * threads to terminate themselves. The resources a thread wouldn't be able + * to release without this call when terminating itself are its + * last reference to its kernel port, its reply port, and its stack. + * + * This call is semantically equivalent to : + * - mach_port_deallocate(task, thread_name); + * - if (reply_port != MACH_PORT_NULL) + * mach_port_destroy(task, reply_port); + * - if ((address != 0) || (size != 0)) + * vm_deallocate(task, address, size) + * - thread_terminate(thread) + * + * Implemented as a simple routine so a reply port isn't required. + */ +simpleroutine thread_terminate_release( + thread : thread_t; + task : task_t; + thread_name : mach_port_name_t; + reply_port : mach_port_name_t; + address : vm_address_t; + size : vm_size_t); + +/* + * Set the name of task TASK to NAME. This is a debugging aid. + * NAME will be used in error messages printed by the kernel. + */ +simpleroutine task_set_name( + task : task_t; + name : kernel_debug_name_t); + +/* + * Register a port to which a notification about newly created tasks + * are sent. + */ +routine register_new_task_notification( + host_priv : host_priv_t; + notification : mach_port_send_t); diff --git a/include/mach/mach.defs b/include/mach/mach.defs index 58510805..3786f657 100644 --- a/include/mach/mach.defs +++ b/include/mach/mach.defs @@ -46,6 +46,10 @@ userprefix r_; #include <mach/std_types.defs> #include <mach/mach_types.defs> +#ifdef MACH_IMPORTS +MACH_IMPORTS +#endif + skip; /* old port_allocate */ skip; /* old port_deallocate */ skip; /* old port_enable */ diff --git a/include/mach/mach_host.defs b/include/mach/mach_host.defs index 2644146f..28439a01 100644 --- a/include/mach/mach_host.defs +++ b/include/mach/mach_host.defs @@ -47,6 +47,10 @@ subsystem #include <mach/std_types.defs> #include <mach/mach_types.defs> +#ifdef MACH_HOST_IMPORTS +MACH_HOST_IMPORTS +#endif + /* * Get list of processors on this host. */ @@ -292,7 +296,7 @@ routine host_reboot( * [ To unwire the pages, specify VM_PROT_NONE. ] */ routine vm_wire( - host_priv : host_priv_t; + host : mach_port_t; task : vm_task_t; address : vm_address_t; size : vm_size_t; diff --git a/include/mach/mach_port.defs b/include/mach/mach_port.defs index e1f45e3c..c21c34bc 100644 --- a/include/mach/mach_port.defs +++ b/include/mach/mach_port.defs @@ -176,14 +176,7 @@ routine mach_port_mod_refs( right : mach_port_right_t; delta : mach_port_delta_t); -/* - * Temporary compatibility call. - */ - -routine old_mach_port_get_receive_status( - task : ipc_space_t; - name : mach_port_name_t; - out status : old_mach_port_status_t); +skip; /* old old_mach_port_get_receive_status */ /* * Only valid for receive rights. @@ -342,5 +335,28 @@ routine mach_port_create_act( user_rbuf_size : vm_size_t; out new_act : thread_t); +#else /* MIGRATING_THREADS */ + +skip; /* mach_port_set_rpcinfo */ +skip; /* mach_port_create_act */ + #endif /* MIGRATING_THREADS */ +/* + * Only valid for receive rights. + * Set the protected payload for this right to the given value. + */ + +routine mach_port_set_protected_payload( + task : ipc_space_t; + name : mach_port_name_t; + payload : natural_t); + +/* + * Only valid for receive rights. + * Clear the protected payload for this right. + */ + +routine mach_port_clear_protected_payload( + task : ipc_space_t; + name : mach_port_name_t); diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs index 607d5d92..8e68d385 100644 --- a/include/mach/mach_types.defs +++ b/include/mach/mach_types.defs @@ -60,8 +60,6 @@ serverprefix SERVERPREFIX; type mach_port_status_t = struct[9] of integer_t; -type old_mach_port_status_t = struct[8] of integer_t; /* compatibility */ - type task_t = mach_port_t ctype: mach_port_t #if KERNEL_SERVER @@ -135,6 +133,19 @@ type memory_object_t = mach_port_t ctype: mach_port_t #if KERNEL_SERVER intran: ipc_port_t null_conversion(mach_port_t) +#else /* KERNEL_SERVER */ +#ifdef MEMORY_OBJECT_INTRAN + intran: MEMORY_OBJECT_INTRAN +#endif +#ifdef MEMORY_OBJECT_INTRAN_PAYLOAD + intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD +#endif +#ifdef MEMORY_OBJECT_OUTTRAN + outtran: MEMORY_OBJECT_OUTTRAN +#endif +#ifdef MEMORY_OBJECT_DESTRUCTOR + destructor: MEMORY_OBJECT_DESTRUCTOR +#endif #endif /* KERNEL_SERVER */ ; diff --git a/include/mach/memory_object.defs b/include/mach/memory_object.defs index ea7989aa..6372ded8 100644 --- a/include/mach/memory_object.defs +++ b/include/mach/memory_object.defs @@ -42,6 +42,10 @@ subsystem #include <mach/std_types.defs> #include <mach/mach_types.defs> +#ifdef MEMORY_OBJECT_IMPORTS +MEMORY_OBJECT_IMPORTS +#endif + #if SEQNOS serverprefix seqnos_; serverdemux seqnos_memory_object_server; @@ -85,7 +89,18 @@ simpleroutine memory_object_init( simpleroutine memory_object_terminate( memory_object : memory_object_t = MACH_MSG_TYPE_MOVE_SEND - ctype: mach_port_t; + ctype: mach_port_t +#ifdef MEMORY_OBJECT_INTRAN + intran: MEMORY_OBJECT_INTRAN +#endif +#ifdef MEMORY_OBJECT_INTRAN_PAYLOAD + intranpayload: + MEMORY_OBJECT_INTRAN_PAYLOAD +#endif +#ifdef MEMORY_OBJECT_DESTRUCTOR + destructor: MEMORY_OBJECT_DESTRUCTOR +#endif + ; #if SEQNOS msgseqno seqno : mach_port_seqno_t; #endif /* SEQNOS */ @@ -221,7 +236,17 @@ simpleroutine memory_object_data_write( simpleroutine memory_object_lock_completed( memory_object : memory_object_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifdef MEMORY_OBJECT_INTRAN + intran: MEMORY_OBJECT_INTRAN +#endif +#ifdef MEMORY_OBJECT_INTRAN_PAYLOAD + intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD +#endif +#ifdef MEMORY_OBJECT_DESTRUCTOR + destructor: MEMORY_OBJECT_DESTRUCTOR +#endif + ; #if SEQNOS msgseqno seqno : mach_port_seqno_t; #endif /* SEQNOS */ @@ -252,7 +277,17 @@ simpleroutine memory_object_lock_completed( simpleroutine memory_object_supply_completed( memory_object : memory_object_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifdef MEMORY_OBJECT_INTRAN + intran: MEMORY_OBJECT_INTRAN +#endif +#ifdef MEMORY_OBJECT_INTRAN_PAYLOAD + intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD +#endif +#ifdef MEMORY_OBJECT_DESTRUCTOR + destructor: MEMORY_OBJECT_DESTRUCTOR +#endif + ; #if SEQNOS msgseqno seqno : mach_port_seqno_t; #endif /* SEQNOS */ @@ -298,7 +333,17 @@ simpleroutine memory_object_data_return( simpleroutine memory_object_change_completed( memory_object : memory_object_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifdef MEMORY_OBJECT_INTRAN + intran: MEMORY_OBJECT_INTRAN +#endif +#ifdef MEMORY_OBJECT_INTRAN_PAYLOAD + intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD +#endif +#ifdef MEMORY_OBJECT_DESTRUCTOR + destructor: MEMORY_OBJECT_DESTRUCTOR +#endif + ; #if SEQNOS msgseqno seqno : mach_port_seqno_t; #endif /* SEQNOS */ diff --git a/include/mach/memory_object_default.defs b/include/mach/memory_object_default.defs index 0eac2714..cfd54a48 100644 --- a/include/mach/memory_object_default.defs +++ b/include/mach/memory_object_default.defs @@ -40,6 +40,10 @@ subsystem #include <mach/std_types.defs> #include <mach/mach_types.defs> +#ifdef MEMORY_OBJECT_IMPORTS +MEMORY_OBJECT_IMPORTS +#endif + #if SEQNOS serverprefix seqnos_; serverdemux seqnos_memory_object_default_server; diff --git a/include/mach/message.h b/include/mach/message.h index f78e9780..0a7297e1 100644 --- a/include/mach/message.h +++ b/include/mach/message.h @@ -136,7 +136,10 @@ typedef struct { mach_msg_bits_t msgh_bits; mach_msg_size_t msgh_size; mach_port_t msgh_remote_port; - mach_port_t msgh_local_port; + union { + mach_port_t msgh_local_port; + unsigned long msgh_protected_payload; + }; mach_port_seqno_t msgh_seqno; mach_msg_id_t msgh_id; } mach_msg_header_t; @@ -253,7 +256,9 @@ typedef struct { #define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND #define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE -#define MACH_MSG_TYPE_LAST 22 /* Last assigned */ +#define MACH_MSG_TYPE_PROTECTED_PAYLOAD 23 + +#define MACH_MSG_TYPE_LAST 23 /* Last assigned */ /* * A dummy value. Mostly used to indicate that the actual value diff --git a/include/mach/multiboot.h b/include/mach/multiboot.h index 3880fa80..b23df4a4 100644 --- a/include/mach/multiboot.h +++ b/include/mach/multiboot.h @@ -79,4 +79,4 @@ struct multiboot_info natural_t pad[4]; }; -#endif _MACH_MULTIBOOT_H_ +#endif /* _MACH_MULTIBOOT_H_ */ diff --git a/include/mach/notify.defs b/include/mach/notify.defs index e06f6b41..6ba4cde7 100644 --- a/include/mach/notify.defs +++ b/include/mach/notify.defs @@ -28,16 +28,33 @@ subsystem notify 64; #include <mach/std_types.defs> +#ifdef NOTIFY_IMPORTS +NOTIFY_IMPORTS +#endif + #if SEQNOS serverprefix do_seqnos_; serverdemux seqnos_notify_server; -#else SEQNOS +#else serverprefix do_; serverdemux notify_server; -#endif SEQNOS +#endif type notify_port_t = MACH_MSG_TYPE_MOVE_SEND_ONCE - ctype: mach_port_t; + ctype: mach_port_t +#ifdef NOTIFY_INTRAN + intran: NOTIFY_INTRAN +#endif +#ifdef NOTIFY_INTRAN_PAYLOAD + intranpayload: NOTIFY_INTRAN_PAYLOAD +#endif +#ifdef NOTIFY_OUTTRAN + outtran: NOTIFY_OUTTRAN +#endif +#ifdef NOTIFY_DESTRUCTOR + destructor: NOTIFY_DESTRUCTOR +#endif +; /* MACH_NOTIFY_FIRST: 0100 */ skip; @@ -47,7 +64,7 @@ simpleroutine mach_notify_port_deleted( notify : notify_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif name : mach_port_name_t); /* MACH_NOTIFY_MSG_ACCEPTED: 0102 */ @@ -55,7 +72,7 @@ simpleroutine mach_notify_msg_accepted( notify : notify_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif name : mach_port_name_t); skip; /* was NOTIFY_OWNERSHIP_RIGHTS: 0103 */ @@ -67,7 +84,7 @@ simpleroutine mach_notify_port_destroyed( notify : notify_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif rights : mach_port_receive_t); /* MACH_NOTIFY_NO_SENDERS: 0106 */ @@ -75,7 +92,7 @@ simpleroutine mach_notify_no_senders( notify : notify_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif mscount : mach_port_mscount_t); /* MACH_NOTIFY_SEND_ONCE: 0107 */ @@ -83,7 +100,7 @@ simpleroutine mach_notify_send_once( notify : notify_port_t #if SEQNOS ; msgseqno seqno : mach_port_seqno_t -#endif SEQNOS +#endif ); /* MACH_NOTIFY_DEAD_NAME: 0110 */ @@ -91,5 +108,5 @@ simpleroutine mach_notify_dead_name( notify : notify_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif name : mach_port_name_t); diff --git a/include/mach/port.h b/include/mach/port.h index 53f60716..3036a921 100644 --- a/include/mach/port.h +++ b/include/mach/port.h @@ -137,6 +137,8 @@ typedef struct mach_port_status { /* * Compatibility definitions, for code written * before there was an mps_seqno field. + * + * XXX: Remove this before releasing Gnumach 1.6. */ typedef struct old_mach_port_status { diff --git a/include/mach/profil.h b/include/mach/profil.h index 0eb4ce47..866f267b 100644 --- a/include/mach/profil.h +++ b/include/mach/profil.h @@ -137,7 +137,7 @@ extern vm_map_t kernel_map; /* MACRO set_pbuf_value ** ** enters the value 'val' in the buffer 'pbuf' and returns the following -** indications: 0: means that a fatal error occured: the buffer was full +** indications: 0: means that a fatal error occurred: the buffer was full ** (it hasn't been sent yet) ** 1: means that a value has been inserted successfully ** 2: means that we'v just entered the last value causing diff --git a/include/mach/rpc.h b/include/mach/rpc.h index d3098f80..36eb5921 100644 --- a/include/mach/rpc.h +++ b/include/mach/rpc.h @@ -21,7 +21,6 @@ #include <mach/kern_return.h> #include <mach/message.h> -#include <mach/machine/rpc.h> /* * Description of a port passed up by the leaky-register RPC path diff --git a/include/mach/std_types.defs b/include/mach/std_types.defs index 00d1a698..a1f156d9 100644 --- a/include/mach/std_types.defs +++ b/include/mach/std_types.defs @@ -49,7 +49,13 @@ type pointer_t = ^array[] of MACH_MSG_TYPE_BYTE ctype: vm_offset_t; -type mach_port_t = MACH_MSG_TYPE_COPY_SEND; +type mach_port_t = MACH_MSG_TYPE_COPY_SEND +#ifndef KERNEL_SERVER +#ifdef MACH_PAYLOAD_TO_PORT + intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT +#endif /* MACH_PAYLOAD_TO_PORT */ +#endif /* KERNEL_SERVER */ +; type mach_port_array_t = array[] of mach_port_t; type mach_port_name_t = MACH_MSG_TYPE_PORT_NAME diff --git a/include/mach/task_notify.defs b/include/mach/task_notify.defs new file mode 100644 index 00000000..5485d4e3 --- /dev/null +++ b/include/mach/task_notify.defs @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 Free Software Foundation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +subsystem +#if KERNEL_SERVER + KernelServer +#endif /* KERNEL_SERVER */ +#if KERNEL_USER + KernelUser +#endif /* KERNEL_USER */ + task_notify 4400; + +#include <mach/std_types.defs> +#include <mach/mach_types.defs> + +/* These notifications are sent to the port registered via + `register_new_task_notification' and provide a robust parental + relation between tasks. */ +simpleroutine mach_notify_new_task( + notify : mach_port_t; + task : task_t; + parent : task_t); diff --git a/include/mach/version.h b/include/mach/version.h index ec12ea74..3ef78592 100644 --- a/include/mach/version.h +++ b/include/mach/version.h @@ -43,6 +43,9 @@ * minor 0. */ +#ifndef _MACH_VERSION_H_ +#define _MACH_VERSION_H_ + #define KERNEL_MAJOR_VERSION 4 #define KERNEL_MINOR_VERSION 0 @@ -66,3 +69,5 @@ * excised from the CSD environment. */ #define INCLUDE_VERSION 0 + +#endif /* _MACH_VERSION_H_ */ diff --git a/include/mach/vm_param.h b/include/mach/vm_param.h index 03609815..cdccce82 100644 --- a/include/mach/vm_param.h +++ b/include/mach/vm_param.h @@ -39,7 +39,7 @@ #include <mach/machine/vm_types.h> /* - * The machine independent pages are refered to as PAGES. A page + * The machine independent pages are referred to as PAGES. A page * is some number of hardware pages, depending on the target machine. * * All references to the size of a page should be done diff --git a/include/mach_debug/ipc_info.h b/include/mach_debug/ipc_info.h index ef0b0c6a..a47ae7b4 100644 --- a/include/mach_debug/ipc_info.h +++ b/include/mach_debug/ipc_info.h @@ -43,40 +43,17 @@ * in mach_debug_types.defs when adding/removing fields. */ - -typedef struct ipc_info_space { - natural_t iis_genno_mask; /* generation number mask */ - natural_t iis_table_size; /* size of table */ - natural_t iis_table_next; /* next possible size of table */ - natural_t iis_tree_size; /* size of tree */ - natural_t iis_tree_small; /* # of small entries in tree */ - natural_t iis_tree_hash; /* # of hashed entries in tree */ -} ipc_info_space_t; - - typedef struct ipc_info_name { mach_port_t iin_name; /* port name, including gen number */ -/*boolean_t*/integer_t iin_collision; /* collision at this entry? */ -/*boolean_t*/integer_t iin_compat; /* is this a compat-mode entry? */ /*boolean_t*/integer_t iin_marequest; /* extant msg-accepted request? */ mach_port_type_t iin_type; /* straight port type */ mach_port_urefs_t iin_urefs; /* user-references */ vm_offset_t iin_object; /* object pointer */ natural_t iin_next; /* marequest/next in free list */ - natural_t iin_hash; /* hash index */ } ipc_info_name_t; typedef ipc_info_name_t *ipc_info_name_array_t; - -typedef struct ipc_info_tree_name { - ipc_info_name_t iitn_name; - mach_port_t iitn_lchild; /* name of left child */ - mach_port_t iitn_rchild; /* name of right child */ -} ipc_info_tree_name_t; - -typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t; - /* * Type definitions for mach_port_kernel_object. * By remarkable coincidence, these closely resemble diff --git a/include/mach_debug/mach_debug.defs b/include/mach_debug/mach_debug.defs index 053c3fe6..c8e8b1b4 100644 --- a/include/mach_debug/mach_debug.defs +++ b/include/mach_debug/mach_debug.defs @@ -57,14 +57,7 @@ routine mach_port_get_srights( name : mach_port_name_t; out srights : mach_port_rights_t); -/* - * Returns information about the global reverse hash table. - */ - -routine host_ipc_hash_info( - host : host_t; - out info : hash_info_bucket_array_t, - CountInOut, Dealloc); +skip; /* host_ipc_hash_info */ /* * Returns information about the marequest hash table. @@ -76,17 +69,7 @@ routine host_ipc_marequest_info( out info : hash_info_bucket_array_t, CountInOut, Dealloc); -/* - * Returns information about an IPC space. - */ - -routine mach_port_space_info( - task : ipc_space_t; - out info : ipc_info_space_t; - out table_info : ipc_info_name_array_t, - CountInOut, Dealloc; - out tree_info : ipc_info_tree_name_array_t, - CountInOut, Dealloc); +skip; /* mach_port_space_info */ /* * Returns information about the dead-name requests @@ -218,6 +201,12 @@ routine mach_vm_object_pages( out pages : vm_page_info_array_t, CountInOut, Dealloc); +#else /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ +skip; /* mach_vm_region_info */ +skip; /* mach_vm_object_info */ +skip; /* mach_vm_object_pages */ +#endif /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ + /* * Returns information about the memory allocation caches. */ @@ -225,9 +214,3 @@ routine host_slab_info( host : host_t; out info : cache_info_array_t, CountInOut, Dealloc); - -#else /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ -skip; /* mach_vm_region_info */ -skip; /* mach_vm_object_info */ -skip; /* mach_vm_object_pages */ -#endif /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ diff --git a/include/mach_debug/mach_debug_types.defs b/include/mach_debug/mach_debug_types.defs index f60125a0..8df2f344 100644 --- a/include/mach_debug/mach_debug_types.defs +++ b/include/mach_debug/mach_debug_types.defs @@ -38,14 +38,9 @@ type cache_info_array_t = array[] of cache_info_t; type hash_info_bucket_t = struct[1] of natural_t; type hash_info_bucket_array_t = array[] of hash_info_bucket_t; -type ipc_info_space_t = struct[6] of natural_t; - -type ipc_info_name_t = struct[9] of natural_t; +type ipc_info_name_t = struct[6] of natural_t; type ipc_info_name_array_t = array[] of ipc_info_name_t; -type ipc_info_tree_name_t = struct[11] of natural_t; -type ipc_info_tree_name_array_t = array[] of ipc_info_tree_name_t; - type vm_region_info_t = struct[11] of natural_t; type vm_region_info_array_t = array[] of vm_region_info_t; @@ -57,6 +52,8 @@ type vm_page_info_array_t = array[] of vm_page_info_t; type symtab_name_t = (MACH_MSG_TYPE_STRING_C, 8*32); +type kernel_debug_name_t = c_string[*: 64]; + import <mach_debug/mach_debug_types.h>; #endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ */ diff --git a/include/mach_debug/mach_debug_types.h b/include/mach_debug/mach_debug_types.h index 5d4efcde..9c7d1fde 100644 --- a/include/mach_debug/mach_debug_types.h +++ b/include/mach_debug/mach_debug_types.h @@ -37,4 +37,15 @@ typedef char symtab_name_t[32]; +/* + * A fixed-length string data type intended for names given to + * kernel objects. + * + * Note that it is not guaranteed that the in-kernel data + * structure will hold KERNEL_DEBUG_NAME_MAX bytes. The given + * name will be truncated to fit into the target data structure. + */ +#define KERNEL_DEBUG_NAME_MAX (64) +typedef char kernel_debug_name_t[KERNEL_DEBUG_NAME_MAX]; + #endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */ diff --git a/include/mach_debug/pc_info.h b/include/mach_debug/pc_info.h index bc43fa8d..912da9fd 100644 --- a/include/mach_debug/pc_info.h +++ b/include/mach_debug/pc_info.h @@ -40,4 +40,4 @@ typedef struct sampled_pc { typedef sampled_pc_t *sampled_pc_array_t; typedef unsigned int sampled_pc_seqno_t; -#endif _MACH_DEBUG_PC_INFO_H_ +#endif /* _MACH_DEBUG_PC_INFO_H_ */ diff --git a/include/string.h b/include/string.h index c77d387b..c31b4292 100644 --- a/include/string.h +++ b/include/string.h @@ -32,7 +32,7 @@ extern void *memcpy (void *dest, const void *src, size_t n); extern void *memmove (void *dest, const void *src, size_t n); -extern int memcmp (const void *s1, const void *s2, size_t n); +extern int memcmp (const void *s1, const void *s2, size_t n) __attribute__ ((pure)); extern void *memset (void *s, int c, size_t n); @@ -46,11 +46,11 @@ extern char *strrchr (const char *s, int c); extern char *strsep (char **strp, const char *delim); -extern int strcmp (const char *s1, const char *s2); +extern int strcmp (const char *s1, const char *s2) __attribute__ ((pure)); -extern int strncmp (const char *s1, const char *s2, size_t n); +extern int strncmp (const char *s1, const char *s2, size_t n) __attribute__ ((pure)); -extern size_t strlen (const char *s); +extern size_t strlen (const char *s) __attribute__ ((pure)); extern char *strstr(const char *haystack, const char *needle); |