summaryrefslogtreecommitdiff
path: root/device
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-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-07Drop unused device_pager_releaseSamuel Thibault
* device/dev_pager.c (device_pager_release): Drop unused function.
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-04-04SMP: Fix warningsSamuel Thibault
2021-03-31intr: Always share irqsSamuel Thibault
We currently already always assume that irqs user handlers can be shared * device/intr.c (install_user_intr_handler): Add SA_SHIRQ to flags.
2021-03-31intr: Add user interrupt handling code for non-Linux caseDamien Zammit
* device/intr.c: Include <kern/assert.h> (struct intr_list): New structure. (user_intr_handlers): New array. (user_irq_handler): New function. (install_user_intr_handler): New function. Message-Id: <20210330025830.63528-2-damien@zamaudio.com>
2020-09-10device_pager_setup: Add FIXME commentSamuel Thibault
2020-07-19device intr: Fix reference leakSamuel Thibault
On RPC success we have to release the passed send rights, otherwise references accumulate and we never notice when the receiver dies. * device/ds_routines.c (ds_device_intr_ack): On success, call ipc_port_release_send on the notification receive port.
2020-07-19intr_register: better document how we'd handle crashesSamuel Thibault
2020-07-1864bit: fix buildSamuel Thibault
* device/ds_routines.c (ds_device_intr_register, ds_device_intr_ack) [__x86_64__]: Disable. * x86_64/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and i386/i386/irq.h.
2020-07-15Fix xen buildSamuel Thibault
* device/ds_routines.c (ds_device_intr_register, ds_device_intr_ack) [MACH_XEN]: Return D_INVALID_OPERATION. * i386/Makefrag.am [!PLATFORM_at] (libkernel_a_SOURCES): Remove i386/i386/irq.c and i386/i386/irq.h. * i386/i386/irq.c: Include <kern/assert.h>.
2020-07-10Add hardware interrupt notification mechanismSamuel Thibault
This allows privileged userland drivers to get notifications of hardware interrupts. Initial work by Zheng Da, reworked by Damien Zammit and myself. * Makefrag.am (libkernel_a_SOURCES): Add device/intr.c and device/intr.h. (include_device_HEADERS): Add include/device/notify.defs and include/device/notify.h. * device/dev_hdr.h (name_equal): Add declaration. * device/ds_routines.c: Include <device/intr.h> (ds_device_intr_register, ds_device_intr_ack): New functions. * device/intr.c, device/intr.h: New files. * doc/mach.texi (Device Interrupt): New section. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and i386/i386/irq.h. * i386/i386/irq.c, i386/i386/irq.h: New files. * i386/i386at/conf.c: Include <device/intr.h>. (irqname): New macro. (dev_name_list): Add irq device. * include/device/device.defs (device_intr_register, device_intr_ack): New RPCs. * include/device/notify.defs, include/device/notify.h: New files. * kern/startup.c: Include <device/intr.h> (start_kernel_threads): Start intr_thread thread. * linux/dev/arch/i386/kernel/irq.c: Include <device/intr.h> (linux_action): Add user_intr field. (linux_intr): Call user_intr action if any. (mask_irq, unmask_irq): Move functions to i386/i386/pic.c (__disable_irq, __enable_irq): Move functions to i386/i386/irq.c. (install_user_intr_handler): New function. (request_irq): Initialize user_intr field. * linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): Remove prototypes. * i386/i386/pic.c (mask_irq, unmask_irq): New functions. * i386/i386/pic.h (mask_irq, unmask_irq): New prototypes.
2020-03-31Fix build with -fno-commonSamuel Thibault
which will be the default in gcc-10. * device/io_req.h (io_inband_cache): Add extern qualifier. * device/tty.h (tthiwat, ttlowat): Likewise. * i386/i386/db_machdep.h (ddb_regs): Likewise. * kern/cpu_number.h (master_cpu): Likewise. * kern/time_stamp.h (ts_tick_count): Likewise. * linux/src/drivers/scsi/in2000.h (proc_scsi_in2000): Likewise. * device/ds_routines.c (io_inband_cache): New variable. * i386/i386/db_interface.c (ddb_regs): Likewise. * kern/processor.c (master_cpu): Likewise. * kern/time_stamp.c (ts_tick_count): Likewise. * linux/pcmcia-cs/modules/pci_fixup.c (pci_root): Remove variable.
2020-03-31Restore vm_size_t to natural_tSamuel Thibault
Plenty of places such as glibc RPC uses currently assume that vm_size_t is a natural_t (thus int on 32bit), not an unsigned long. * i386/include/mach/i386/vm_types.h (vm_size_t) [!__x86_64__]: Set type to natural_t. * device/dev_page.c (device_pager_data_request): Cast vm_size_t to unsigned long. * i386/i386at/model_dep.c (c_boot_entry): Likewise.
2020-03-2964bit: fix warningsSamuel Thibault
* device/net_io.h (net_set_filter, ethernet_priority): Add prototypes. * device/subrs.h: Include <device/if_hdr.h>. (if_init_queues): Add prototype. * i386/i386/model_dep.h (machine_relax): Add prototype. * i386/i386/trap.c (i386_astintr): Move mycpu variable definition to where it is used. * i386/i386at/model_dep.c (i386at_init): Likewise for nb_direct, addr, delta. * i386/xen/xen.c (return_to_iret): Change type to char[]. * xen/console.c: Include <i386at/kd.h>. * xen/evt.c (hyp_evt_handler): Cast NEVNT to int. * xen/grant.c: Include <model_dep.h>. (hyp_grant_takeback, hyp_grant_init): Fix print format. * xen/net.c: Include <device/subrs.h>. (paranoia): Remove variable. (hyp_net_init, device_close, device_open): Cast nd - vif_data to int. Fix print format. * xen/store.c (store_put): Cast sizeof to int. * xen/time.c: Include "xen.h". * xen/xen.h (hypclock_machine_intr): Add prototype.
2020-03-2964bit: Fix vm_size_t sizeSamuel Thibault
It needs to be able to hold > 4G size. * i386/include/mach/i386/vm_types.h (vm_size_t): Set type to unsigned long. * vm/vm_user.c (vm_read, vm_write): Fix type according to RPC. * i386/i386at/model_dep.c (c_boot_entry): Fix format. * device/dev_pager.c (device_pager_data_request): Fix format.
2018-07-28device: Fix d_mmap typeSamuel Thibault
* device/conf.h (dev_ops): Make d_mmap return vm_offset_t instead of int. (nomap): Update accordingly. * device/blkio.c (block_io_mmap): Likewise. * device/blkio.h (block_io_mmap): Likewise. * device/dev_name.c (nomap): Likewise. * i386/i386at/kd.c (kdmmap): Likewise. * i386/i386at/kd.h (kdmmap): Likewise. * i386/i386at/mem.c (memmmap): Likewise. * i386/i386at/mem.h (memmmap): Likewise. * i386/i386at/model_dep.c (timemmap): Likewise. * i386/i386at/model_dep.h (timemmap): Likewise.
2018-07-28Fix dev_ops typesSamuel Thibault
* device/conf.h: Include <device/device_types.h>. (dev_ops): Make d_getstat and d_setstat fields use dev_flavor_t, dev_status_t, and mach_msg_type_number_t types. * device/tty.h: (t_getstat, t_setstat): Likewise. * device/conf.h (nulldev_getstat, nulldev_setstat): Fix parameter types accordingly. * device/dev_name.c (nulldev_getstat, nulldev_setstat): Likewise. * device/kmsg.c (kmsggetstat): Likewise. * device/kmsg.h (kmsggetstat): Likewise. * device/net_io.c (net_getstat): Likewise. * device/net_io.h (net_getstat): Likewise. * i386/i386at/com.c (comgetstat, comsetstat): Likewise. * i386/i386at/com.h (comgetstat, comsetstat): Likewise. * i386/i386at/kd.c (kdgetstat, kdsetstat): Likewise. * i386/i386at/kd.h (kdgetstat, kdsetstat): Likewise. * i386/i386at/kd_event.c (kbdgetstat, kbdsetstat): Likewise. * i386/i386at/kd_event.h (kbdgetstat, kbdsetstat): Likewise. * i386/i386at/kd_mouse.c (mousegetstat): Likewise. * i386/i386at/kd_mouse.h (mousegetstat): Likewise. * i386/i386at/lpr.c (lprgetstat, lprsetstat): Likewise. * i386/i386at/lpr.h (lprgetstat, lprsetstat): Likewise. * xen/console.c (hypcngetstat, hypcnsetstat): Likewise. * xen/console.h (hypcngetstat, hypcnsetstat): Likewise. * device/dev_hdr.h: Forward-declare struct dev_ops and dev_ops_t type instead of including <device/conf.h>. * device/dev_pager.c: Include <device/conf.h> * i386/i386/pcb.h: Include <machine/io_perm.h> * i386/i386/thread.h: Do not include <i386/tss.h>
2017-09-21device: Remove unused file.Justus Winter
* device/dev_forward.defs: Remove unused file.
2016-10-03Remove deprecated external memory management interface.Justus Winter
* NEWS: Update. * device/dev_pager.c (device_pager_data_request): Prune unused branch. (device_pager_data_request_done): Remove function. (device_pager_data_write): Likewise. (device_pager_data_write_done): Likewise. (device_pager_copy): Use 'memory_object_ready'. * device/dev_pager.h (device_pager_data_write_done): Remove prototype. * device/device_pager.srv (memory_object_data_write): Remove macro. * doc/mach.texi: Update documentation. * include/mach/mach.defs (memory_object_data_provided): Drop RPC. (memory_object_set_attributes): Likewise. * include/mach/memory_object.defs: Update comments. (memory_object_data_write): Drop RPC. * include/mach/memory_object_default.defs: Update comments. * include/mach_debug/vm_info.h (VOI_STATE_USE_OLD_PAGEOUT): Drop macro. * vm/memory_object.c (memory_object_data_provided): Remove function. (memory_object_data_error): Simplify. (memory_object_set_attributes_common): Make static, remove unused parameters, simplify. (memory_object_change_attributes): Update callsite. (memory_object_set_attributes): Remove function. (memory_object_ready): Update callsite. * vm/vm_debug.c (mach_vm_object_info): Adapt to the changes. * vm/vm_object.c (vm_object_bootstrap): Likewise. * vm/vm_object.h (struct vm_object): Drop flag 'use_old_pageout'. * vm/vm_pageout.c: Update comments. (vm_pageout_page): Simplify.
2016-09-16VM: improve pageout deadlock workaroundRichard Braun
Commit 5dd4f67522ad0d49a2cecdb9b109251f546d4dd1 makes VM map entry allocation done with VM privilege, so that a VM map isn't held locked while physical allocations are paused, which may block the default pager during page eviction, causing a system-wide deadlock. First, it turns out that map entries aren't the only buffers allocated, and second, their number can't be easily determined, which makes a preallocation strategy very hard to implement. This change generalizes the strategy of VM privilege increase when a VM map is locked. * device/ds_routines.c (io_done_thread): Use integer values instead of booleans when setting VM privilege. * kern/thread.c (thread_init, thread_wire): Likewise. * vm/vm_pageout.c (vm_pageout): Likewise. * kern/thread.h (struct thread): Turn member `vm_privilege' into an unsigned integer. * vm/vm_map.c (vm_map_lock): New function, where VM privilege is temporarily increased. (vm_map_unlock): New function, where VM privilege is decreased. (_vm_map_entry_create): Remove VM privilege workaround from this function. * vm/vm_map.h (vm_map_lock, vm_map_unlock): Turn into functions.
2016-09-07Remove map entry pageability property.Richard Braun
Since the replacement of the zone allocator, kernel objects have been wired in memory. Besides, as of 5e9f6f (Stack the slab allocator directly on top of the physical allocator), there is a single cache used to allocate map entries. Those changes make the pageability attribute of VM maps irrelevant. * device/ds_routines.c (mach_device_init): Update call to kmem_submap. * ipc/ipc_init.c (ipc_init): Likewise. * kern/task.c (task_create): Update call to vm_map_create. * vm/vm_kern.c (kmem_submap): Remove `pageable' argument. Update call to vm_map_setup. (kmem_init): Update call to vm_map_setup. * vm/vm_kern.h (kmem_submap): Update declaration. * vm/vm_map.c (vm_map_setup): Remove `pageable' argument. Don't set `entries_pageable' member. (vm_map_create): Likewise. (vm_map_copyout): Don't bother creating copies of page entries with the right pageability. (vm_map_copyin): Don't set `entries_pageable' member. (vm_map_fork): Update call to vm_map_create. * vm/vm_map.h (struct vm_map_header): Remove `entries_pageable' member. (vm_map_setup, vm_map_create): Remove `pageable' argument.
2016-05-18Fix gcc-6 warningsSamuel Thibault
* ddb/db_elf.c (elf_db_sym_init): Turn `i' into unsigned. * device/ds_routines.c (ds_device_open, device_writev_trap): Likewise. * i386/i386/user_ldt.c (i386_set_ldt): Likewise for `i', `min_selector', and `first_desc'. (i386_get_ldt): Likewise for `ldt_count'. (user_ldt_free): Likewise for `i'. * i386/i386/xen.h (hyp_set_ldt): Turn `count' into unsigned long. * i386/intel/pmap.c (pmap_bootstrap): Turn `i', `j' and 'n' into unsigned. (pmap_clear_bootstrap_pagetable): Likewise for `i' and `j'. * ipc/ipc_kmsg.c (ipc_msg_print): Turn `i' and `numwords' into unsigned. * kern/boot_script.c (boot_script_parse_line): Likewise for `i'. * kern/bootstrap.c (bootstrap_create): Likewise for `n' and `i'. * kern/host.c (host_processors): Likewise for `i'. * kern/ipc_tt.c (mach_ports_register): Likewise. * kern/mach_clock.c (tickadj, bigadj): turn into unsigned. * kern/processor.c (processor_set_things): Turn `i' into unsigned. * kern/task.c (task_threads): Likewise. * kern/thread.c (consider_thread_collect, stack_init): Likewise. * kern/strings.c (memset): Turn `i' into size_t. * vm/memory_object.c (memory_object_lock_request): Turn `i' into unsigned. * xen/block.c (hyp_block_init): Use %u format for evt. (device_open): Drop unused err variable. (device_write): Turn `copy_npages', `i', `nbpages', and `j' into unsigned. * xen/console.c (hypcnread, hypcnwrite, hypcnclose): Turn dev to dev_t. (hypcnclose): Return void. * xen/console.h (hypcnread, hypcnwrite, hypcnclose): Fix prototypes accordingly. * xen/evt.c (form_int_mask): Turn `i' into int. * xen/net.c (hyp_net_init): Use %u format for evt. (device_open): Remove unused `err' variable.
2016-02-02Stack the slab allocator directly on top of the physical allocatorRichard Braun
In order to increase the amount of memory available for kernel objects, without reducing the amount of memory available for user processes, a new allocation strategy is introduced in this change. Instead of allocating kernel objects out of kernel virtual memory, the slab allocator directly uses the direct mapping of physical memory as its backend. This largely increases the kernel heap, and removes the need for address translation updates. In order to allow this strategy, an assumption made by the interrupt code had to be removed. In addition, kernel stacks are now also allocated directly from the physical allocator. * i386/i386/db_trace.c: Include i386at/model_dep.h (db_i386_reg_value): Update stack check. * i386/i386/locore.S (trap_from_kernel, all_intrs, int_from_intstack): Update interrupt handling. * i386/i386at/model_dep.c: Include kern/macros.h. (int_stack, int_stack_base): New variables. (int_stack_high): Remove variable. (i386at_init): Update interrupt stack initialization. * i386/i386at/model_dep.h: Include i386/vm_param.h. (int_stack_top, int_stack_base): New extern declarations. (ON_INT_STACK): New macro. * kern/slab.c: Include vm/vm_page.h (KMEM_CF_NO_CPU_POOL, KMEM_CF_NO_RECLAIM): Remove macros. (kmem_pagealloc, kmem_pagefree, kalloc_pagealloc, kalloc_pagefree): Remove functions. (kmem_slab_create): Allocate slab pages directly from the physical allocator. (kmem_slab_destroy): Release slab pages directly to the physical allocator. (kmem_cache_compute_sizes): Update the slab size computation algorithm to return a power-of-two suitable for the physical allocator. (kmem_cache_init): Remove custom allocation function pointers. (kmem_cache_reap): Remove check on KMEM_CF_NO_RECLAIM. (slab_init, kalloc_init): Update calls to kmem_cache_init. (kalloc, kfree): Directly fall back on the physical allocator for big allocation sizes. (host_slab_info): Remove checks on defunct flags. * kern/slab.h (kmem_slab_alloc_fn_t, kmem_slab_free_fn_t): Remove types. (struct kmem_cache): Add `slab_order' member, remove `slab_alloc_fn' and `slab_free_fn' members. (KMEM_CACHE_NOCPUPOOL, KMEM_CACHE_NORECLAIM): Remove macros. (kmem_cache_init): Update prototype, remove custom allocation functions. * kern/thread.c (stack_alloc): Allocate stacks from the physical allocator. * vm/vm_map.c (vm_map_kentry_cache, kentry_data, kentry_data_size): Remove variables. (kentry_pagealloc): Remove function. (vm_map_init): Update calls to kmem_cache_init, remove initialization of vm_map_kentry_cache. (vm_map_create, _vm_map_entry_dispose, vm_map_copyout): Unconditionnally use vm_map_entry_cache. * vm/vm_map.h (kentry_data, kentry_data_size, kentry_count): Remove extern declarations. * vm/vm_page.h (VM_PT_STACK): New page type. * device/dev_lookup.c (dev_lookup_init): Update calls to kmem_cache_init. * device/dev_pager.c (dev_pager_hash_init, device_pager_init): Likewise. * device/ds_routines.c (mach_device_init, mach_device_trap_init): Likewise. * device/net_io.c (net_io_init): Likewise. * i386/i386/fpu.c (fpu_module_init): Likewise. * i386/i386/machine_task.c (machine_task_module_init): Likewise. * i386/i386/pcb.c (pcb_module_init): Likewise. * i386/intel/pmap.c (pmap_init): Likewise. * ipc/ipc_init.c (ipc_bootstrap): Likewise. * ipc/ipc_marequest.c (ipc_marequest_init): Likewise. * kern/act.c (global_act_init): Likewise. * kern/processor.c (pset_sys_init): Likewise. * kern/rdxtree.c (rdxtree_cache_init): Likewise. * kern/task.c (task_init): Likewise. * vm/memory_object_proxy.c (memory_object_proxy_init): Likewise. * vm/vm_external.c (vm_external_module_initialize): Likewise. * vm/vm_fault.c (vm_fault_init): Likewise. * vm/vm_object.c (vm_object_bootstrap): Likewise. * vm/vm_resident.c (vm_page_module_init): Likewise. (vm_page_bootstrap): Remove initialization of kentry_data.
2015-09-27Fix build with -DDEBUGJustus Winter
* device/cirbuf.c: Add missing include. * i386/i386/debug.h (dump_ss): Hide declaration from assembler. * i386/i386/debug_i386.c: Fix include. * kern/sched_prim.h: Add missing include, fix declaration.
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-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-05-19kern: import `macros.h' from x15Justus Winter
Import the macro definitions from the x15 kernel project, and replace all similar definitions littered all over the place with it. Importing this file will make importing code from the x15 kernel easier. We are already using the red-black tree implementation and the slab allocator from it, and we will import even more code in the near future. * kern/list.h: Do not define `structof', include `macros.h' instead. * kern/rbtree.h: Likewise. * kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. * i386/grub/misc.h: Likewise. * i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. * kern/macro_help.h: Delete file. Replaced by `macros.h'. * kern/macros.h: New file. * Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. * device/dev_master.h: Adopt accordingly. * device/io_req.h: Likewise. * device/net_io.h: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * kern/assert.h: Likewise. * kern/ast.h: Likewise. * kern/pc_sample.h: Likewise. * kern/refcount.h: Likewise. * kern/sched.h: Likewise. * kern/sched_prim.c: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_page.h: Likewise.
2015-05-02Fix warningsSamuel Thibault
* device/ds_routines.c (device_open, ds_open_done, device_close, device_write, device_write_inband, ds_write_done, device_read, device_read_inband, ds_read_done, device_set_status, mach_device_get_status, device_set_filter, device_map, ds_no_senders): Convert from K&R declaration, fix type of `device' into void*.
2015-05-02Fix block_io_mmap prototypeSamuel Thibault
* device/blkio.c (block_io_mmap): Fix prototype of dummy function. * device/blkio.h (block_io_mmap): Likewise.
2015-01-02device: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2014-06-11device: fix net_rcv_msg-messagesJustus Winter
Previously, all net_rcv_msg-messages sent by net_deliver were malformed. It never was a problem in practice, since the messages are not complex and thus the kernel does not try to parse the message. struct net_rcv_msg contains an additional field of type boolean_t. This field has no associated type descriptor, so it must not be included in the message. * device/net_io.c (net_deliver): Account for the extra field in the msgh_size calculation.
2014-04-04Convert from K&R to ANSIMarin Ramesa
Convert from K&R style function definitions to ANSI style function definitions. * ddb/db_access.c: Convert function prototypes from K&R to ANSI. * ddb/db_aout.c: Likewise. * ddb/db_break.c: Likewise. * ddb/db_command.c: Likewise. * ddb/db_cond.c: Likewise. * ddb/db_examine.c: Likewise. * ddb/db_expr.c: Likewise. * ddb/db_ext_symtab.c: Likewise. * ddb/db_input.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_mp.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_run.c: Likewise. * ddb/db_sym.c: Likewise. * ddb/db_task_thread.c: Likewise. * ddb/db_trap.c: Likewise. * ddb/db_variables.c: Likewise. * ddb/db_watch.c: Likewise. * device/blkio.c: Likewise. * device/chario.c: Likewise. * device/dev_lookup.c: Likewise. * device/dev_name.c: Likewise. * device/dev_pager.c: Likewise. * device/ds_routines.c: Likewise. * device/net_io.c: Likewise. * device/subrs.c: Likewise. * i386/i386/db_interface.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_map.c: Likewise. * i386/i386/loose_ends.c: Likewise. * i386/i386/mp_desc.c: Likewise. * i386/i386/pcb.c: Likewise. * i386/i386/phys.c: Likewise. * i386/i386/trap.c: Likewise. * i386/i386/user_ldt.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_queue.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/i386at/rtc.c: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_entry.c: Likewise. * ipc/ipc_hash.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_mqueue.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_right.c: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_port.c: Likewise. * ipc/mach_rpc.c: Likewise. * kern/act.c: Likewise. * kern/exception.c: Likewise. * kern/ipc_mig.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/lock_mon.c: Likewise. * kern/mach_clock.c: Likewise. * kern/machine.c: Likewise. * kern/printf.c: Likewise. * kern/priority.c: Likewise. * kern/startup.c: Likewise. * kern/syscall_emulation.c: Likewise. * kern/syscall_subr.c: Likewise. * kern/thread_swap.c: Likewise. * kern/time_stamp.c: Likewise. * kern/timer.c: Likewise. * kern/xpr.c: Likewise. * vm/memory_object.c: Likewise. * vm/vm_debug.c: Likewise. * vm/vm_external.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_kern.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_pageout.c: Likewise. * vm/vm_user.c: Likewise.
2014-04-04Use explicit prototypes for struct dev_ops fieldsMarin Ramesa
* device/conf.h: Include <sys/types.h>, <mach/port.h>, <mach/vm_prot.h>. Predefine struct io_req, io_req_t and io_return_t. (dev_ops): Add explicit prototypes for d_open, d_close, d_read, d_write, d_getstat, d_setstat, d_mmap, d_port_death. (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): Add prototypes. (nomap): Fix prototype. * device/dev_name.c (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): New functions. (nomap): Fix prototype. * device/ds_routines.c (dev_close): Pass 0 as flag parameter. * device/kmsg.c (kmsgclose): Drop return value. * device/kmsg.h (kmsgclose): Fix prototype. * i386/i386at/com.c (comopen): Fix prototype. (comclose): Fix prototype, drop return value. (comread, comwrite): Fix prototype. * i386/i386at/com.h (comopen, comclose, comread, comwrite): Fix prototype. * i386/i386at/conf.c (dev_ops): Use nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath where appropriate. * i386/i386at/kd.c (kdclose, kdread, kdwrite, kdmmap): Fix prototype. * i386/i386at/kd.h (kdclose, kdread, kdwrite, kdmmap): Likewise. * i386/i386at/kd_event.c (kbdopen): Likewise. * i386/i386at/kd_event.h (kbdopen): Likewise. * i386/i386at/kd_mouse.c (mouseopen): Likewise. * i386/i386at/kd_mouse.h (mouseopen): Likewise. * i386/i386at/lpr.c (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/lpr.h (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/mem.c (memmmap): Likewise. * i386/i386at/mem.h (memmmap): Likewise. * i386/i386at/model_dep.c (timemmap): Likewise. * i386/i386at/model_dep.h (timemmap): Likewise. * kern/mach_clock.c (timeopen, timeclose): Likewise. * kern/mach_clock.h: Include <sys/types.h>, predefine struct io_req and io_req_t. (timeopen, timeclose): Fix prototype.
2014-02-05Remove duplicate typedefSamuel Thibault
* device/net_io.c (net_rcv_port_t, net_hash_entry_t, net_hash_header_t): Remove duplicate typedefs.
2013-12-20Mark pure functions with attribute pureMarin Ramesa
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-17Mark functions that don't return with attribute noreturnMarin Ramesa
2013-12-17device: 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-15device/dev_pager.c (device_pager_data_request_done): cast to size_t instead ↵Marin Ramesa
to unsigned * device/dev_pager.c (device_pager_data_request_done) (memset) (io_residual): Cast to size_t instead to unsigned.
2013-12-15device/dev_pager.c: remove unnecessary castsMarin Ramesa
Variable pager is already of ipc_port_t type. * device/dev_pager.c: Remove unnecessary casts.
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-10device/subrs.c: use io_req_t instead of struct bufMarin Ramesa
Struct buf is not defined. Use io_req_t instead of it. * device/subrs.c (harderr) (bp): Change name to ior and use io_req_t as type instead of (struct buf *). (harderr) (minor): Use io_unit instead of b_dev. (harderr): Use io_recnum instead of b_blkno. (gateblk): Use io_req_t as return value instead of (struct buf *). (brelse) (bp): Change name to ior and use io_req_t as type instead of (struct buf *). (brelse) (ior): Remove variable.
2013-12-10device/net_io.c: remove forward declarationsMarin Ramesa
* device/net_io.c (bpf_hash, net_do_filter, bpf_do_filter, hash_ent_remove, net_free_dead_infp, net_free_dead_entp, bpf_validate, bpf_eq, net_add_q_info, bpf_match): Remove forward declarations. * device/net_io.h (net_rcv_port, net_hash_entry, net_hash_header): Declare forward. (bpf_hash, net_do_filter, bpf_do_filter, hash_ent_remove, net_free_dead_infp, net_free_dead_entp, bpf_validate, bpf_eq, net_add_q_info, bpf_match): Add prototypes.
2013-12-10device/dev_pager.c: remove forward declarationsMarin Ramesa
* device/dev_pager.c (device_pager_data_request_done, device_pager_data_write_done): Remove forward declarations. * device/dev_pager.h (device_pager_data_request_done, device_pager_data_write_done): Add prototypes.
2013-12-10device/dev_pager.c: remove forward declarationMarin Ramesa
* Makefrag.am: Include device/blkio.h. * device/blkio.h: New file. Add copyright. [_DEVICE_BLKIO_H_]: Add ifndef. (block_io_mmap): Add prototype. * device/dev_pager.c: Include device/blkio.h. (block_io_mmap): Remove forward declaration.