summaryrefslogtreecommitdiff
path: root/device
AgeCommit message (Collapse)Author
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.
2013-12-10device/dev_pager.c (device_pager_data_request_done): remove unnecessary castMarin Ramesa
The argument to trunc_page() is already cast to vm_offset_t in the macro itself. * device/dev_pager.c (device_pager_data_request_done) (trunc_page) (io_data): Don't cast to vm_offset_t.
2013-12-10device/dev_pager.c (device_pager_data_request): cast to (void *) instead to ↵Marin Ramesa
(char *) * device/dev_pager.c (device_pager_data_request) (vm_object_page_map) (ds): Cast to (void *) instead to (char *).
2013-12-10device/dev_pager.c (device_pager_data_request): remove forward declarationMarin Ramesa
* Makefrag.am: Include device/dev_pager.h. * device/dev_pager.c: Likewise. (device_map_page): Remove forward declaration. * device/dev_pager.h: New file. Add copyright. [_DEVICE_DEV_PAGER_H_]: Add ifndef. (device_map_page): Add prototype.
2013-12-10device/cons.c: fix argument listMarin Ramesa
* device/cons.c (romgetc, romputc): Fix argument list.
2013-12-10device/cirbuf.c (cb_free): use vm_size_t instead of an intMarin Ramesa
This is more in line with the call to kfree() in cb_free(). * device/cirbuf.c (cb_free) (size): Use vm_size_t instead of an int.
2013-12-10device/cirbuf.c (cb_alloc): use vm_size_t instead of an intMarin Ramesa
This is more in line with the call to kalloc() in cb_alloc(). * device/chario.c (tty_inq_size, tty_outq_size): Use unsigned int instead if an int. * device/cirbuf.c (cb_alloc) (buf_size): Use vm_size_t instead of an int. * device/cirbuf.h (cb_alloc) (buf_size): Likewise.
2013-12-10device/chario.c: trivial stylistic fix for consistencyMarin Ramesa
* device/chario.c: Trivial stylistic fix for consistency.
2013-12-09i386/i386at/kd.c: use io_req instead of uioMarin Ramesa
Struct uio is nowhere defined and in device/buf.h the string uio is defined as io_req. Remove all declarations of uio structure and use io_req_t instead of it. * device/buf.h (uio, io_req): Remove definition. * i386/i386at/kd.c: Remove comment. (kdread): Use io_req_t. (kdwrite): Likewise. * i386/i386at/kd.h (kdread, kdwrite): Use io_req_t as argument type.
2013-12-09i386/i386at/com.c: fix assignment from incompatible pointer typeMarin Ramesa
* device/tty.h (tty): Modify so that correct argument list and return type is listed.
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-08device/tty.h, chario.h: move prototypeMarin Ramesa
Now that we have device/chario.h move the chario_init() prototype from device/tty.h to device/chario.h. * device/chario.h (chario_init): Add prototype. * device/device_init.c: Include device/chario.h. * device/tty.h (chario_init): Remove prototype.
2013-12-08device/kmsg.c: use boolean instead of an intMarin Ramesa
* device/kmsg.c (kmsg_init_done): Use boolean instead of an int.
2013-12-08device/kmsg.c: use boolean instead of an intMarin Ramesa
* device/kmsg.c (kmsg_in_use): Use boolean instead of an int.
2013-12-08device/if_ether.h: remove unused variableMarin Ramesa
* device/if_ether.h (etherbroadcastaddr): Remove unused variable. * device/subrs.c (etherbroadcastaddr): Remove initialization.
2013-12-08device/dev_lookup.c: remove unused lockMarin Ramesa
* device/dev_lookup.c (dev_port_lock): Remove unused lock.
2013-12-08device/cirbuf.c: use boolean instead of an intMarin Ramesa
* device/cirbuf.c (cb_check_enable): Use boolean instead of an int.
2013-12-08device/chario.c: use boolean instead of an intMarin Ramesa
* device/chario.c (pdma_default): Use boolean instead of an int.
2013-12-08Fix implicit declaration of functionSamuel Thibault
Thanks Marin Ramesa for the report. * device/ds_routines.h (device_deallocate): Move declaration to... * include/device/device_types.h (device_deallocate): ... here.
2013-12-08device/device_types_kernel.h: remove redeclaration of dev_port_lookup()Marin Ramesa
* device/device_types_kernel.h (dev_port_lookup): Remove prototype.
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/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/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.
2013-12-05device/device_init.c: remove forward declarationsMarin Ramesa
* device/dev_lookup.c: Include device/ds_routines.h. * device/device_init.c: Include device/ds_routines.h. Include device/net_io.h. (mach_device_init, dev_lookup_init, net_io_init, device_pager_init, io_done_thread, net_thread): Remove forward declarations. * device/ds_routines.h (mach_device_init, dev_lookup_init, device_pager_init, io_done_thread): Add prototypes. * device/net_io.h (net_io_init, net_thread): Add prototypes.
2013-12-05device/net_io.c: initialize hash_entp to NULLMarin Ramesa
* device/net_io.c (hash_entp): Initialize to NET_HASH_ENTRY_NULL.
2013-11-24device: new header file chario.hMarin Ramesa
* Makefrag.am: Include device/chario.h. * device/chario.c (queue_delayed_reply, tty_output, char_open_done, char_read_done, char_write_done): Remove forward declarations. * device/chario.h: New file. Add copyright. [_DEVICE_CHARIO_H_]: Add ifndef. Include device/tty.h. (queue_delayed_reply, tty_output, char_open_done, char_read_done, char_write_done): Add prototypes.
2013-11-18Add ifndefsMarin Ramesa
Finish up with the addition of ifndefs. * device/buf.h: Add ifndef. * device/dev_master.h: Likewise. * include/device/tty_status.h: Likewise. * include/mach/version.h: Likewise. * ipc/ipc_machdep.h: Likewise.
2013-11-10device: initialize to zero offsetMarin Ramesa
Initialize addr to zero offset to quiet warnings about uninitialized deallocation. * device/chario.c (addr): Initialize to zero.