aboutsummaryrefslogtreecommitdiff
path: root/include/mach
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Update mach_debug interfaces to use struct.Flavio Cruz2022-11-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* 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-061-18/+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
|
* add rpc_versions for vm typesLuca Dariz2022-08-271-3/+28
| | | | | | | | | | | | | | | * 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
|
* Add yet more const string typesSamuel Thibault2022-01-161-0/+1
|
* 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 *.
* memory_object_proxy: Explicit that creation wants a send rightSamuel Thibault2021-08-091-2/+2
| | | | This is required anyway, and allows the caller to pass on MAKE_SEND.
* gsync: Use vm_address_t instead of vm_offset_tSamuel Thibault2020-12-011-4/+4
| | | | | | | vm_offset_t are offsets inside memory objects, not actual addresses. * include/mach/gnumach.defs (gsync_wait, gsync_wake, gsync_requeue): Use vm_address_t instead of vm_offset_t.
* Add vm_allocate_contiguous RPCSamuel Thibault2020-07-091-0/+24
| | | | | | | | | | | | | | | | | This allows privileged userland drivers to allocate buffers for e.g. DMA, and thus need them to be physically contiguous and get their physical address. Initial work by Zheng Da, reworked by Richard Braun, Damien Zammit, and myself. * doc/mach.texi (vm_allocate_contiguous): New RPC. * i386/include/mach/i386/machine_types.defs (rpc_phys_addr_t): New type. * i386/include/mach/i386/vm_types.h [!MACH_KERNEL] (phys_addr_t): Set type to 64bits. (rpc_phys_addr_t): New type, always 64bits. * include/mach/gnumach.defs (vm_allocate_contiguous):New RPC. * vm/vm_user.c (vm_allocate_contiguous): New function.
* Add experimental RPC infrastructureSamuel Thibault2020-07-091-0/+15
| | | | | | | | | | | | | | | | This is free for experimenting RPCs, with no backward compatibility guarantees. * Makefrag.am (EXTRA_DIST): Add kern/experimental.srv. (include_mach_HEADERS): Add include/mach/experimental.defs. (nodist_lib_dep_tr_for_defs_a_SOURCES): Add kern/experimental.server.defs.c. (nodist_libkernel_a_SOURCES): Add kern/experimental.server.h, kern/experimental.server.c, kern/experimental.server.msgids. (nodist_libkernel_a_SOURCES): Add kern/experimental.server.defs. * include/mach/experimental.defs: New file. * kern/experimental.srv: New file. * kern/ipc_kobject.c: Include <kern/experimental.server.h>. (ipc_kobject_server): Call experimental_server_routine.
* include/mach/xen.h: Add 64bit variantSamuel Thibault2020-03-281-0/+4
| | | | * include/mach/xen.h (PFN_LIST): Set to MACH2PHYS_VIRT_START.
* patch: add last_processor to thread info structuresAlmudena Garcia2019-10-271-0/+1
| | | | | | | * include/mach/thread_info.h (thread info structures): Add new member "last_processor" in thread_sched_info. * kern/thread.c (thread management): Fill new member "last_processor" in thread_info() function.
* Add vm_object_sync supportSamuel Thibault2018-11-034-0/+61
| | | | | | | | | | | | | * include/mach/vm_sync.h: New file. * include/mach/mach_types.h: Include <mach/vm_sync.h> * Makefrag.am (include_mach_HEADERS): Add include/mach/vm_sync.h. * include/mach/mach_types.defs (vm_sync_t): Add type. * include/mach/gnumach.defs (vm_object_sync, vm_msync): Add RPCs. * vm/vm_map.h: Include <mach/vm_sync.h>. (vm_map_msync): New declaration. * vm/vm_map.c (vm_map_msync): New function. * vm/vm_user.c: Include <mach/vm_sync.h> and <kern/mach.server.h>. (vm_object_sync, vm_msync): New functions.
* Fix typoSamuel Thibault2018-11-031-1/+1
|
* Add const MIG typesSamuel Thibault2018-01-281-0/+1
| | | | | | * i386/include/mach/i386/mach_i386_types.h (const_descriptor_list_t): New type. * include/mach/port.h (const_mach_port_array_t): New type.
* VM: add the vm_wire_all callRichard Braun2016-12-243-0/+46
| | | | | | | | | | | | | | | | | This call maps the POSIX mlockall and munlockall calls. * Makefrag.am (include_mach_HEADERS): Add include/mach/vm_wire.h. * include/mach/gnumach.defs (vm_wire_t): New type. (vm_wire_all): New routine. * include/mach/mach_types.h: Include mach/vm_wire.h. * vm/vm_map.c: Likewise. (vm_map_enter): Automatically wire new entries if requested. (vm_map_copyout): Likewise. (vm_map_pageable_all): New function. vm/vm_map.h: Include mach/vm_wire.h. (struct vm_map): Update description of member `wiring_required'. (vm_map_pageable_all): New function. * vm/vm_user.c (vm_wire_all): New function.
* include: Fix new task notifications.Justus Winter2016-11-011-2/+5
| | | | | | | | Instead of copying the send right, move it. This fixes a send-right leak. * include/mach/task_notify.defs (task_move_t): New type. (mach_notify_new_task): Use the new type.
* Make task notification ports mutable.Justus Winter2016-10-131-1/+21
| | | | | * include/mach/task_notify.defs (task_notify_port_t): New type. (mach_notify_new_task): Use the specialized type.
* Remove deprecated external memory management interface.Justus Winter2016-10-033-67/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NEWS: Update. * device/dev_pager.c (device_pager_data_request): Prune unused branch. (device_pager_data_request_done): Remove function. (device_pager_data_write): Likewise. (device_pager_data_write_done): Likewise. (device_pager_copy): Use 'memory_object_ready'. * device/dev_pager.h (device_pager_data_write_done): Remove prototype. * device/device_pager.srv (memory_object_data_write): Remove macro. * doc/mach.texi: Update documentation. * include/mach/mach.defs (memory_object_data_provided): Drop RPC. (memory_object_set_attributes): Likewise. * include/mach/memory_object.defs: Update comments. (memory_object_data_write): Drop RPC. * include/mach/memory_object_default.defs: Update comments. * include/mach_debug/vm_info.h (VOI_STATE_USE_OLD_PAGEOUT): Drop macro. * vm/memory_object.c (memory_object_data_provided): Remove function. (memory_object_data_error): Simplify. (memory_object_set_attributes_common): Make static, remove unused parameters, simplify. (memory_object_change_attributes): Update callsite. (memory_object_set_attributes): Remove function. (memory_object_ready): Update callsite. * vm/vm_debug.c (mach_vm_object_info): Adapt to the changes. * vm/vm_object.c (vm_object_bootstrap): Likewise. * vm/vm_object.h (struct vm_object): Drop flag 'use_old_pageout'. * vm/vm_pageout.c: Update comments. (vm_pageout_page): Simplify.
* Lightweight synchronization mechanismAgustina Arzille2016-04-152-0/+58
| | | | | | | | | | | | * Makefrag.am (libkernel_a_SOURCES): Add kern/gsync.c and kern/gsync.h. * include/mach/gnumach.defs (gsync_wait, gsync_wake, gsync_requeue): New routines. * include/mach/kern_return.h (KERN_TIMEDOUT, KERN_INTERRUPTED): New error codes. * kern/gsync.c: New file. * kern/gsync.h: New file. * kern/startup.c: Include <kern/gsync.h> (setup_main): Call gsync_setup.
* Fix bootstraping issues with stdint.h.Flavio Cruz2016-04-051-1/+0
| | | | | * include/mach/std_types.h: Do not include stdint.h. * kern/rdxtree.h: Replace sys/types.h with stdint.h.
* Use uint32_t instead of unsigned32_t.Flavio Cruz2016-04-042-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement stdint.h and use it in gnumach. Remove old type definitions such as signed* and unsigned*. * Makefile.am: Add -ffreestanding. * i386/i386/xen.h: Use uint64_t. * i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t. * i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*, unsigned* and signed* types. * i386/xen/xen.c: Use uint64_t. * include/device/device_types.defs: Use uint32_t. * include/mach/std_types.defs: Use POSIX types. * include/mach/std_types.h: Include stdint.h. * include/stdint.h: New file with POSIX types. * include/sys/types.h: Include stdint.h. * ipc/ipc_kmsg.c: Use uint64_t. * kern/exception.c: Use uint32_t. * linux/dev/include/linux/types.h: Remove POSIX types. * xen/block.c: Use uint64_t. * xen/net.c: Do not use removed unsigned*_t types. * xen/ring.h: Use uint32_t instead. * xen/store.c: Use uint32_t. * xen/store.h: Use uint32_t. * xen/time.c: Use POSIX types only. * xen/time.h: Use uint64_t.
* include: avoid generating unused client stubsJustus Winter2016-02-261-0/+41
| | | | | | * include/mach/mach.defs: Avoid generating unused client stubs, some of which use an unreasonable amount of stack space and showed up in compiler warnings.
* Add macros to convert between time_value_t and timespecFlávio Cruz2015-09-191-0/+12
| | | | | * include/mach/time_value.h (TIME_VALUE_TO_TIMESPEC, TIMESPEC_TO_TIME_VALUE): New macros
* kern: use proper memory fences when handling the mapped timeJustus Winter2015-09-071-0/+2
| | | | | | | | * include/mach/time_value.h (struct mapped_time_value): Adjust comment. * kern/mach_clock.c (mtime): Likewise. Also make it volatile. (update_mapped_time): Use full hardware barriers. (read_mapped_time): New macro with proper fences. (record_time_stamp, host_get_time): Use the new macro.
* include: provide time-value substractionJustus Winter2015-07-251-7/+24
| | | | | | | | | * include/mach/time_value.h (time_value_assert): New macro to assert that the given value is well-formed. (time_value_add_usec): Use the new macro. (time_value_sub_usec): New macro. (time_value_add): Use `time_value_add_usec'. (time_value_sub_usec): New macro.
* Allow non-privileged tasks to wire 64KiB task memorySamuel Thibault2015-07-091-1/+1
| | | | | | | | | | | | | | | | | * doc/mach.texi (vm_wire): Document that the host port does not have to be privileged. * include/mach/mach_hosts.defs (vm_wire): Use mach_port_t instead of host_priv_t. * vm/vm_map.h (vm_map): Add user_wired field. * vm/vm_map.c (vm_map_setup): Initialize user_wired field to 0. (vm_map_pageable_common, vm_map_entry_delete, vm_map_copy_overwrite, vm_map_copyout_page_list, vm_map_copyin_page_list): When switching user_wired_count field of entry between 0 and non-0, accumulate the corresponding size into the user_wired field of map. * vm/vm_user.c (vm_wire): Turn host parameter into port parameter, and inline a version of convert_port_to_host_priv which records whether the host port is privileged or not. When it is not privileged, check whether the additional amount to user_wired will overcome 64KiB.
* include: Fix typos in comments (found by codespell)Stefan Weil2015-01-022-2/+2
| | | | Signed-off-by: Stefan Weil <sw@weilnetz.de>
* include: add X_IMPORTS to ipc definitionsJustus Winter2014-12-093-0/+12
| | | | | | | | This makes it possible to inject imports. * include/mach/gnumach.defs: Make it possible to inject imports. * include/mach/mach.defs: Likewise. * include/mach/mach_host.defs: Likewise.
* kern: provide notifications about new tasksJustus Winter2014-12-092-0/+44
| | | | | | | | | | | | | | These notifications are sent to the port registered via `register_new_task_notification' and provide a robust parental relation between tasks to a userspace server. * Makefrag.am: Add task_notify.defs. * include/mach/gnumach.defs: Add register_new_task_notification. * include/mach/task_notify.defs: New file. * kern/task.c (new_task_notification): New variable. (task_create): Send new task notifications. (register_new_task_notification): Add server function. * kern/task_notify.cli: New file.
* Retire procedure `old_mach_port_get_receive_status'Justus Winter2014-12-093-10/+3
| | | | | | | | | | | | | | | Retire the compatibility RPC `old_mach_port_get_receive_status' that works like `mach_port_get_receive_status' but returns an `old_mach_port_status' object that lacks the `mps_seqno' field. Do not remove the type yet, so we do not break anyones build. The RPC stubs currently distributed with the glibc require it. * include/mach/mach_port.defs (old_mach_port_get_receive_status): Drop RPC. * include/mach/mach_types.defs (old_mach_port_status_t): Drop type. * include/mach/port.h (old_mach_port_status_t): Add note to remove this for the 1.6 release. * ipc/mach_port.c (old_mach_port_get_receive_status): Drop function.
* include: make `mach_port_t' payload-awareJustus Winter2014-11-281-1/+7
| | | | | | | | | | | | Honor a new macro `MACH_PAYLOAD_TO_PORT' to inject a translation function mapping payloads to port names in the definition of `mach_port_t'. * include/mach/std_types.defs (mach_port_t): Honor `MACH_PAYLOAD_TO_PORT'. * include/device/device.defs (reply_port_t): Likewise. * include/device/device_reply.defs (reply_port_t): Likewise. * include/device/device_request.defs (reply_port_t): Likewise.
* include: add a payload-aware intran mutator for notify_port_tJustus Winter2014-11-031-0/+3
| | | | | * include/mach/notify.defs (notify_port_t): Add a payload-aware intran mutator.
* include: add a payload-aware intran mutator for memory_object_tJustus Winter2014-11-032-0/+16
| | | | | | | * include/mach/mach_types.defs (memory_object_t): Add a payload-aware intran mutator. * include/mach/memory_object.defs: Likewise in the inlined type declarations.
* include: define MACH_MSG_TYPE_PROTECTED_PAYLOADJustus Winter2014-10-011-1/+3
| | | | | | | * include/mach/message.h: Define MACH_MSG_TYPE_PROTECTED_PAYLOAD. (MACH_MSG_TYPE_LAST): Adjust accordingly. * doc/mach.texi (Message Format): Document MACH_MSG_TYPE_PROTECTED_PAYLOAD.