summaryrefslogtreecommitdiff
path: root/kern
AgeCommit message (Collapse)Author
2014-02-04kern: make kmem_error panicJustus Winter
The slab allocator relies on the fact that kmem_cache_error does not return. Previously, kmem_error was using printf. Use panic instead. Found using the Clang Static Analyzer. * kern/slab.c (kmem_error): Use panic instead of printf.
2014-02-04kern: use kmem_warn instead of kmem_error in kmem_cache_errorJustus Winter
* kern/slab.c (kmem_cache_error): Use kmem_warn instead of kmem_error to print the cache name and its address.
2014-02-01kern: add a name field to struct taskJustus Winter
* kern/task.c (task_create): Initialize name with the address of the task. * kern/task.h (TASK_NAME_SIZE): New definition. (struct task): Add field name.
2014-02-01kern: add snprintfJustus Winter
* kern/printf.c (snprintf): New function. * kern/printf.h (snprintf): New declaration.
2014-01-16kern: include the mig-generated server headers in ipc_kobject.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the ipc_kobject_server function. * kern/ipc_kobject.c: Include the mig-generated server headers.
2014-01-09kern: align kmem_cache objects using __cacheline_alignedJustus Winter
* kern/slab.h (struct kmem_cache): Align kmem_cache objects using __cacheline_aligned.
2014-01-06kern: optimize the layout of struct kmem_cacheJustus Winter
* kern/slab.h (struct kmem_cache): Reorder the fields so that all hot fields are within the first cache line.
2014-01-05kern: explain the significance of the chosen lengthJustus Winter
* kern/slab.h (KMEM_CACHE_NAME_SIZE): Explain the significance of the chosen length.
2014-01-03kern: make struct kmem_cache fit into two cache linesJustus Winter
Previously, the size of struct kmem_cache was 136 bytes, just eight bytes larger than 128 bytes, which is typically two cache lines on today's CPUs. By reducing the size of the name field which holds a human-readable description by eight bytes to 24 bytes, the struct kmem_cache can be made fit into two cache lines. This change should not affect the usefulness of this field. For reference, the length of the largest hard-coded name is 17. * kern/slab.h (KMEM_CACHE_NAME_SIZE): Define to 24.
2014-01-03kern: reduce the size of struct taskJustus Winter
* kern/task.h (struct task): Reduce the size of struct task by 2 * sizeof boolean_t by using a bit field for the boolean flags.
2013-12-20Mark pure functions with attribute pureMarin Ramesa
2013-12-20kern/strings.c (strlen): mark with attribute pureMarin Ramesa
* kern/strings.c (strlen): Mark with attribute pure.
2013-12-20Declare void argument lists (part 2)Marin Ramesa
Declare void argument lists that were not declared in the first part of this patch and * kern/sched_prim.h (recompute_priorities): Fix prototype. * kern/startup.c (setup_main) (recompute_priorities): Fix call.
2013-12-17kern: avoid the casts in enqueue_head() and enqueue_tail()Marin Ramesa
* kern/eventcount.c (simpler_thread_setrun) (enqueue_head) (th): Avoid the cast. * kern/thread.c (thread_halt_self) (enqueue_tail) (thread): Likewise. * kern/thread_swap.c (thread_swapin) (enqueue_tail) (thread): Likewise.
2013-12-17Mark functions that don't return with attribute noreturnMarin Ramesa
2013-12-17kern: qualify pointers whose dereferenced values are constant with constMarin Ramesa
2013-12-17Cleanup of the copyin() and copyout() callsMarin Ramesa
* device/ds_routines.c (device_write_trap) (copyin) (data): Cast to (void *). Argument is an address. (device_write_trap) (copyin) (io_data): Don't cast. (device_writev_trap) (copyin) (iovec, stack_iovec): Likewise. (device_writev_trap) (copyin) (data, p): Cast to (void *). Arguments are addresses. * kern/bootstrap.c (build_args_and_stack) (copyout) (arg_count, string_pos, zero): Don't cast. * kern/ipc_mig.c (syscall_vm_map) (copyin, copyout) (addr, address): Likewise. (syscall_vm_allocate) (copyin, copyout) (addr, address): Likewise. (syscall_task_create) (copyout) (name, child_task): Likewise. (syscall_mach_port_allocate) (copyout) (name, namep): Likewise. * kern/time_stamp.c (copyout) (temp, tsp): Likewise.
2013-12-17kern/sched_prim.h: remove unnecessary __GNUC__ #ifdefMarin Ramesa
Attribute noreturn is used irrespective of __GNUC__. Remove unnecessary #ifdef. * kern/sched_prim.h [__GNUC__]: Remove #ifdef.
2013-12-16kern: quiet GCC warnings about set but unused variablesMarin Ramesa
* kern/lock.h (simple_lock_data_empty): Define. (decl_simple_lock_data, simple_unlock): Likewise. * kern/sched_prim.c (lock): Declare. [MACH_SLOCKS]: Remove #ifs. * kern/task.c (task_lock, task_unlock): Remove address operator.
2013-12-15kern/sched_prim.c: avoid castsMarin Ramesa
Avoid the casts by passing the address of the links thread structure member to enqueue_tail(). * kern/sched_prim.c: Avoid casts.
2013-12-15Type definitionMarin Ramesa
* i386/i386/ast_check.c (init_ast_check, cause_ast_check): Define return type. * i386/i386/pic.c (intnull, prtnull): Define argument types. * i386/i386at/com.c (compr_addr): Likewise. (compr): Likewise. (compr_addr): Fix printf format. * i386/i386at/kd.c (kd_cmdreg_write, kd_kbd_magic): Define argument types. * i386/i386at/kd_mouse.c (init_mouse_hw): Likewise. * ipc/mach_port.c (sact_count): Define return type. * ipc/mach_rpc.c (mach_port_rpc_sig): Define argument types. * kern/act.c (dump_act): Define return type. * kern/lock_mon.c (simple_lock, simple_lock_try, simple_unlock, lip, lock_info_sort, lock_info_clear, print_lock_info): Define return type. (time_lock): Define return type and argument type. * kern/timer.c (time_trap_uexit): Define argument type.
2013-12-15kern/mach_clock.c: update commentMarin Ramesa
This is mach_clock.c, not clock_prim.c. * kern/mach_clock.c: Update comment.
2013-12-15Declare void argument listsMarin Ramesa
2013-12-11Cleanup of the memcpy(), memmove(), memcmp() and memset() callsMarin Ramesa
Addresses were cast to (void *). Pointers uncasted. * device/ds_routines.c (ds_read_done) (memset) (start_sent): Cast to (void *) instead to (char *). Argument is an address. (ds_read_done) (memset) (end_data): Likewise. * i386/i386/pcb.c (thread_getstatus) (memcpy) (pm): Don't cast. Argument is a pointer. (thread_getstatus) (memcpy) (iopb): Likewise. * i386/i386at/immc.c (immc_cnputc) (memmove): Cast first argument to (void *). Argument is an address. (immc_cnputc) (memmove): Cast second argument to (void *). Argument is an address. (immc_cnputc) (memset): Cast first argument to (void *). Argument is an address. * i386/i386at/model_dep.c (i386at_init) (memcpy) (phystokv): Cast to (void *) instead to (char *). Argument is an address. * i386/intel/pmap.c (pmap_init) (memset) (addr): Likewise. * ipc/mach_debug.c (mach_port_space_info) (memset) (table_addr + size_used): Likewise. (mach_port_space_info) (memset) (tree_addr + size_used): Likewise. * kern/host.c (host_processor_sets) (memcpy) (newaddr): Likewise. (host_processor_sets) (memcpy) (addr): Likewise. * kern/xpr.c (xprbootstrap) (memset) (addr): Likewise. * vm/vm_debug.c (mach_vm_object_pages) (memset) (addr + size_used): Likewise.
2013-12-09kern/startup.c: use boolean valuesMarin Ramesa
* kern/startup.c (reboot_on_panic): Use boolean values.
2013-12-09kern/act.h: remove unnecessary includeMarin Ramesa
File kern/act.h includes itself. Remove this include. * kern/act.h: Don't include kern/act.h.
2013-12-09Cleanup of the prototypesMarin Ramesa
* device/cirbuf.h (nqdb): Remove prototype without definition. * device/conf.h (dev_set_indirect): Likewise. * kern/boot_script.h (boot_script_read_file): Likewise. * kern/eventcount.h (evc_notify_abort): Remove duplicate prototype. * kern/thread.h (thread_set_own_priority): Likewise. * kern/thread_swap.h (thread_swapout): Remove prototype without definition. * kern/timer.h (softclock): Remove duplicate prototype. * vm/pmap.h (pmap_resident_count, pmap_access, pmap_phys_address, pmap_phys_to_frame): Remove prototypes without function definition. * vm/vm_page.h (vm_set_page_size): Likewise.
2013-12-09kern/syscall_sw.c: use boolean instead of an intMarin Ramesa
* kern/syscall_sw.c (kern_invalid_debug): Use boolean instead of an int.
2013-12-09kern/refcount.h: remove unnecessary includeMarin Ramesa
File kern/refcount.h includes itself. Remove this include. * kern/refcount.h: Don't include kern/refcount.h.
2013-12-09kern/rbtree.h: remove unnecessary includeMarin Ramesa
File kern/rbtree.h includes itself. Remove this include. * kern/rbtree.h: Don't include kern/rbtree.h.
2013-12-09kern/priority.c: update commentMarin Ramesa
This is priority.c. Not clock_prim.c. * kern/priority.c: Update comment.
2013-12-09kern/pc_sample.c: remove unused variablesMarin Ramesa
* kern/pc_sample.c (pc_sampling_enabled, pc_sampling_lock): Remove unused variables.
2013-12-09kern/lock_mon.c: remove dead assignmentsMarin Ramesa
* kern/lock_mon.c (scurval, ssum, sli): Remove variables. (scurval, ssum, sli): Remove dead assignments.
2013-12-09kern/lock_mon.c: use spl_t instead of an intMarin Ramesa
Variable curr_ipl is in other files declared as spl_t. * kern/lock_mon.c (curr_ipl): Use spl_t instead of an int.
2013-12-09kern/act.h: remove prototype without definitionMarin Ramesa
* kern/act.h (act_create_kernel): Remove prototype without definition.
2013-12-09Add commentSamuel Thibault
2013-12-08kern/machine.c: remove __volatile__Marin Ramesa
Shutdown can be optimised. Remove __volatile__. * kern/machine.c [__GNUC__] (processor_doshutdown): Remove volatile function qualifier.
2013-12-08Always make Assert trigger debuggerSamuel Thibault
* kern/debug.c (Assert): Always call Debugger, even if db_breakpoints_insert is not set.
2013-12-08Add comments after endifsMarin Ramesa
* device/cons.c [MACH_KMSG]: Likewise. [CONSBUFSIZE > 0]: Likewise. * i386/i386/trap.c [MACH_KDB]: Likewise. [MACH_PV_PAGETABLES]: Likewise. * i386/i386at/kd.c [ENABLE_IMMEDIATE_CONSOLE]: Likewise. * ipc/ipc_kmsg_queue.h [_IPC_KMSG_QUEUE_H_]: Likewise. * kern/act.c [ACTWATCH]: Likewise. * kern/refcount.h [MACHINE_REFCOUNT]: Likewise. * kern/task.c [FAST_TAS]: Likewise.
2013-12-05kern/mach_clock.c: remove forward declarationMarin Ramesa
* Makefrag.am: Include kern/priority.h. * kern/mach_clock.c (thread_quantum_update): Remove forward declaration. Include kern/priority.h. * kern/priority.h: New file. Add copyright. [_KERN_PRIORITY_H_]: Add ifndef. (thread_quantum_update): Add prototype.
2013-12-05kern/time_stamp.c: remove multimax codeMarin Ramesa
* kern/time_stamp.c [multimax]: Remove code.
2013-12-05kern: remove forward declarationMarin Ramesa
* kern/xpr.c (db_printf): Remove forward declaration. [MACH_KDB] Include ddb/db_output.h.
2013-12-05kern/thread.c: remove forward declarationMarin Ramesa
* i386/i386/pcb.h (pcb_module_init): Add prototype. * kern/thread.c (pcb_module_init): Remove forward declaration.
2013-12-05kern/task.c: remove forward declarationsMarin Ramesa
* ipc/ipc_mqueue.h: Include ipc/ipc_kmsg_queue.h. * kern/ipc_kobject.h: Move includes into ifndef. * kern/syscall_emulation.h: Include kern/task.h. (eml_init, eml_task_reference, eml_task_deallocate): Add prototypes. * kern/task.c: Include kern/syscall_emulation.h. (eml_init, eml_task_reference, eml_task_deallocate): Remove forward declarations
2013-12-05kern/syscall_sw.c: remove forward declarationsMarin Ramesa
* kern/eventcount.h (evc_wait_clear): Add prototype. * kern/ipc_mig.h: Include device/device_types.h. (syscall_vm_map, syscall_vm_allocate, syscall_vm_deallocate, syscall_task_create, syscall_task_terminate, syscall_task_suspend, syscall_task_set_special_port, syscall_mach_port_allocate, syscall_mach_port_deallocate, syscall_mach_port_insert_right, syscall_mach_port_allocate_name, syscall_thread_depress_abort, syscall_device_write_request, syscall_device_writev_request): Add prototypes. * kern/syscall_sw.c (syscall_vm_map, syscall_vm_allocate, syscall_vm_deallocate, syscall_task_create, syscall_task_terminate, syscall_task_suspend, syscall_task_set_special_port, syscall_mach_port_allocate, syscall_mach_port_deallocate, syscall_mach_port_insert_right, syscall_mach_port_allocate_name, syscall_thread_depress_abort, evc_wait, evc_wait_clear, syscall_device_write_request, syscall_device_writev_request): Remove forward declarations. Include kern/ipc_mig.h. Include kern/eventcount.h.
2013-12-05kern/syscall_subr.c: remove forward declarationMarin Ramesa
* kern/syscall_subr.c (thread_depress_priority): Remove forward declaration. * kern/syscall_subr.h (thread_depress_priority): Add prototype.
2013-12-05kern/startup.c: remove forward declarationsMarin Ramesa
* Makefrag.am: Include kern/bootstrap.h. Include vm/vm_init.h. Include device/device_init.h. * device/device_init.h: New file. Add copyright. [_DEVICE_DEVICE_INIT_H_]: Add ifndef. (device_service_create): Add prototype. * i386/i386/mp_desc.h (start_other_cpus): Add prototype. * kern/bootstrap.h: New file. Add copyright. [_KERN_BOOTSTRAP_H_]: Add ifndef. (bootstrap_create): Add prototype. * kern/sched_prim.h (idle_thread, sched_thread): Add prototypes. * kern/startup.c: Include kern/bootstrap.h. Include kern/startup.h. Include vm/vm_init.h. Include vm/vm_pageout.h. Include device/device_init.h. (vm_mem_init, vm_mem_bootstrap, init_timeout, machine_init, idle_thread, vm_pageout, reaper_thread, swapin_thread, sched_thread, bootstrap_create, device_service_create, cpu_launch_first_thread, start_kernel_threads, start_other_cpus, action_thread): Remove forward declarations. [NCPUS > 1] Include machine/mp_desc.h and kern/machine.h. * kern/startup.h: Include kern/thread.h. (cpu_launch_first_thread, start_kernel_threads): Add prototypes. * vm/vm_init.h: New file. Add copyright. [_VM_VM_INIT_H_]: Add ifndef. (vm_mem_init, vm_mem_bootstrap): Add prototypes. * vm/vm_pageout.h (vm_pageout): Add prototype.
2013-12-05kern/sched_prim.c: remove forward declarationsMarin Ramesa
* kern/sched_prim.c (set_pri, do_thread_scan, choose_pset_thread, checkrq, thread_check): Remove forward declarations. * kern/sched_prim.h (set_pri, do_thread_scan, choose_pset_thread, checkrq, thread_check): Add prototypes.
2013-12-05kern/processor.c: remove forward declarationsMarin Ramesa
* kern/processor.c (quantum_set, pset_init, processor_init): Remove forward declarations. * kern/processor.h (quantum_set, pset_init, processor_init): Add prototypes.
2013-12-05kern/ipc_mig.c: remove forward declarationsMarin Ramesa
* device/ds_routines.h (ds_device_write_trap, ds_device_writev_trap): Add prototypes. * kern/ipc_mig.c (ds_device_write_trap, ds_device_writev_trap): Remove forward declarations.