aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use -Wstrict-prototypes and fix warningsFlavio Cruz2022-12-2136-195/+144
| | | | | | | Most of the changes include defining and using proper function type declarations (with argument types declared) and avoiding using the K&R style of function declarations. Message-Id: <Y6Jazsuis1QA0lXI@mars>
* x86_64: stdint.h no longer exists so don't install itFlavio Cruz2022-12-191-1/+0
| | | | Message-Id: <Y6Bw/vU85SK5GrMZ@mars>
* time_value: Fix usage in e.g. c89 programsSamuel Thibault2022-12-191-2/+2
| | | | | | The inline keyword was not defined there, so we need to use __inline__. This fixes make check in glibc.
* Remove custom stdint.h and rely on freestanding headersFlavio Cruz2022-12-198-148/+22
| | | | | GCC already provides this so we don't need to have our own. Message-Id: <Y5+02FVA6jf4GPgA@mars>
* Use long_natural_t for recnum_tFlavio Cruz2022-12-185-24/+65
| | | | | | | | | | | | For 64 bits, device operations will provide an addressing space of 64 bits. Also define the translation functions if long_natural_t or long_integer_t are ever used in RPCs. Note that MIG does not implicitly inherit the translation functions from types hence the need to redefine them for recnum_t. Message-Id: <Y59MFzekEA0YUXIw@mars>
* libgcc_routines: Restore some symbolsSamuel Thibault2022-12-181-1/+1
| | | | | | cef6d34aa026 ("Implement our own functions to convert between host and network values") dropped the glibc pieces from clib_routines, but missed moving all its gcc symbols into libgcc_routines.
* vm_page_evict: avoid crashingSamuel Thibault2022-12-181-1/+1
| | | | | | It seems we hit he "unable to recycle any page" even when there is no memory pressure, probably just because the pageout thread somehow to kicked but there's nothing to page out left.
* Use struct for time_value_t and define seconds as long_integer_t.Flavio Cruz2022-12-174-4/+60
| | | | | | | On 64 bit kernels, seconds will be 64 bits long and won't suffer from the 2038 problem. We also add a new type rpc_time_value_t to handle the conversion between 32 bit userland and 64 bit kernel. Message-Id: <Y50kIaIgaIdGjDAk@mars>
* Fix compiler warnings due to use of inline for mask_irq/unmask_irqFlavio Cruz2022-12-174-18/+16
| | | | Message-Id: <Y5z01C/L+pnSVNIP@mars>
* Implement our own functions to convert between host and network valuesFlavio Cruz2022-12-174-13/+87
| | | | | | | | We add htonl, ntohl and ntohs which were the last symbols we relied on from libc. The Makefile.am file was updated to reflect the fact that we only require libgcc. Message-Id: <Y5zNdOJ/YnyYCOhX@mars>
* Use __builtin_ffs instead of libc provided ffs in vm_map.cFlavio Cruz2022-12-152-4/+4
| | | | | | We already use this built-in in other places and this will move us closer to being able to build the kernel without libc. Message-Id: <Y5l80/VUFvJYZTjy@jupiter.tail36e24.ts.net>
* copy_to/from_phys: fix non-page-aligned caseSamuel Thibault2022-12-121-2/+2
| | | | | | | | The vaddr field of the returned map only points to the base address, we have to add the offset within the page before reading/writing. This fixes accessing tasks different from the current task, and the user part of ddb backtraces.
* db: Add support for CSI-based arrowsSamuel Thibault2022-12-111-0/+40
|
* i386 db: Fix db_read_bytes over multiple pagesSamuel Thibault2022-12-111-0/+1
| | | | The target pointer was not getting advanced between page chunks.
* i386 db: Add ud2 instructionSamuel Thibault2022-12-111-1/+1
|
* Delete rpc copyout multiname codeFlavio Cruz2022-12-112-91/+0
| | | | Message-Id: <Y5V+BovjWo1CCjBc@jupiter.tail36e24.ts.net>
* Delete thread_get_state_KERNEL and thread_set_state_KERNELFlavio Cruz2022-12-111-41/+0
| | | | | | These are not used. Message-Id: <Y5V95ibk9Z+3OJxN@jupiter.tail36e24.ts.net>
* Use mach_port_name in db_lookup_portFlavio Cruz2022-12-071-1/+1
| | | | Message-Id: <Y5AdTQfSxStjbhsj@reue>
* Update kern/ directory to use mach_port_name_t.Flavio Cruz2022-12-078-17/+17
| | | | | Make it clear where exactly we use port names vs port addresses. Message-Id: <Y5AdJGuzXBMO7YRK@reue>
* Use long_natural_t in kern/task.h and kern/slab.hFlavio Cruz2022-12-072-12/+12
| | | | | | RPC interfaces already use long_natural_t so internally we can also use this type. Message-Id: <Y5AdPNqg4l5jAZ3n@reue>
* Define vm_size_t and vm_offset_t as __mach_uintptr_t.Flavio Cruz2022-12-0611-20/+20
| | | | | | | | | | This allows *printf to use %zd/%zu/%zx to print vm_size_t and vm_offset_t. Warnings using the incorrect specifiers were fixed. Note that MACH_PORT_NULL became just 0 because GCC thinks that we were comparing a pointer to a character (due to it being an unsigned int) so I removed the explicit cast. Message-Id: <Y47UNdcUF35Ag4Vw@reue>
* Make task_info.h structs more portableFlavio Cruz2022-12-066-60/+63
| | | | | | | | | | Changed vm_size_t to rpc_size_t so that both userland and kernel agree on the same size. Also changed the denominator for the maximum struct sizes to be integer_t to match the other declarations. Introduced long_natural_t and rpc_long_natural_t to represent large counters. Replaced rpc_unsigned_long with rpc_long_natural_t. Message-Id: <Y47UhaOzKnqhgYq4@reue>
* task: Add task_set_essentialSamuel Thibault2022-12-035-3/+40
| | | | | | | | Whenever a Hurd essential task crashes, startup just reboots the system since there's not much that can be done at that point. When we have a kernel debugger, however, we could at least get crashing information, so let's let Hurd's startup tell the kernel which tasks are essential, and trigger the debugger whenever they crash.
* 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!