aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use mach_port_name_t in a few more placesFlavio Cruz2022-12-034-10/+9
| | | | | A few places that I missed in 958686efa2175abe3f7044890c2c2370e29147f2. Message-Id: <Y4g+4THLC/1NvnkM@viriathus>
* Update ipc/ directory to use mach_port_name_tFlavio Cruz2022-11-3036-324/+339
| | | | | | | | | | | | | | | 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>
* Add missing gitignore rulesSamuel Thibault2022-11-292-0/+4
|
* Use portable rpc types to define 'struct sample'.Flavio Cruz2022-11-283-7/+13
| | | | 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-282-44/+0
| | | | | mach/pc_sample.h has the definitions that the kernel actually uses. Message-Id: <Y4QKGtUdbz+AVO3l@viriathus>
* x86_64: fix buildSamuel Thibault2022-11-271-1/+1
|
* Revert "x86_64: fix installing x86_64-specific headers"Samuel Thibault2022-11-271-17/+17
| | | | | | | | This reverts commit 8c58257c4da364ffcb797f9d454c37de939a052b. These headers are actually coming from i386. This change was making `make dist` try to build the x86_64/include/mach/x86_64 directory in the dist tarball.
* vm_wire_all: Fix vm_map_protect caseSamuel Thibault2022-11-271-1/+2
| | | | | | | | | | | If a "wire_required" process calls vm_map_protect(0), the memory gets unwired as expected. But if the process then calls vm_map_protect(VM_PROT_READ) again, we need to wire that memory. (This happens to be exactly what glibc does for its heap) This fixes Hurd hangs on lack of memory, during which mach was swapping pieces of mach-defpager out.
* Update kdb_kintr according to new interrupt stack layoutSamuel Thibault2022-11-274-6/+20
| | | | | | | | e2fcf261076b ("interrupt: Fix saving irq/ipl when linux drivers are disabled") changed the stack layout for interrupt handlers, but missed updating kdb_kintr's code that tries to mangle it. This restores the control-alt-d shortcut.
* Update mach_debug interfaces to use struct.Flavio Cruz2022-11-257-36/+109
| | | | | | | | | | | | | | | | | | | | | | 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-254-80/+0
| | | | Message-Id: <Y35PHuUNCFb6sQO0@viriathus>
* x86_64: Add missing int_entry_table entries for APICSamuel Thibault2022-11-151-0/+15
| | | | | 214866d58ac2 ("Add ioapic support disabled by default") missed adding them for x86_64.
* default_pager_types.defs: define existing struct types as true structsFlavio Cruz2022-11-111-4/+13
| | | | Message-Id: <Y23fab31RM6HcCyb@viriathus>
* interrupt: Fix passing parameter to splx_cli and ioapic_irq_eoiSamuel Thibault2022-11-101-2/+2
| | | | | | | e2fcf261076b (""interrupt: Fix saving irq/ipl when linux drivers are disabled") broke booting under some conditions, because the parameters were erroneously written 4 bytes too far for splx_cli and ioapic_irq_eoi to read them.
* doc: Add hints on using convenience variables in show commandsSamuel Thibault2022-11-061-0/+9
|
* 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>
* i386/pit: Tune delaysDamien Zammit2022-10-262-4/+22
| | | | | | | - Add half a clock tick for more accuracy - Start the pit countdown during pit_sleep - Add pit_mdelay and pit_udelay functions Message-Id: <20221025105502.222708-8-damien@zamaudio.com>
* linux drivers: Don't depend on curr_pic_mask for APICDamien Zammit2022-10-261-2/+2
| | | | Message-Id: <20221025105502.222708-7-damien@zamaudio.com>
* acpi: Add lapic_addrDamien Zammit2022-10-252-0/+3
| | | | | | Message-Id: <20221025105502.222708-5-damien@zamaudio.com> Co-authored-by: Almudena Garcia <liberamenso10000@gmail.com>
* bios32: Use phystokv() on low bios addressesDamien Zammit2022-10-251-5/+5
| | | | Message-Id: <20221025105502.222708-4-damien@zamaudio.com>
* proc_reg: Fix pushf/popfSamuel Thibault2022-10-251-6/+6
|
* kdb: Fix TODO for multiprocessorDamien Zammit2022-10-252-1/+4
| | | | Message-Id: <20221025105502.222708-2-damien@zamaudio.com>
* Fix when enabling APIC without SMPEtienne Brateau2022-09-262-10/+10
| | | | | | When we want to enable APIC, we must initialize the structure or otherwise, it will try to access to a not initialized memory addresses. Message-Id: <20220924163145.39894-1-etienne.brateau@gmail.com>
* 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.
* x86_64: ignore warningSamuel Thibault2022-09-181-0/+1
|
* interrupt: Fix saving irq/ipl when linux drivers are disabledSamuel Thibault2022-09-172-27/+68
| | | | | | | | | | | | | | When Linux drivers are disabled, in hardclock() the linux_timer_intr() call is dropped, and gcc can tail-recursion-optimize the call to clock_interrupt(). To do so, it overwrites the hardclock() parameters to suit the clock_interrupt parameters layout. This however means it thrashes the backups that the interrupt() function had made of irq/ipl, leading to mayhem. interrupt should thus really properly separate its irq/ipl backups from the interrupt function parameters. Thanks a lot to Etienne Brateau for the tricky investigation!
* kd_mouse: Fix warningSamuel Thibault2022-09-172-4/+5
|
* x86_64: fix warningSamuel Thibault2022-09-171-2/+2
|
* x86_64: fix buildSamuel Thibault2022-09-171-1/+1
|
* hack vm memory object proxy creation for vm arraysLuca Dariz2022-08-281-0/+7
| | | | | | | | | | | | | | | | * vm/memory_object_proxy.c: truncate vm array types as if they were the rpc_ version because MIG can't handle that. This rpc can't handle more than one element anyway. Note that the same issue with vm arrays is present at least with syscall emulation, but that functionality seems unused for now. A better fix could be to add a vm descriptor type in include/mach/message.h, but then probably we don't need to use the rpc_ types in MIG anymore, they would be needed only for the syscall definitions. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-15-luca@orpolo.org>
* copyinmsg: Set msgh_size inside copyinmsg rather than the callerSamuel Thibault2022-08-286-6/+11
| | | | | In the 32/64 conversion case it is copyinmsg that will know the eventual size.
* kmsg: factorize uint32_t into an alignment typeSamuel Thibault2022-08-281-2/+10
| | | | | and restore the checks for offset alignment in the message, even if currently it is trivially always alright.
* kmsg: fix msg body alignmentLuca Dariz2022-08-281-27/+22
| | | | | | | * ipc/ipc_kmsg.c: align msg body to 4 bytes as done in mig Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-7-luca@orpolo.org>
* x86_64: fix installing x86_64-specific headersSamuel Thibault2022-08-281-17/+17
|
* use port name type in mach_port_names()Luca Dariz2022-08-281-6/+6
| | | | | | | | | | * ipc/mach_port.c: use mach_port_name_t instead of mach_port_t, since they could have different size. Fortunately we can keep the same optimization about allocationg memory, since mach_port_type_t has the same size as a name. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-9-luca@orpolo.org>
* 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>
* sign-extend mask in vm_map() with 32-bit userspaceLuca Dariz2022-08-281-0/+5
| | | | | | | * vm/vm_user.c: sign-extend mask with USER32 Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-6-luca@orpolo.org>
* compute mach port size from the corresponding typeLuca Dariz2022-08-281-9/+3
| | | | | | | | * ipc/ipc_machdep.h: re-define PORT_T_SIZE_IN_BITS to be computed from mach_port_t instead of being hardcoded. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-5-luca@orpolo.org>
* Fix 64-to-32 copyoutSamuel Thibault2022-08-281-3/+5
| | | | We cannot assume that the processor is little-endian.
* fix argument passing to bootstrap modulesLuca Dariz2022-08-281-13/+9
| | | | | | | | * kern/bootstrap.c: use rpc_ vm types to put the bootstrap module arguments on the stack, make it consistent with user-space types. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-4-luca@orpolo.org>
* simplify ipc_kmsg_copyout_body() usageLuca Dariz2022-08-283-20/+10
| | | | | | | | | | * ipc/ipc_kmsg.h: change prototype of ipc_kmsg_copyout_body() * ipc/ipc_kmsg.c: change prototype and usage of ipc_kmsg_copyout_body() by incorporating common code * ipc/mach_msg.c: change usage of ipc_kmsg_copyout_body() Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-3-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-285-33/+79
| | | | | Now that mach/machine/vm_types.h uses stdint types, we have to ship a header that defines them.
* Fix building x86_64 xen platformSamuel Thibault2022-08-273-46/+38
| | | | | On Xen we do not have a separate boot section, we directly start at the kernel map address. We thus do not have a map shift.
* cleanup headers in printf.cLuca Dariz2022-08-271-2/+2
| | | | | | | | | * kern/printf.c: remove unnecessary #include and reorder This allows the file to be reused for minimal user-space tests. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-14-luca@orpolo.org>
* add rpc_versions for vm typesLuca Dariz2022-08-274-20/+84
| | | | | | | | | | | | | | | * 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-275-13/+25
| | | | | | | | | | | | | | | | | | | | * 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>
* fix warnings for 32 bit buildsLuca Dariz2022-08-279-5/+12
| | | | | Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-13-luca@orpolo.org>