summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-12-30Convert from K&R to ANSIv1.8+git202112301.8+git20211230Etienne Brateau
* device/dev_name.c: Convert function prototypes from K&R to ANSI. * device/subr.c: Convert function prototypes from K&R to ANSI. Message-Id: <20211230112249.13682-2-etienne.brateau@gmail.com>
2021-12-30kern/thread.c: some minor style changesAdam Kandur
Greeting, I have changed some stuff in kern/thread.c which makes code more readable for me. Maybe it will be usefull. Message-Id: <20211230082643.8171-1-sys.arch.adam@gmail.com>
2021-12-29ddb: Fix updating sp while progressing through framesSamuel Thibault
Notably trap/interrupt/syscall provide an exact SP value.
2021-12-29ddb: Unwind over RETSamuel Thibault
When we don't have a frame but PC points to a RET instruction (e.g. in the userland system call assembly code), we can trivially unwind it.
2021-12-28ddb: Fix accessing high memorySamuel Thibault
User processes loaded in high memory are not visible to ddb through the direct mapping. We can however read/write data through copy_from/to_phys.
2021-12-16rtc: drop message on setting RTC timeSamuel Thibault
We haven't seen the 2032 bug for a long time, f040677be3c0 ("kd: Do not read the CMOS ram") probably fixed it at last.
2021-12-16vm_wire: extend per-task wiring limit to 8MiBSamuel Thibault
Like Linux just did.
2021-11-28memmmap: Use biosmem_addr_available rather than vm_page_lookup_paSamuel Thibault
The segment code actually has vm_page entries for reserved pages, and thus memmmap would reject mapping ACPI pages. Taking the information from biosmem is much more precise, and indeed knows all hardware quirks which can now be dropped from memmmap.
2021-11-28Fix rejecting the mapping of some pagesSamuel Thibault
The memmmap method may reject some offsets (because it falls in non-device ranges), so device_map_page has to notice this and report the error. device_pager_data_request then has to notice as well and report.
2021-11-07vm_region_get_proxy: rename to create_proxySergey Bugaev
For coherency with memory_object_create_proxy.
2021-11-07Memory proxies: Add support for anonymous mappingsSergey Bugaev
* vm/vm_map.c (vm_region_get_proxy): - Return KERN_INVALID_ARGUMENT when the entry is a submap. - Create a pager for the vm_object when the entry doesn't have any yet, since it's an anonymous mapping. Message-Id: <20211106081333.10366-3-jlledom@mailfence.com>
2021-11-07vm: vm_region_get_proxyJoan Lledó
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>
2021-11-07memory_object_create_proxy: Fix and check coherency with RPCSamuel Thibault
* vm/memory_object_proxy.c: Include kern/mach4.server.h. (memory_object_create_proxy): Drop const qualifiers.
2021-11-07memory_object: Fix memory_object_t type in the kernelSamuel Thibault
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*.
2021-11-07Drop unused device_pager_releaseSamuel Thibault
* device/dev_pager.c (device_pager_release): Drop unused function.
2021-10-17memory_object_create_proxy: Make len parameter vm_size_array_tSamuel Thibault
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 *.
2021-09-23i386/i386/fpu.h: Fix xrstor and xrstors macrosSamuel Thibault
xrstor and xrstors also take the xsave support bitmask. We were otherwise not necessarily properly reloading all the FPU state, thus leading to various subtle bugs, notably with glibc 2.33's ifunc-optimized memcpy etc. * i386/i386/fpu.h (xrstor, xrstors): Pass fp_xsave_support in EDX:EAX.
2021-09-23i386/i386/fpu.h: Drop spurious backslashesSamuel Thibault
2021-09-18x86_64: Fix installation target of headersSamuel Thibault
* x86_64/Makefrag.am (include_mach_i386dir): Rename to include_mach_x86_64dir, set to $(includedir)/mach/x86_64. (include_mach_i386_HEADERS): Rename to include_mach_x86_64_HEADERS. Reported-by: Andrea Monaco <andrea.monaco@autistici.org>
2021-09-18replace obsolete AC_CONFIG_HEADER with AC_CONFIG_HEADERSMiguel Figueiredo
2021-09-12ahci: Do not even try AHCI identify when device is ATAPIAndrea Monaco
* linux/dev/drivers/block/ahci.c (ahci_probe_port): Avoid trying AHCI identify when PxCMD.ATAPI is set.
2021-09-12ahci: Fix warning contentAndrea Monaco
* linux/dev/drivers/block/ahci.c (ahci_identify): Fix warning for the identify timeout.
2021-08-28dev_pager: rename hash macrosJoan Lledó
Remove the reference to the pager hash since they are used both in the pager and the device hashes. * device/dev_pager.c: * Rename DEV_PAGER_HASH_COUNT to DEV_HASH_COUNT * Rename dev_pager_hash to dev_hash Message-Id: <20210828100252.18376-3-jlledom@mailfence.com>
2021-08-28dev_pager: implement offsetJoan Lledó
* device/dev_pager.c: * struct dev_pager: add offset field * new struct dev_device_entry: includes device and offset * new hash table dev_device_hashtable * index [device + offset] * new functions dev_device_hash[init,insert,delete,lookup] * do the same as their counterparts for dev_pager_hashtable * dev_pager_setup(): record the offset * device_map_page(): add the recorded offset on the fly Message-Id: <20210828100252.18376-2-jlledom@mailfence.com>
2021-08-28linux block: allow loading data up to 4GiB limitSamuel Thibault
Linux drivers are only limited by the DMA32 constraint, not by the directmap constraint. But our segment order is currently set to DMA < DMA32 < DIRECTMAP < HIGHMEM (since that is what we will have in 64bit mode). In PAE mode this makes DMA32 limited to 800MiB. Ideally we'd have DMA < DIRECTMAP < DMA32 < HIGHMEM but that'd make the memory code more complex, and we are to remove the Linux drivers anyway. In the meanwhile, In non-PAE mode we can just use HIGHMEM which is already limited to 4GiB, that will do the work. * linux/dev/glue/block.c (VM_PAGE_LINUX): New macro. (device_read): Use VM_PAGE_LINUX instead of VM_PAGE_DMA32.
2021-08-28linux: Use kvtophys instead of _kvtophysSamuel Thibault
_kvtophys only works with direct-mappable memory, which is scarse, better use kvtophys that can work with any kind of memory. * linux/src/include/asm-i386/io.h: Include <intel/pmap.h> (virt_to_phys): Use kvtophys instead of _kvtophys.
2021-08-27linux block: Fix checking block sector.Samuel Thibault
* linux/dev/glue/block.c (check_rw_block): Return 0 on no error.
2021-08-27vm_page_grab: allow allocating in high memorySamuel Thibault
vm_page_grab was systematically using the VM_PAGE_SEL_DIRECTMAP selector to play safe with existing code. This adds a flags parameter to let callers of vm_page_grab specify their constraints. Linux drivers need 32bit dmas, Xen drivers use kvtophys to clear some data. Callers of kmem_pagealloc_physmem and vm_page_grab_phys_addr also use kvtophys. Otherwise allocations can go to highmem. This fixes the allocation jam in the directmap segment. * vm/vm_page.h (VM_PAGE_DMA, VM_PAGE_DMA32, VM_PAGE_DIRECTMAP, VM_PAGE_HIGHMEM): New macros. (vm_page_grab): Add flags parameter. * vm/vm_resident.c (vm_page_grab): Choose allocation selector according to flags parameter. (vm_page_convert, vm_page_alloc): Pass VM_PAGE_HIGHMEM to vm_page_grab. (vm_page_grab_phys_addr): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * vm/vm_fault.c (vm_fault_page): Pass VM_PAGE_HIGHMEM to vm_page_grab. * vm/vm_map.c (vm_map_copy_steal_pages): Pass VM_PAGE_HIGHMEM to vm_page_grab. * kern/slab.c (kmem_pagealloc_physmem): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * i386/intel/pmap.c (pmap_page_table_page_alloc): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * xen/block.c (device_read): Pass VM_PAGE_DIRECTMAP to vm_page_grab. * linux/dev/glue/block.c (alloc_buffer): Pass VM_PAGE_DMA32 to vm_page_grab.
2021-08-23db_show_vmstat: Show segment name rather than its numberSamuel Thibault
2021-08-22db_show_vmstat: Also show segment sizeSamuel Thibault
* vm/vm_page.c (db_show_vmstat): Add printing the segment size.
2021-08-22db_show_vmstat: Drop duplicate outputSamuel Thibault
* vm/vm_page.c (db_show_vmstat): Drop displaying cache numbers a second time.
2021-08-21device_read: Add dealloc for dataSamuel Thibault
It would be very tricky for the server to manage deallocation for device_read, and does not seem useful anyway. device_reply.defs already has it. * include/device/device.defs (device_read): Add dealloc flag for the data array.
2021-08-21db show vmstat: also show segments statsSamuel Thibault
* vm/vm_page.c (db_show_vmstat)
2021-08-21db: Add show vmstat commandSamuel Thibault
with an output similar to the userland vmstat command * vm/vm_page.c (db_show_vmstat): New function. * vm/vm_page.h (db_show_vmstat): New prototype. * ddb/db_command.c (db_show_cmds): Add vmstat command.
2021-08-17block: Look out for disk sector number overflowSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_do_port_request): Reject sectors beyond LBA48 or LBA28. * linux/dev/glue/block.c (check_rw_block): New function. (rdwr_partial, rdwr_full): Use check_rw_block to reject block number overflows. * linux/src/drivers/block/ide.c (do_rw_disk): Reject sectors beyond LBA28 or CHS.
2021-08-12assert: Tell the compiler that failures are unlikelySamuel Thibault
2021-08-09memory_object_proxy: Deliver no-sender notifications on a separate portv1.8+git202108091.8+git20210809Samuel Thibault
Otherwise userland can send spurious notifications.
2021-08-09memory_object_proxy: Explicit that creation wants a send rightSamuel Thibault
This is required anyway, and allows the caller to pass on MAKE_SEND.
2021-08-09memory_object_proxy: Fix send port right leakSamuel Thibault
On success we'd have to clean the port right. Just consume it.
2021-08-09memory_object_proxy: Fix checking proxy lengthSamuel Thibault
We want to prevent subproxies from requesting larger sizes than what a proxy initially allowed.
2021-08-09Memory object proxy: add support for ranges and nestingJoan Lledó
2021-08-09memory_object_proxy: release resources on no-send notificationSamuel Thibault
2021-06-06vm_map: Allow exagerated max_prot for nowSamuel Thibault
glibc's mmap implementation assumes that gnumach will cap the prot for it, so for now let's revert back to capping rather than rejecting. That fixes mmap(SHARED|READ) for read-only objects.
2021-05-24Revert "vm_map: Allow passing the name of a memory object"Samuel Thibault
This reverts commit af9f471b500bcd0c1023259c7577e074fe6d3ee5.
2021-05-24vm_map: Fix proxy object protection checkSergey Bugaev
* If not making a copy, don't cap protection to the limit enforced by the proxy, and only require read access. This fixes mapping parts of read-only files MAP_ANON + PROT_READ|PROT_WRITE. * Instead of silently capping protection, return KERN_PROTECTION_FAILURE to the caller like the other vm_*() routines do.
2021-04-05rtc: Add read/write messagesSamuel Thibault
We are still having issues with bogus dates. This adds prints at boot and time set, to make sure what we actually read and write. * i386/i386at/rtc.c: Include <kern/printf.h> (readtodc): Warning about reaching CENTURY_START. Print the time read from RTC. (writetodc): Record in RTC remainder of division of year by 100 rather than subtracting 1900. Print the time written to RTC.
2021-04-05kd: Do not read the CMOS ramSamuel Thibault
This could conflict with read/writing the RTC. * i386/i386at/kd.c (kd_xga_init): Do not read the CRAM. We were always assuming VGA anyway.
2021-04-05apic: Also unmask irq 3 and 4 earlySamuel Thibault
We unmasked by hand kd's irq 1, but com0/1 also need unmasking. More generally we should unmask irqs as appropriate. * i386/i386at/model_dep.c (machine_init): Unmask irq 3 and 4.
2021-04-05ioapic: Fix arg passing of redirection entryDamien Zammit
Message-Id: <20210405115921.184572-3-damien@zamaudio.com>
2021-04-05ioapic: Refactor EOIDamien Zammit
Message-Id: <20210405115921.184572-2-damien@zamaudio.com>