summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-07-25kern: add boot-time clock, use it for time stampsHEADmasterJustus Winter
The kernel keeps track of task and thread creation times by saving a time stamp. Previously, the real-time clock was used for this. When the real-time clock is changed, however, the reference frame for the time stamps is lost. This surfaced in Hurd systems reporting spuriously long uptimes. Fix this by creating a boot-time clock and use it as reference frame for the time stamps. * kern/mach_clock.c (clock_boottime_offset): Create clock by keeping track of the offset from the real-time. (clock_boottime_update): New function. (record_time_stamp): Use the boot-time clock for time stamps. (read_time_stamp): New function to convert it back to real-time. (host_set_time): Call `clock_boottime_update'. * kern/mach_clock.h (record_time_stamp): Amend comment. (read_time_stamp): New declaration. * kern/task.c (task_info): Use `read_time_stamp'. * kern/thread.c (thread_info): Likewise.
2015-07-25include: provide time-value substractionJustus Winter
* include/mach/time_value.h (time_value_assert): New macro to assert that the given value is well-formed. (time_value_add_usec): Use the new macro. (time_value_sub_usec): New macro. (time_value_add): Use `time_value_add_usec'. (time_value_sub_usec): New macro.
2015-07-25kern/lock: make sure the macros are only used on simple locksJustus Winter
* kern/lock.h (struct slock, simple_lock_data_empty): Add field `is_a_simple_lock'. (simple_lock_assert): New macro that tests for `is_a_simple_lock'. Use this macro to assert that the arguments to various other macros are indeed simple locks.
2015-07-25Disable the kernel tracing system XPRJustus Winter
* configfrag.ac (XPR_DEBUG): Disable tracing system.
2015-07-25ipc/space: inline reference countingJustus Winter
* ipc/ipc_space.h (is_{reference,release}): Use the macro variant.
2015-07-25Make sure the field offsets are updatedJustus Winter
* Makerules.am: Make sure the field offsets are updated.
2015-07-20kern/bootstrap: deallocate threadJustus Winter
Previously, killing the thread would fail because of the extra reference, making task_terminate loop forever. * kern/bootstrap.c (boot_script_exec_command): Deallocate thread.
2015-07-19kern/bootstrap: deallocate taskJustus Winter
* kern/bootstrap.c (boot_script_free_task): Deallocate task.
2015-07-18linux/net: fix build with -O0Justus Winter
* linux/src/drivers/net/pci-scan.c: Avoid #erroring out.
2015-07-18kern/printf: do not serialize printf and coJustus Winter
A lot of code assumes that printf is re-entrant, e.g. the pagination code in the debugger, or any use of assert inside the console driver. * kern/printf.c: Drop the lock serializing calls to `_doprnt'. (printf_init): Remove function. * kern/printf.h (printf_init): Remove declaration. * kern/startup.c (setup_main): Remove call to `printf_init'.
2015-07-18kern/lock: use compiler built-in functions to get return addressJustus Winter
* kern/lock.c (struct simple_locks_info): Fix type of `ra'. (simple_lock, simple_lock_try): Use compiler built-in functions to get return address.
2015-07-18kern/bootstrap: fix lockingJustus Winter
* kern/bootstrap.c (boot_script_exec_cmd): Add missing unlock. (user_bootstrap): Likewise.
2015-07-18kern/slab: fix lockingJustus Winter
* kern/slab.c (host_slab_info): Fix locking.
2015-07-15ipc: use a general lock to protect IPC spacesJustus Winter
This fixes a corruption in the radix trees representing the IPC spaces when memory was tight. * ipc/ipc_space.h: Use a general lock to protect IPC spaces.
2015-07-15ipc: fix the locking of the IPC entry allocation functionsJustus Winter
* ipc/ipc_entry.c (ipc_entry_alloc): Assume the space is write-locked. (ipc_entry_alloc_name): Likewise. * ipc/ipc_object.c: Fix the locking around all call sites to the two functions where the space was not locked before.
2015-07-15i386: fix typoJustus Winter
* i386/intel/pmap.c: Fix typo.
2015-07-12ipc: avoid kmem_allocJustus Winter
* ipc/ipc_table.c (ipc_table_alloc): Unconditionally use `kalloc'. (ipc_table_free): Unconditionally use `kfree'.
2015-07-12vm: really fix traversing the list of inactive pagesJustus Winter
Previously, the pageout code traversed the list of pages in an object instead of the list of inactive pages. * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of inactive pages.
2015-07-11kern: make sure the queue macros are only used on queuesJustus Winter
This turns mistakes as the one corrected in e59f05e9 into compile-time errors. * kern/queue.h: Add a new macro, queue_assert, and use it to assert that all arguments given to the queue macros have the correct type. * device/net_io.c (ENQUEUE_DEAD): Adapt to the fact that `queue_next(q)' is no longer an lvalue.
2015-07-11vm: fix traversing the list of inactive pagesJustus Winter
Previously, the pageout code traversed the hash table chain instead of the list of inactive pages. The code merely compiled by accident, because the `struct page' also has a field called `next' for the hash table chain. * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of inactive pages.
2015-07-10vm: drop debugging remnantsJustus Winter
* vm/vm_object.c (vm_object_terminate): Drop debugging remnants.
2015-07-10kern: make printf handle long long integersJustus Winter
* Makefile.am (clib_routines): Steal `__umoddi3'. * kern/printf.c (MAXBUF): Increase size. (printnum, _doprnt): Handle long long integers. * kern/printf.h (printnum): Adjust declaration.
2015-07-09vm: fix panic messageJustus Winter
* vm/vm_kern.c (kmem_init): Fix panic message.
2015-07-09i386: fix line wrapping in the immediate consoleJustus Winter
* i386/i386at/immc.c (immc_cnputc): Fix line wrapping.
2015-07-09kern: remove superfluous fileJustus Winter
* kern/server_loop.ch: Remove superfluous file.
2015-07-09kern: improve error handlingJustus Winter
* kern/bootstrap.c (boot_script_exec_cmd): Improve error handling.
2015-07-09Allow non-privileged tasks to wire 64KiB task memorySamuel Thibault
* doc/mach.texi (vm_wire): Document that the host port does not have to be privileged. * include/mach/mach_hosts.defs (vm_wire): Use mach_port_t instead of host_priv_t. * vm/vm_map.h (vm_map): Add user_wired field. * vm/vm_map.c (vm_map_setup): Initialize user_wired field to 0. (vm_map_pageable_common, vm_map_entry_delete, vm_map_copy_overwrite, vm_map_copyout_page_list, vm_map_copyin_page_list): When switching user_wired_count field of entry between 0 and non-0, accumulate the corresponding size into the user_wired field of map. * vm/vm_user.c (vm_wire): Turn host parameter into port parameter, and inline a version of convert_port_to_host_priv which records whether the host port is privileged or not. When it is not privileged, check whether the additional amount to user_wired will overcome 64KiB.
2015-07-07Fix build with -O0Samuel Thibault
* linux/src/include/linux/string.h (strcpy, strncpy, strcat, strncat, strchr, strrchr, strlen, strnlen, strcmp, strncmp, memmove, memscan): Comment out extern declarations. * linux/dev/include/asm-i386/string.h (strcpy, strncpy, strcat, strncat, strcmp, strncmp, strchr, strrchr, strlen, __memcpy, __constant_memcpy, memmove, memchr, __memset_generic, __constant_c_memset, strnlen, __constant_c_and_count_memset, memscan): Turn extern inline into static inline. * linux/dev/include/linux/fs.h (mark_buffer_uptodate): Likewise. * linux/src/include/asm-i386/bitops.h (set_bit, clear_bit, change_bit, test_and_set_bit, test_and_clear_bit, test_and_change_bit, test_bit, find_first_zero_bit, find_next_zero_bit, ffz, ffs): Likewise. * linux/src/include/asm-i386/io.h (virt_to_phys, phys_to_virt, __out##s, __in##s, ins##s, outs##s): Likewise. * linux/src/include/asm-i386/semaphore.h (down, down_interruptible, up): Likewise. * linux/src/include/asm-i386/segment.h [!__OPTIMIZE]: Emit an ud2 instruction instead of an undefined reference.
2015-07-05Add missing distributed fileSamuel Thibault
* Makefrag.am (EXTRA_DIST): Add ipc/notify.defs.
2015-06-30Fix re-configuring out-of-tree buildsJustus Winter
Previously, running `../configure ...' to reconfigure an out-of-tree build would link `machine' to `i386/i386' instead of `../i386/i386' (i.e. point to the build directory instead to the source) if `i386/i386' also exists in the build directory because of a previous build. * configfrag.ac: Prefix machine link target with `$srcdir'.
2015-06-30Fix restoring interrupts on timeoutSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_identify): Restore flags before returning on timeout.
2015-06-29Print about powered-down AHCI portsSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_probe_dev): Print messages when device is present but powered down.
2015-06-28ddb: automatically display stack tracesJustus Winter
* ddb/db_trap.c (db_task_trap): Automatically display stack traces if an unexpected trap occurs.
2015-06-28i386: improve the immediate consoleJustus Winter
Improve the immediate console to the point that it can be enabled and display e.g. assertion failures from very early on (i.e. from `c_boot_entry'). * device/cons.h (romgetc, romputc): New declarations. * i386/configfrag.ac: Add configuration variable. * i386/i386at/conf.c (dev_name_list): Add entry. * i386/i386at/cons_conf.c (constab): Add entry. * i386/i386at/immc.c: Add missing includes. (immc_cnprobe, immc_cninit, immc_cngetc, immc_romputc): New functions. (immc_cnputc): Fix signature, use virtual addresses. * i386/i386at/immc.h: New file. * i386/i386at/kd.c: Use `#if ENABLE_IMMEDIATE_CONSOLE'. * i386/i386at/kd.h (kd_setpos): Add missing declaration. * i386/i386at/model_dep.c (c_boot_entry): Install immediate console as early boot console.
2015-06-26i386: add commentJustus Winter
* i386/i386at/model_dep.c (rebootflag): Explain flag.
2015-06-20kern: fix error handlingJustus Winter
This avoids calling `thread_deallocate' with an uninitialized value, as found by the Clang Static Analyzer. * kern/thread.c (kernel_thread): Fix error handling.
2015-06-09kern: add function attributes to the printf-functionsJustus Winter
* kern/printf.h (sprintf, snprintf, vsnprintf, printf): Add the `printf' function attribute that allows the compiler to check the format strings and arguments.
2015-06-05Fix typoFlávio Cruz
* vm/vm_kern.c (kmem_alloc_aligned): Fix typo.
2015-06-05Use custom port macros.Flávio Cruz
* ipc/ipc_port.c (ipc_port_alloc_special): Use ip_alloc and ip_lock_init macros instead of manually inlining them.
2015-05-31ipc: fix typoJustus Winter
* ipc/notify.defs: Fix typo.
2015-05-31Include the notify protocol in `gnumach.msgids'Justus Winter
* Makefrag.am (gnumach.msgids): Add `notify.msgids' as prerequisite. * Makerules.mig.am: Add rule to generate the list of message ids when neither the client nor the server stubs are required. * ipc/notify.defs: New file.
2015-05-29kern: fix argument handlingJustus Winter
Previously, the processor argument was not checked. If called with a non-processor argument (like a task), `processor' is set to NULL, triggering a page fault. Likewise for the other functions. * kern/processor.c (processor_get_assignment): Fix argument handling. * kern/task.c (task_get_assignment): Likewise. * kern/thread.c (thread_get_assignment): Likewise.
2015-05-23Restrict `-fno-strict-aliasing' to the Linux driversJustus Winter
* Makefile.am: Move `-fno-strict-aliasing'... * linux/Makefrag.am: ... here.
2015-05-23i386: avoid breaking the strict-aliasing rulesJustus Winter
* i386/i386/pcb.c (switch_ktss): Cleanly convert the value.
2015-05-23kern: avoid breaking the strict-aliasing rulesJustus Winter
* kern/exception.c (exception_parse_reply): Use `BAD_TYPECHECK'.
2015-05-23vm: drop unused `kmem_realloc'Justus Winter
* vm/vm_kern.c (kmem_realloc): Remove function. (kmem_alloc_wired): Adopt comment. * vm/vm_kern.h (kmem_realloc): Remove declaration.
2015-05-23Add stdint integer types in Linux glueSamuel Thibault
* linux/dev/include/linux/types.h (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t): New types.
2015-05-22ipc: drop remnants of the IPC tablesJustus Winter
* ipc/ipc_table.c (ipc_table_entries): Remove. (ipc_table_entries_size): Likewise. (ipc_table_init): Remove initialization of `ipc_table_entries'. (ipc_table_realloc): Remove function. * ipc/ipc_table.h: Adjust comments. (ipc_table_entries): Remove declaration. (ipc_table_realloc): Likewise. (it_entries_{alloc,reallocable,realloc,free}): Remove macros.
2015-05-22ipc: drop size parameter from `ipc_space_create'Justus Winter
* ipc/ipc_space.c (ipc_space_create): Drop size parameter. * ipc/ipc_space.h (ipc_space_create): Adopt declaration, fix comment. * kern/ipc_tt.c (ipc_task_init): Adopt accordingly.
2015-05-20ipc: inline key ipc entry lookup functionsJustus Winter
Declare functions looking up IPC entries that were previously inlined manually with `static inline' so that they will be inlined into the fast paths by the compiler. * ipc/ipc_entry.c (ipc_entry_lookup, ipc_entry_get, ipc_entry_dealloc): Move functions... * ipc/ipc_space.h: ... here, and declare them as `static inline'. * ipc/ipc_entry.h: Drop associated declarations.