summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-01Spurious change to x86_64/locore.Sfeat-smp-leftoversDamien Zammit
2022-10-01Spurious changes to interrupt.SDamien Zammit
2022-10-01Not sure if this is relevant or requiredDamien Zammit
2022-10-01Upstreaming AlmuHS' SMP workDamien Zammit
2022-10-01Add cpuboot and cpu_number for i386Damien Zammit
2022-09-26Fix when enabling APIC without SMPEtienne Brateau
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>
2022-09-18std_types: Drop char, short and int type definitionsSamuel Thibault
These are provided by mig since ecf59842e472 ("Make MIG recognize the basic C integral types."), released in snapshot v1.8+git20200618.
2022-09-18x86_64: ignore warningSamuel Thibault
2022-09-17interrupt: Fix saving irq/ipl when linux drivers are disabledSamuel Thibault
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!
2022-09-17kd_mouse: Fix warningSamuel Thibault
2022-09-17x86_64: fix warningSamuel Thibault
2022-09-17x86_64: fix buildSamuel Thibault
2022-08-28hack vm memory object proxy creation for vm arraysLuca Dariz
* 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>
2022-08-28copyinmsg: Set msgh_size inside copyinmsg rather than the callerSamuel Thibault
In the 32/64 conversion case it is copyinmsg that will know the eventual size.
2022-08-28kmsg: factorize uint32_t into an alignment typeSamuel Thibault
and restore the checks for offset alignment in the message, even if currently it is trivially always alright.
2022-08-28kmsg: fix msg body alignmentLuca Dariz
* 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>
2022-08-28x86_64: fix installing x86_64-specific headersSamuel Thibault
2022-08-28use port name type in mach_port_names()Luca Dariz
* 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>
2022-08-28fix host_info structure definitionLuca Dariz
* 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>
2022-08-28sign-extend mask in vm_map() with 32-bit userspaceLuca Dariz
* 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>
2022-08-28compute mach port size from the corresponding typeLuca Dariz
* 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>
2022-08-28Fix 64-to-32 copyoutSamuel Thibault
We cannot assume that the processor is little-endian.
2022-08-28fix argument passing to bootstrap modulesLuca Dariz
* 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>
2022-08-28simplify ipc_kmsg_copyout_body() usageLuca Dariz
* 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>
2022-08-28fix rpc types for KERNEL_USER stubsLuca Dariz
* 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>
2022-08-28Add missing const_mach_port_name_array_t typeSamuel Thibault
2022-08-28Fix inclusability of <mach/mach_types.h>Samuel Thibault
Now that mach/machine/vm_types.h uses stdint types, we have to ship a header that defines them.
2022-08-27Fix building x86_64 xen platformSamuel Thibault
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.
2022-08-27cleanup headers in printf.cLuca Dariz
* 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>
2022-08-27add rpc_versions for vm typesLuca Dariz
* 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>
2022-08-27add port name typesLuca Dariz
* 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>
2022-08-27fix warnings for 32 bit buildsLuca Dariz
Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628101054.446126-13-luca@orpolo.org>
2022-08-27x86_64: fix exception stack alignmentLuca Dariz
* 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>
2022-08-27fix Task State Segment layout for 64 bitLuca Dariz
Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-7-luca@orpolo.org>
2022-08-27enable user accessLuca Dariz
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>
2022-08-27fix console setting from cmdlineLuca Dariz
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>
2022-08-27fix register corruption in irq on qemuLuca Dariz
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>
2022-08-27cleanup multibootLuca Dariz
* 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>
2022-08-27x86_64 boothdr: Fix _start symbol for multiboot address overridesSamuel Thibault
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.
2022-08-27add support for booting from grub with x86_64Luca Dariz
* 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>
2022-08-23gnumach: Remove PCI_CFG2_* as a reserved ioport rangeDamien Zammit
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>
2022-08-21gnumach: vm_allocate_contiguous: Allow small power 2 alignmentsDamien Zammit
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>
2022-08-09dev_pager.c: fix wrong condition to remove entriesJoan Lledó
* 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
2022-07-20Complete no-pie flagsSamuel Thibault
* Makefile.am (AM_CFLAGS): Add -fno-PIE -fno-pie as well.
2022-05-27convert K&R into ansiGuy-Fleury Iteriteka
Message-Id: <Yo+lzS7RtW5ZjQHN@debian>
2022-05-02convert k&R to ansi.Guy-Fleury Iteriteka
Message-Id: <Ym+Of2H8SFEuUw9K@debian>
2022-04-03remove the old_mach_port_status_t as it's unusedLuca Dariz
* include/mach/port.h: - remove the old_mach_port_status_t as it's unused.
2022-03-13device intr: Return an error on bogus intr portSamuel Thibault
Rather than risking dereferencing NULL.
2022-03-13device intr: Fix hypothetical NULL dererefenceSamuel Thibault
2022-03-13device: Fix NULL dereferenceSamuel Thibault