aboutsummaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Load 64-bit ELFs on all 64-bit portsSergey Bugaev2024-03-271-2/+2
| | | | | Not only on x86_64. Message-ID: <20240327161841.95685-5-bugaevc@gmail.com>
* Use the x86_64 message ABI on all 64-bit portsSergey Bugaev2024-03-271-5/+5
| | | | Message-ID: <20240327161841.95685-4-bugaevc@gmail.com>
* Disable host_kernel_version() everywhere but on i386Sergey Bugaev2024-03-271-3/+3
| | | | | It's not only x86_64, none of new architectures are going to have it. Message-ID: <20240327161841.95685-3-bugaevc@gmail.com>
* Do not install device/input.hSamuel Thibault2024-03-151-106/+0
| | | | | | | | Is _IO{,R,W,WR} macros conflict with the glibc-provided macros and bring confusion as to what is supposed to be the right definition. There is currently no user of it anyway, the Hurd console driver has its own copy.
* Add thread_set_name RPC.Flavio Cruz2024-02-121-0/+8
| | | | | | | Like task_set_name, we use the same size as the task name and will inherit the task name, whenever it exists. This will be used to implement pthread_setname_np. Message-ID: <20240212062634.1082207-2-flaviocruz@gmail.com>
* Replace kernel header includes in include/mach/mach_types.h with forward ↵Flavio Cruz2024-02-122-11/+6
| | | | | | | | | | | | | | | declarations. I was trying to reuse TASK_NAME_SIZE in kern/thread.h but it was impossible because files included from kern/task.h end up requiring kern/thread.h (through percpu.h), creating a recursive dependency. With this change, mach_types.h only defines forward declarations and modules have to explicitly include the appropriate header file if they want to be able touch those structures. Most of the other includes are required because we no longer grab many different includes through mach_types.h. Message-ID: <20240212062634.1082207-1-flaviocruz@gmail.com>
* Add vm_pages_physSamuel Thibault2024-01-301-0/+10
| | | | | | | | For rumpdisk to efficiently determine the physical address, both for checking whether it is below 4GiB, and for giving it to the disk driver, we need a gnumach primitive (and that is not conditioned by MACH_VM_DEBUG like mach_vm_region_info and mach_vm_object_pages_phys are).
* expose MACH_MSG_USER_ALIGNMENT for manually-built messagesLuca Dariz2023-12-291-9/+10
| | | | Message-ID: <20231228194301.745811-11-luca@orpolo.org>
* Reorder mach_msg_type_t fields to ensure msgt_name and msgt_size are byte ↵Flavio Cruz2023-12-171-10/+10
| | | | | | | | aligned msgt_unused appears right after msgt_size since msgt_size can be reduced to only 8 bits in the future, so we leave the door opened to make msgt_unused 13 bits long.
* x86_64: Support 8 byte inlined port rights to avoid message resizing.Flavio Cruz2023-12-171-0/+18
| | | | | | | | | | If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a follow up but kept this patch simple for ease of review.
* Revert "Reorder mach_msg_type_t fields to ensure msgt_name and msgt_size are ↵Samuel Thibault2023-12-031-10/+10
| | | | | | byte aligned" This reverts commit 2db6b9b7b23b3bab944665b3b6012d24dd425d97.
* Revert "x86_64: Support 8 byte inlined port rights to avoid message resizing."Samuel Thibault2023-12-031-18/+0
| | | | This reverts commit 29d4bcaafc4c2040df27a6247603c68e7757205c.
* x86_64: Support 8 byte inlined port rights to avoid message resizing.Flavio Cruz2023-12-031-0/+18
| | | | | | | | | | | If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a follow up but kept this patch simple for ease of review. Message-ID: <ZWg00XzFPqqL1yF-@jupiter.tail36e24.ts.net>
* Reorder mach_msg_type_t fields to ensure msgt_name and msgt_size are byte ↵Flavio Cruz2023-12-031-10/+10
| | | | | | | | | aligned msgt_unused appears right after msgt_size since msgt_size can be reduced to only 8 bits in the future, so we leave the door opened to make msgt_unused 13 bits long. Message-ID: <ZWGT6a6GeqFAtOUn@jupiter.tail36e24.ts.net>
* Fix indentSamuel Thibault2023-11-121-4/+4
|
* mach/message.h: Fix C++98 buildSamuel Thibault2023-11-071-0/+2
| | | | static_assert was introduced in C++11.
* mach/message.h: Fix C++ buildSamuel Thibault2023-11-031-0/+5
|
* Update the 64bit RPC ABI to be simplerFlavio Cruz2023-09-251-5/+47
| | | | | | | | | | | | | | | | | * Make full use of the 8 bytes available in mach_msg_type_t by moving into the unused 4 bytes. This allows us to use 32bits for mach_msg_type_number_t whether we use the longform or not. * Make mach_msg_type_long_t exactly the same as mach_msg_type_t. Updating MiG is strongly encouraged since it will generate better code to handle this new format. After this change, any compatibility with compiled binaries for Hurd x86_64 will break since the message format is different. However, the new schema simplifies the overall ABI, without having "holes" and also avoids the need to have a 16 byte mach_msg_type_long_t. Was able to boot a basic system up to a bash shell. Message-Id: <ZIfqFe5bPNPeH4xg@jupiter.lan>
* mach_vm_object_pages: Extend for PAESamuel Thibault2023-08-283-0/+31
|
* x86_64: Fix loading ELF symbolsSamuel Thibault2023-08-121-3/+33
|
* elf64: Update namesSamuel Thibault2023-08-121-12/+12
| | | | | | | | | Apparently the ELF world changed their mind on the naming of integers, let's get coherent with it. Elf64_Quarter (16b) disappeared, replaced by Elf64_Half (now 16b instead of Elf64_32b). And previous Elf64_Half (16b) thus now need to be Elf64_Word (16b).
* Fix task_info for TASK_THREAD_TIMES_INFO.Flavio Cruz2023-05-171-0/+6
| | | | | | We are checking for the existence of time_value64_t but we didn't add that to the task_thread_times_info structure. Message-Id: <ZGRDbS0XIm1fJwkG@jupiter.tail36e24.ts.net>
* Keep host_get_kernel_version for USER32-on-x86_64 caseSamuel Thibault2023-05-111-1/+1
|
* Remove host_kernel_version RPC for x86_64Flavio Cruz2023-05-111-0/+4
| | | | | | | We can fast track the simplification of the RPC ABI for x86_64 if we don't have MACH_MSG_TYPE_STRING used in RPCs which forces msgt_size to use more than 8 bits. Message-Id: <ZFht+/9cVPHuV90D@jupiter.tail36e24.ts.net>
* Delete include/mach/rpc.hFlavio Cruz2023-05-061-34/+0
| | | | | File is unused. Message-Id: <ZFSSbAzZ+7KYKtOF@jupiter.tail36e24.ts.net>
* x86_64: Add CPU_TYPE_X86_64 CPU typeSamuel Thibault2023-05-061-0/+1
|
* Use mig_support.h prototypes instead of duplicating them.Flavio Cruz2023-05-021-3/+1
| | | | | | | | | * include/mach/mig_support.h: Drop the ifndef because this file is only used internally to compile gnumach. We export mig_support.h from glibc already. * kern/ipc_mig.c: len should be vm_size_t. * kern/ipc_mig.h: Drop duplicate prototypes. Message-Id: <ZFBjEk07CaQgx9Ru@jupiter.tail36e24.ts.net>
* Use c_string for dev_name_t in the device subsystem.Flavio Cruz2023-04-293-0/+31
| | | | | | | | | | | | Added device_open_new and device_open_new_request and reused the old MiG ID for xxx_device_set_status which has not been in used in the past decade. Note that device_open_new is gated on defining DEVICE_ENABLE_DEVICE_OPEN_NEW because otherwise some hurd servers wouldn't compile anymore unless patched. This macro allows us to control the rollout. Message-Id: <ZEi1LV+9ShuXqtcr@jupiter.tail36e24.ts.net>
* Update task_basic_info and thread_basic_info to include time_value64_t data.Flavio Cruz2023-04-272-0/+14
| | | | | | RPCs remain compatible with existing clients but if they know about the new size then we will populate the new fields. Message-Id: <ZDzPLCJccKeRB5Pd@mars.tail36e24.ts.net>
* Delete include/mach/default_pager_helper.defsFlavio Cruz2023-04-101-53/+0
| | | | | Not used. Message-Id: <ZDN13tll1jYc1jYh@jupiter.tail36e24.ts.net>
* Remove host_get_boot_info and host_get_kernel_boot_info since they are not used.Flavio Cruz2023-04-073-21/+2
| | | | | | host_get_kernel_boot_info was added recently to fix the use of MACH_MSG_TYPE_STRING. Message-Id: <ZC5Sz8a4FCT6IjCY@jupiter.tail36e24.ts.net>
* Make exception subcode a longSergey Bugaev2023-04-031-1/+1
| | | | | | | | | On EXC_BAD_ACCESS, exception subcode is used to pass the faulting memory address, so it needs to be (at least) pointer-sized. Thus, make it into a long. This requires matching changes in glibc and the Hurd. Message-Id: <20230319151017.531737-4-bugaevc@gmail.com>
* Remove bootstrap.defsSergey Bugaev2023-04-031-49/+0
| | | | | | | | | | | | As far as I can see, this file was imported in the very beginning of GNU Mach history, and unused since then. Nobody implements or uses this interface. GNU Mach uses a different way to pass the privileged ports to the bootstrap tasks: instead of the task(s) actively asking for the ports in an RPC, the ports are preemptively inserted into the IPC space(s) of the task(s), as configured by the boot script. Remove bootstrap.defs so as to not confuse anyone into thinking it works. Message-Id: <20230319151017.531737-3-bugaevc@gmail.com>
* Use c_string to define symtab_name_t.Flavio Cruz2023-04-032-17/+20
| | | | | | | | | | As mentioned in 5447f965, the c_string type correctly uses msgt_size/msgt_number, resulting in a more compact ABI that doesn't require mach_msg_type_long_t. I redefined host_load_symbol_table with a new Id since this is just a debug RPC and is not used anywhere. Message-Id: <ZBFgyJp+Pcb7zFhf@mars.tail36e24.ts.net>
* Drop spurious tabsSamuel Thibault2023-03-131-11/+11
|
* Track task and thread time using time_value64_t.Flavio Cruz2023-03-131-0/+5
| | | | | | | | Changed kern/timer.c to use the higher precision time_value64_t. Of course, this won't suffer from the 2038 overflow but it does provide nanosecond precision (if gnumach ever uses a better timer) and moves us closer to only having time_value64_t. Message-Id: <ZA63tGcv3bETUJFJ@jupiter.tail36e24.ts.net>
* Use c_string to define host_get_kernel_version and host_get_kernel_boot_info.Flavio Cruz2023-03-132-0/+20
| | | | | | | | | | | | | | The existing definitions for kernel_version_t and kernel_boot_info_t use (MACH_MSG_TYPE_STRING, length*8) which result in message types that have a single element of 512 or 4096 bytes (set as msgt_size). This results in MiG generating mach_msg_type_long_t. Using c_string has the benefit of moving this size to be defined as msgt_number which doesn't overflow. This will allow us to simplify the 64 bit RPC ABI since all msgt_size can be defined with just 8 bits (as it should be expected). The resulting implementation is the same but we still need to define new RPCs since server and user expect different mach_msg_type_t. Message-Id: <ZA63pS8j9J6NwuXY@jupiter.tail36e24.ts.net>
* Align mach_msg_type_t and mach_msg_type_long_t with the same alignment as ↵Flavio Cruz2023-03-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | uintptr_t. With this change, any 64 bit code using the IPC subsystem without relying on MiG will work without any changes. We have a few examples of this inside gnumach but also in the Hurd servers. For example, in hurd/console/display.c typedef struct { mach_msg_header_t Head; mach_msg_type_t ticknoType; natural_t tickno; mach_msg_type_t changeType; file_changed_type_t change; mach_msg_type_t startType; loff_t start; mach_msg_type_t endType; loff_t end; } Request; This will now work correctly in 64 bits, without requiring any explicit padding. As a follow up, we can simplify mach_msg_type_long_t so that we only need an 8 byte structure where the second field will include the number of elements for the long form. This is already included in mach_msg_type_t as unused_msgtl_number. Message-Id: <ZAbhOfOzsb8qPFs6@jupiter.tail36e24.ts.net>
* Support alignment requirements for a 64 bit kernel.Flavio Cruz2023-02-271-10/+24
| | | | | | | | | | | | | We introduce both a user alignment and a kernel alignment. These are separate requirements since for 64 bit with a 32 bit kernel we need to ensure the kernel can consume messages that are 8-byte aligned. This change removes any possibility of undefined behavior and also allows the kernel to support 64 bit RPCs for the userland. A lot of the code that performs alignment was simplified under the assumption that the message headers are well aligned. To enforce that going forward, a few static assertions were added. Message-Id: <Y/KrixiC9Njmu7ef@jupiter.tail36e24.ts.net>
* Add TIME_VALUE64_TO_TIMESPEC and TIMESPEC_TO_TIME_VALUE64Flavio Cruz2023-02-231-0/+12
| | | | | We can use these in userland with the new time_value64_t struct. Message-Id: <Y/RRck2JffqNenif@jupiter.tail36e24.ts.net>
* Delete include/mach/msg_type.hFlavio Cruz2023-02-201-42/+0
| | | | | File is not included anywhere. Message-Id: <Y/K1haNulJ63eDBd@jupiter.tail36e24.ts.net>
* x86_64: load Elf64 bootstrap modules if ! USER32Luca Dariz2023-02-161-0/+36
| | | | | | | | | * i386/include/mach/i386/exec/elf.h: add Elf64 definitions and define common Elf structures, corresponding to 32/64 bit variants at compile time. * include/mach/exec/elf.h: add Elf64 definitions * kern/elf-load.c: use common Elf structures Message-Id: <20230216213318.2048699-2-luca@orpolo.org>
* Make mach_msg_header_t have the same size for both 64 bit kernel and userland.Flavio Cruz2023-02-131-2/+13
| | | | | | | | This has several advantages: 1) We don't need to resize mach_msg_header_t, it is just a copy. 2) Mig won't require any changes because it statically computes the size of mach_msg_header_t, otherwise we would need two sizes (28 vs 32 bytes). Message-Id: <Y+l8UhXXX9Qo9tVA@jupiter.tail36e24.ts.net>
* time_value: Fix rpc_time_value_t compatibility.Samuel Thibault2023-02-131-1/+6
| | | | | | | 5fdc928d3d29 ("fix rpc time value for 64 bit") broke hurd build because structures are never compatible in C. For userland we however know that rpc_time_value is the same as time_value, so we can just typedef rpc_time_value_t to struct time_value as userland is used to.
* Consider protected payloads in mach_msg_header_t when resizing messages.Flavio Cruz2023-02-121-1/+8
| | | | | | | | | | Protected payloads will be 8-byte longs which are the same size as kernel ports. Also aligned all the structures to be 4-byte aligned since it makes it easier to parse them as padding won't be added to mach_msg_user_header_t before the protected payload. Message-Id: <Y+krwRFIUeyRszl9@jupiter.tail36e24.ts.net>
* fix rpc time value for 64 bitLuca Dariz2023-02-122-8/+8
| | | | | | | | | | | | * include/mach/task_info.h: use rpc variant of time_value_t * include/mach/thread_info.h: Likewise * kern/mach_clock.c: use rpc variant of time_value_t in read_time_stamp() * kern/mach_clock.h: Likewise * kern/thread.c: use rpc variant of thread_read_times() * kern/timer.h_ add thread_read_times_rpc() by converting time_value_t to the corresponding rpc structures inline. Message-Id: <20230212170313.1501404-5-luca@orpolo.org>
* Define rpc_vm_size_array_t and rpc_vm_offset_array_tFlavio Cruz2023-01-311-3/+5
| | | | | | | | | | When generating stubs, Mig will will take the vm_size_array_t and define the input request struct using rpc_vm_size_t since the size is variable. This will turn cause a mismatch between types (vm_size_t* vs rpc_vm_size_t*). We could also ask Mig to produce a prototype by using rpc_vm_size_t*, however we would need to change the implementation of the RPC to use rpc_* types anyway since we want to avoid another allocation of the array. Message-Id: <Y9iwScHpmsgY3V0N@jupiter.tail36e24.ts.net>
* Add host_set_time64 and host_adjust_time64Flavio Cruz2023-01-281-0/+18
| | | | | | Same existing logic, just with 64 bits. Old RPCs are implemented by calling into the new RPCs. Message-Id: <Y9TJAmL2byOWup5x@jupiter.tail36e24.ts.net>
* Use standard types in include/device/input.hFlavio Cruz2023-01-281-2/+2
| | | | | | | | | | --enable-platform=xen won't compile because u_char is not included from sys/types.h. Also, we are forcing users of include/device/input.h to include glibc headers that export such types which should not be necessary. For i386/i386at/kd.h we include input.h to get Scancode. Message-Id: <Y9S7oIyVFazVAOqb@jupiter.tail36e24.ts.net>
* 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