aboutsummaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Rename msg_is_misaligned and msg_alignSamuel Thibault2023-01-191-2/+2
| | | | message.h is installed so we need to hide these behind a mach_ prefix
* Add host_get_time64 RPC to return the time as time_value64_tFlavio Cruz2023-01-193-13/+44
| | | | | | Also updated the mapped time to support the new 64-bit time while keeping compatible with the user land programs currently using it so they can be migrated in parallel.
* replace mach_port_t with mach_port_name_tLuca Dariz2023-01-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a cleanup following the introduction of mach_port_name_t. The same set of changes is applied to all files: - rename mach_port_t to mach_port_name_t where a port name is used, - use MACH_PORT_NAME_NULL and MACH_PORT_NAME_DEAD where appropriate, - use invalid_port_to_name() and invalid_name_to_port() for conversion where appropriate, - use regular copyout() insted of copyout_port() when we deal with mach_port_name_t already before copyout, - use the new helper ipc_kmsg_copyout_object_to_port() when we really want to place a port name in the space of a mach_port_t. * include/mach/notify.h: Likewise * ipc/ipc_entry.c: Likewise * ipc/ipc_kmsg.c: Likewise * ipc/ipc_kmsg.h: Likewise, and add ipc_kmsg_copyout_object_to_port() * ipc/ipc_marequest.c: Likewise * ipc/ipc_object.c: Likewise * ipc/ipc_port.c: Likewise * ipc/ipc_space.h: Likewise * ipc/mach_msg.c: Likewise * ipc/mach_port.c: Likewise * kern/exception.c: Likewise * kern/ipc_mig.c: Likewise Message-Id: <20230116105857.240210-8-luca@orpolo.org>
* add conversion helpers for invalid mach port namesLuca Dariz2023-01-181-2/+6
| | | | | | | | * include/mach/port.h: add _NAME_ variants for port NULL and DEAD and add helpers to check for invalid port names * ipc/port.h: add helpers to properly convert to/from invalid mach port names. Message-Id: <20230116105857.240210-7-luca@orpolo.org>
* update writev syscall signature with rpc typesLuca Dariz2023-01-181-0/+4
| | | | | | | | | | * device/device_emul.h: write/writev: update trap argument types * device/ds_routines.c: update argument types and adjust copyin * device/ds_routines.h: write/writev: update trap argument type * include/device/device_types.h: add rpc_io_buf_vec_t type * kern/ipc_mig.c: write/writev: update trap argument type * kern/ipc_mig.h: Likewise Message-Id: <20230116105857.240210-5-luca@orpolo.org>
* update syscall signature with rpc_vm_* and mach_port_name_tLuca Dariz2023-01-181-14/+4
| | | | | | | | | * include/mach/mach_types.h: use mach port names * kern/ipc_mig.c: update vm types and use copyin/copyout helpers * kern/ipc_mig.h: Likewise Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20230116105857.240210-4-luca@orpolo.org>
* x86_64: expand and shrink messages in copy{in, out}msg routinesLuca Dariz2023-01-181-1/+13
| | | | | | | | | | | | | | | | | | | * i386/i386/copy_user.h: new file to handle 32/64 bit differences - add msg_usize() to recontruct the user-space message size - add copyin/copyout helpers for addresses and ports * include/mach/message.h: add msg alignment macros * ipc/ipc_kmsg.c: - copyin/out ports names instead of using pointer magic * ipc/ipc_mqueue.c: use msg_usize() to check if we can actually receive the message * ipc/mach_msg.c: Likewise for continuations in receive path * x86_64/Makefrag.am: add x86_64/copy_user.c * x86_64/copy_user.c: new file to handle message expansion and shrinking during copyinmsg/copyoutmsg for 64 bit kernels. - port names -> port pointers on all 64-bit builds - 32-bit pointer -> 64 bit pointer when using 32-bit userspace * x86_64/locore.S: remove copyinmsg() and copyoutmsg() Message-Id: <20230116105857.240210-3-luca@orpolo.org>
* add msg_user_header_t for user-side msg structureLuca Dariz2023-01-181-1/+16
| | | | | | | | | | | * include/mach/message.h: use mach_msg_user_header_t only in KERNEL, and define it as mach_msh_header_t for user space * ipc/ipc_kmsg.c: use mach_msg_user_header_t where appropriate * ipc/ipc_kmsg.h: Likewise * ipc/mach_msg.c: Likewise * ipc/mach_msg.h: Likewise * kern/thread.h: Likewise Message-Id: <20230116105857.240210-2-luca@orpolo.org>
* Delete ffs and strrchr prototypes.Flavio Cruz2023-01-151-4/+0
| | | | | | | | We use __builtin_ffs instead of ffs. strrchr is not used. Also removed the commented out memset implementation since it is implemented in arch-specific code. Message-Id: <Y8NOXbVzhBJknR29@mercury.tail36e24.ts.net>
* Use rpc_uintptr_t for protected payloads.Flavio Cruz2023-01-133-2/+4
| | | | | | | Not only is uintptr_t more accurate for what protected payloads are but we also provide compatibility for 64 + 32 bits. Also the use of natural_t in the RPC definition is wrong since it is always 32 bits. Message-Id: <Y7+LHVbmYxO/cSKs@jupiter.tail36e24.ts.net>
* Export input structures used by Hurd in device/input.h.Flavio Cruz2023-01-092-52/+106
| | | | | | Also delete sys/ioctl.h and merge it with device/input.h since it is only needed here. Message-Id: <Y7uirJzaJeOBzAmq@jupiter.tail36e24.ts.net>
* Introduce time_value64_t to keep track of real time in the kernelFlavio Cruz2023-01-032-54/+26
| | | | | | | | | | | | time_value64_t uses int64_t to track seconds and nanoseconds and hence is Y2038 proof. It does not have nano second resolution but it could be provided in the future. Removed include/sys/time.h as it remaps time_value_t into timeval which can create confusion. The timestamp from keyboard and mouse events is no longer set and replaced with rpc_time_value for better compatibility.
* Fix inttypes.h format constants for uintptr_t and intptr_t.Flavio Cruz2022-12-271-9/+11
| | | | | | | | The format constants are not correct for 32 bits and there was duplication for PRIx* constants (replaced with octal constants). Fixed a few format warnings too. Message-Id: <Y6o5KsvtPavCYe8f@mars>
* Use uintptr_t to define vm_size_t/vm_offset_t/vm_addressFlavio Cruz2022-12-271-5/+1
| | | | Message-Id: <Y6j9bnHphZp0ZPYC@mars>
* Use -Wstrict-prototypes and fix warningsFlavio Cruz2022-12-212-3/+1
| | | | | | | Most of the changes include defining and using proper function type declarations (with argument types declared) and avoiding using the K&R style of function declarations. Message-Id: <Y6Jazsuis1QA0lXI@mars>
* time_value: Fix usage in e.g. c89 programsSamuel Thibault2022-12-191-2/+2
| | | | | | The inline keyword was not defined there, so we need to use __inline__. This fixes make check in glibc.
* Remove custom stdint.h and rely on freestanding headersFlavio Cruz2022-12-192-73/+0
| | | | | GCC already provides this so we don't need to have our own. Message-Id: <Y5+02FVA6jf4GPgA@mars>
* Use long_natural_t for recnum_tFlavio Cruz2022-12-182-2/+12
| | | | | | | | | | | | For 64 bits, device operations will provide an addressing space of 64 bits. Also define the translation functions if long_natural_t or long_integer_t are ever used in RPCs. Note that MIG does not implicitly inherit the translation functions from types hence the need to redefine them for recnum_t. Message-Id: <Y59MFzekEA0YUXIw@mars>
* Use struct for time_value_t and define seconds as long_integer_t.Flavio Cruz2022-12-172-2/+38
| | | | | | | On 64 bit kernels, seconds will be 64 bits long and won't suffer from the 2038 problem. We also add a new type rpc_time_value_t to handle the conversion between 32 bit userland and 64 bit kernel. Message-Id: <Y50kIaIgaIdGjDAk@mars>
* Define vm_size_t and vm_offset_t as __mach_uintptr_t.Flavio Cruz2022-12-061-1/+1
| | | | | | | | | | This allows *printf to use %zd/%zu/%zx to print vm_size_t and vm_offset_t. Warnings using the incorrect specifiers were fixed. Note that MACH_PORT_NULL became just 0 because GCC thinks that we were comparing a pointer to a character (due to it being an unsigned int) so I removed the explicit cast. Message-Id: <Y47UNdcUF35Ag4Vw@reue>
* Make task_info.h structs more portableFlavio Cruz2022-12-063-22/+22
| | | | | | | | | | Changed vm_size_t to rpc_size_t so that both userland and kernel agree on the same size. Also changed the denominator for the maximum struct sizes to be integer_t to match the other declarations. Introduced long_natural_t and rpc_long_natural_t to represent large counters. Replaced rpc_unsigned_long with rpc_long_natural_t. Message-Id: <Y47UhaOzKnqhgYq4@reue>
* task: Add task_set_essentialSamuel Thibault2022-12-031-0/+8
| | | | | | | | Whenever a Hurd essential task crashes, startup just reboots the system since there's not much that can be done at that point. When we have a kernel debugger, however, we could at least get crashing information, so let's let Hurd's startup tell the kernel which tasks are essential, and trigger the debugger whenever they crash.
* Update ipc/ directory to use mach_port_name_tFlavio Cruz2022-11-302-5/+5
| | | | | | | | | | | | | | | Make it explicit where we use port names versus actual ports. For the 64 bit kernel, port names and ports are of different size so this corrects the syscall arguments and internal structs to have the right size. This patch also uncovered several issues we need to solve to make GNUMach work well on 64 bits. First, the mach_msg call will receive 4 byte port names while the kernel "thinks" they are 8 bytes, which will be a problem. Also, when we send a message, the kernel translates the port names into port pointers in the message copied from user space. This also won't work on 64 bits. In this patch, I added several TODOs to fix the issues later. Message-Id: <Y4cCzNmc6vC4bjsX@viriathus>
* Use portable rpc types to define 'struct sample'.Flavio Cruz2022-11-282-5/+11
| | | | Message-Id: <Y4QQFkTUR4M60Gx0@viriathus>
* Update mach_port_status_t definition to use the new structFlavio Cruz2022-11-282-8/+18
| | | | | Also update C definition to use proper types. Message-Id: <Y4QKgh0zHdB8pWhD@viriathus>
* Delete mach_debug/pc_info.hFlavio Cruz2022-11-281-43/+0
| | | | | mach/pc_sample.h has the definitions that the kernel actually uses. Message-Id: <Y4QKGtUdbz+AVO3l@viriathus>
* Update mach_debug interfaces to use struct.Flavio Cruz2022-11-255-36/+93
| | | | | | | | | | | | | | | | | | | | | | The new interfaces will be compatible both with a 64 bits kernel and userland and 64 bits kernel and 32 bit userland. Also removed many of the uses of natural_t where an unsigned int suffices. Ideally we should replace natural_t with something more portable such as uintptr_t or a basic int type for counters since for the most part we don't need counters to have the same width as the pointer type. * i386/include/mach/i386/vm_types.h: Define rpc_unsigned_long. * include/mach/mach_types.defs: Define type rpc_vm_offset_t. * include/mach_debug/hash_info.h: Use unsigned int instead of natural_t. * include/mach_debug/mach_debug_types.defs: Update cache_info_t, hash_info_bucket_t, vm_region_info_t, vm_object_info_t and vm_page_info_t to use struct. * include/mach_debug/slab_info.h: Use rpc_vm_size_t and rpc_unsigned_long for compatibility with 32 bits userland. * include/mach_debug/vm_info.h: Update struct fields to use the correct types and avoid natural_t whenever we just want to keep a count of something. Message-Id: <Y32lp1SuV01ImCx9@viriathus>
* Delete ipc_info.h since it is not usedFlavio Cruz2022-11-252-78/+0
| | | | Message-Id: <Y35PHuUNCFb6sQO0@viriathus>
* default_pager_types.defs: define existing struct types as true structsFlavio Cruz2022-11-111-4/+13
| | | | Message-Id: <Y23fab31RM6HcCyb@viriathus>
* Remove unused mig type definitions in gnumachFlavio Cruz2022-11-062-21/+0
| | | | | | | | | | | | | | | | | | | | | * include/mach/mach_types.defs: host_basic_info_data_t, host_sched_info_data_t, host_load_info_data_t, processor_basic_info_data_t, processor_set_basic_info_data_t, processor_set_sched_info_data_t, hread_basic_info_data_t, thread_sched_info_data_t, task_basic_info_data_t, task_events_info, task_thread_times_info_data_t, machine_info_data_t, machine_slot_data_t * include/mach_debug/mach_debug_types.defs: ipc_info_name_t, ipc_info_name_array_t Tested by bootstrapping a Hurd system from scratch. Message-Id: <Y2dD7Z60Bwybg4jF@viriathus>
* std_types: Drop char, short and int type definitionsSamuel Thibault2022-09-181-3/+0
| | | | | These are provided by mig since ecf59842e472 ("Make MIG recognize the basic C integral types."), released in snapshot v1.8+git20200618.
* copyinmsg: Set msgh_size inside copyinmsg rather than the callerSamuel Thibault2022-08-281-1/+1
| | | | | In the 32/64 conversion case it is copyinmsg that will know the eventual size.
* fix host_info structure definitionLuca Dariz2022-08-281-1/+1
| | | | | | | | | * include/mach/host_info.h: replace vm_size_t with rpc_ version for 64 bit compatibility. Ideally it should use phys_addr_t or another unit like KB or MB Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-8-luca@orpolo.org>
* fix rpc types for KERNEL_USER stubsLuca Dariz2022-08-281-5/+11
| | | | | | | | | | | | | | | * include/mach/mach_types.defs: use rpc_ vm types for KERNEL_USER stubs. This change fixes two use cases: * internal rpc, e.g. when a memory object is initialized as a consequence of vm_map(); for example, the bootstrap modules use the "time" kernel device and memory-map it during startup. This triggers a kernel-side rpc to initialize the memory object and install the map, which is completely transparent form user-space. * notifications from kernel to user-space Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-2-luca@orpolo.org>
* Add missing const_mach_port_name_array_t typeSamuel Thibault2022-08-281-0/+1
|
* Fix inclusability of <mach/mach_types.h>Samuel Thibault2022-08-281-25/+14
| | | | | Now that mach/machine/vm_types.h uses stdint types, we have to ship a header that defines them.
* add rpc_versions for vm typesLuca Dariz2022-08-272-15/+40
| | | | | | | | | | | | | | | * vm_types.h: add new types and conversion functions * mach_types.defs: adapt vm types depending on kernel user/server * vm_info.h: adapt rpc structure to have uniformly-sized members also on 64-bit * x86_64/configfrag.c: add new option to select the user-space variant. Note that with this change the user-space interface is somehow fixed, i.e. it can't support 32-bit and 64-bit tasks at the same time. If this would be needed at some point, this change needs to be reworked. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220403145955.120742-3-luca@orpolo.org>
* add port name typesLuca Dariz2022-08-273-9/+21
| | | | | | | | | | | | | | | | | | | | * include/mach/mach_port.defs - use C type mach_port_name_array_t * include/mach/port.h: - add new types mach_port_name_t and mach_port_name_array_t - refine mach_port_t type for user and kernel space - use port names in mach_port_status to allow compilation of 64-bit - use port name to have uniform sizes and remove the old_mach_port_status_t as it's unused * include/mach/std_types.defs - use C type mach_port_name_array_t * kern/thread.{h,c} - fix prototype to use port names. So far it seems the only rpc to cause a conflict between the mig-generated header and the regular header, so compilation fails. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220403145955.120742-2-luca@orpolo.org>
* cleanup multibootLuca Dariz2022-08-271-82/+0
| | | | | | | | | * use _raw_ structs where we refer to the bootloader-provided data * remove unused structures * fix 64 bit boot Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-3-luca@orpolo.org>
* remove the old_mach_port_status_t as it's unusedLuca Dariz2022-04-031-18/+0
| | | | | * include/mach/port.h: - remove the old_mach_port_status_t as it's unused.
* io_map: Fix using physical addressesSamuel Thibault2022-02-161-0/+4
|
* device_types: Add more const_ typesSamuel Thibault2022-01-161-0/+2
|
* typoSamuel Thibault2022-01-161-1/+1
|
* Add yet more const string typesSamuel Thibault2022-01-162-0/+2
|
* mach_debug_types: Add const_dev_name_tSamuel Thibault2022-01-161-0/+1
| | | | This will avoid forcing the caller to respect the definite string size.
* device_types: Add const_dev_name_tSamuel Thibault2022-01-161-0/+1
| | | | This will avoid forcing the caller to respect the definite string size.
* vm_region_get_proxy: rename to create_proxySergey Bugaev2021-11-071-1/+1
| | | | For coherency with memory_object_create_proxy.
* vm: vm_region_get_proxyJoan Lledó2021-11-071-0/+10
| | | | | | | | | To get a proxy to the region a given address belongs to, with protection and range limited to the region ones. * include/mach/mach4.defs: vm_region_get_proxy RPC declaration * vm/vm_map.c: vm_region_get_proxy implementation Message-Id: <20211106081333.10366-2-jlledom@mailfence.com>
* memory_object: Fix memory_object_t type in the kernelSamuel Thibault2021-11-071-2/+6
| | | | | | | | | | mach_port_t is for userland, kernel sees the translated ipc_port_t. * include/mach/memory_object.h [MACH_KERNEL]: Include ipc/ipc_types.h [MACH_KERNEL] (memory_object_t): Typedef to ipc_port_t instead of mach_port_t. (memory_object_array_t): Typedef to memory_object_t* instead of mach_port_t*.
* memory_object_create_proxy: Make len parameter vm_size_array_tSamuel Thibault2021-10-171-1/+2
| | | | | | | | | | | This is a no-op on i386. * i386/include/mach/i386/vm_types.h (vm_size_array_t): New type. * include/mach/mach4.defs (vm_size_array_t): New type. (memory_object_create_proxy): Turn len parameter from vm_offset_array_t to vm_size_array_t. * vm/memory_object_proxy.c (memory_object_create_proxy): Turn len parameter from const vm_offset_t * to const vm_size_t *.