aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* x86_64: fix exception stack alignmentLuca Dariz2022-08-273-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * i386/i386/pcb.c: - increase alignment of pcb cache to 16 - ensure the stack is properly aligned when switching ktss * i386/i386/thread.h: - add padding tomake iss field end aligned to 16 bytes * i386/i386/trap.c: - ensure the state we get after the trap points to the correct place in the pcb structure When handling exceptions from IA-32e compatibility mode in user space, on a 64-bit kernel, the exception stack where error info is pushed needs to be aligned to 16 bytes (see Intel System Programming guide, $6.14.2) The exception stack frame is set in the middle of pcb->iss, but it's not always 16-byte aligned; to make sure it is, we increase the alignment of the pcb cache and add a padding field in the pcb structure. This issue resulted in a general protection failure due to CS being corrupted after a page fault. The corruption was happening when the exception stack frame was not properly aligned and a page fault happened; the error info was then pushed after re-aligning the stack, so the value of eflags was actually written in CS place and other fields were shifted too. It also makes sense to ensure this by adding two assertions, although these were primarly useful during debug. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-10-luca@orpolo.org>
* fix Task State Segment layout for 64 bitLuca Dariz2022-08-274-3/+36
| | | | | Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-7-luca@orpolo.org>
* enable user accessLuca Dariz2022-08-271-2/+2
| | | | | | | | The pmap module is a bit limited on 64 bit paging, so this should be refined when we'll be able to use addresses over 4G. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-6-luca@orpolo.org>
* fix console setting from cmdlineLuca Dariz2022-08-271-0/+5
| | | | | | | | The leading space prevents it working if console=comX is the only argument, so handle this case separately. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-5-luca@orpolo.org>
* fix register corruption in irq on qemuLuca Dariz2022-08-271-6/+6
| | | | | | | | | rbx was used to compute the irq index in iunit and ivect arrays, however it should be preserved by pushing it in to the stack. As a solution, we use rax instead, which is caller-saved. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-4-luca@orpolo.org>
* cleanup multibootLuca Dariz2022-08-275-204/+32
| | | | | | | | | * 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>
* x86_64 boothdr: Fix _start symbol for multiboot address overridesSamuel Thibault2022-08-271-7/+5
| | | | | | We shouldn't be needing that since we won't use a.out for 64bit, but using address override in the multiboot header could be useful at least for testing.
* add support for booting from grub with x86_64Luca Dariz2022-08-279-16/+280
| | | | | | | | | | | | | | | | | | | | | | | | * configure: compile for native x86_64 by default instead of xen * x86_64/Makefrag.am: introduce KERNEL_MAP_BASE to reuse the constant in both code and linker script * x86_64/ldscript: use a .boot section for the very first operations, until we reach long mode. This section is not really allocated, so it doesn't need to be freed later. The vm system is later initialized starting from .text and not including .boot * link kernel at 0x4000000 as the xen version, higher values causes linker errors * we can't use full segmentation in long mode, so we need to create a temporary mapping during early boot to be able to jump to high addresses * build direct map for first 4G in boothdr, it seems required by Linux drivers * add INTEL_PTE_PS bit definition to enable 2MB pages during bootstrap * ensure write bit is set in PDP entry access rights. This only applies to PAE-enabled kernels, mandatory for x86_64. On xen platform it seems to be handled differently Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-2-luca@orpolo.org>
* gnumach: Remove PCI_CFG2_* as a reserved ioport rangeDamien Zammit2022-08-231-4/+1
| | | | | | | | | | | | | PCI CONF2 access method was deprecated in PCI v2.0 Also, the conf2 ioport range is only activated for use as pci configuration space when conf1 registers are accessed in a particular sequence. Since the pci-arbiter does not access the conf1 forwarding register, we are safe to remove this completely from gnumach to allow normal I/O use of the conf2 range as modern hardware expects. Message-Id: <20220823032638.292813-1-damien@zamaudio.com>
* gnumach: vm_allocate_contiguous: Allow small power 2 alignmentsDamien Zammit2022-08-211-0/+4
| | | | | | | | | | This allows contiguous allocations aligned to values smaller than one page, but still a power of 2, by forcing the alignment to be to the nearest page. This works because PAGE_SIZE is a power of two. Message-Id: <20220821065732.269573-1-damien@zamaudio.com>
* dev_pager.c: fix wrong condition to remove entriesJoan Lledó2022-08-091-2/+2
| | | | | | | * device/dev_pager.c: * dev_pager_hash_delete() and dev_device_hash_delete(): * Fix condition to call kmem_cache_free(), it was being called always. * https://lists.gnu.org/archive/html/bug-hurd/2022-08/msg00002.html