summaryrefslogtreecommitdiff
path: root/ipc
AgeCommit message (Collapse)Author
2015-01-22ipc: warn about more port management bugsJustus Winter
* ipc/mach_port.c (mach_port_destroy): Simplify expression. Reword warning. (mach_port_deallocate): Likewise. (mach_port_mod_refs): Also warn about errors when using this function.
2015-01-02ipc: Fix typo in comment (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2014-12-16ipc: guard test code with `MACH_IPC_TEST'Justus Winter
* ipc/ipc_kmsg.h (ikm_mark_bogus): New macro. (ipc_kmsg_rmqueue_first_macro): Use `ikm_mark_bogus'. * ipc/ipc_kmsg.c (ipc_kmsg_rmqueue): Likewise.
2014-12-16ipc: tune size of cached kernel message buffersJustus Winter
The previous limit was 256 bytes. That seems a little crummy by todays standards, and we are frequently sending bigger packets (e.g. every RPC containing a string_t on Hurd). Use the page size for IKM_SAVED_KMSG_SIZE to make sure the page is pinned to a single processor. * ipc/ipc_kmsg.h (IKM_SAVED_KMSG_SIZE): Define to `PAGE_SIZE'.
2014-12-09Retire procedure `old_mach_port_get_receive_status'Justus Winter
Retire the compatibility RPC `old_mach_port_get_receive_status' that works like `mach_port_get_receive_status' but returns an `old_mach_port_status' object that lacks the `mps_seqno' field. Do not remove the type yet, so we do not break anyones build. The RPC stubs currently distributed with the glibc require it. * include/mach/mach_port.defs (old_mach_port_get_receive_status): Drop RPC. * include/mach/mach_types.defs (old_mach_port_status_t): Drop type. * include/mach/port.h (old_mach_port_status_t): Add note to remove this for the 1.6 release. * ipc/mach_port.c (old_mach_port_get_receive_status): Drop function.
2014-11-02Fix build when gcc avoids inliningSamuel Thibault
* ipc/ipc_port.h (ipc_port_flag_protected_payload, ipc_port_flag_protected_payload_set, ipc_port_flag_protected_payload_clear): Use static inline qualifier instead of extern inline.
2014-10-01ipc: provide the protected payload in ipc_kmsg_copyout_headerJustus Winter
* ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): If a protected payload is set for the destination port, provide it in msgh_protected_payload. * ipc/mach_msg.c (mach_msg_trap): Likewise in the fast paths. * doc/mach.texi (Message Receive): Document message semantics with protected payloads.
2014-10-01ipc: implement mach_port_{set,clear}_protected_payloadJustus Winter
* include/mach/mach_port.defs: Add mach_port_{set,clear}_protected_payload. * ipc/mach_port.c: Implement mach_port_{set,clear}_protected_payload. * doc/mach.texi (Receive Rights): Document mach_port_{set,clear}_protected_payload.
2014-10-01ipc: add protected payloadJustus Winter
Add a field ip_protected_payload and a flag ip_has_protected_payload to struct ipc_port. Clear the protected payload when a receive port is moved from one ipc space to another. This is done to retain the old behavior of mach_msg, so that a port name is sent in the msgh_local_port field. If the new owner of that receive right wishes to use the protected payload mechanism, it has to be explicitly set again. * ipc/ipc_port.h (struct ipc_port): Add field ip_protected_payload. (ipc_port_set_protected_payload): Add function declaration. (ipc_port_clear_protected_payload): Likewise. (ipc_port_flag_protected_payload): Add accessor for the protected payload flag. (ipc_port_flag_protected_payload_set): Likewise. (ipc_port_flag_protected_payload_clear): Likewise. * ipc/ipc_port.c (ipc_port_init): Initialize protected payload. (ipc_port_print): Print protected_payload. (ipc_port_set_protected_payload): New function. (ipc_port_clear_protected_payload): Likewise. (ipc_port_destroy): Clear the payload when moving a receive port. * ipc/ipc_right.c (ipc_right_copyin): Likewise. (ipc_right_copyout): Likewise. * ipc/ipc_object.c (ipc_object_copyin_from_kernel): Likewise. * ipc/ipc_object.h (IO_BITS_PROTECTED_PAYLOAD): New bitmask. (IO_BITS_OTYPE): Adjust accordingly.
2014-09-30ipc: use fast modulo operation in local hash tableJustus Winter
* ipc/ipc_table.h: Document that table sizes must be powers of two. * ipc/ipc_hash.c (IH_LOCAL_HASH): Use fast modulo operation.
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-02-01ipc: use the name of the task for error messagesJustus Winter
* ipc/mach_port.c (mach_port_destroy): Use the name of the task for error messages. (mach_port_deallocate): Likewise.
2013-12-17ipc: qualify pointers whose dereferenced values are constant with constMarin Ramesa
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-15Declare void argument listsMarin Ramesa
2013-12-11ipc/mach_debug.c (mach_port_kernel_object): remove unnecessary castMarin Ramesa
Member ip_kobject is of type vm_offset_t. * ipc/mach_debug.c (mach_port_kernel_object) (ip_kobject): Remove unnecessary cast.
2013-12-11ipc/mach_debug.c (mach_port_kernel_object): remove unnecessary castMarin Ramesa
Return value from ip_kotype is an unsigned int. * ipc/mach_debug.c (mach_port_kernel_object) (ip_kotype): Remove unnecessary cast.
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-09ipc/port.h: update commentMarin Ramesa
This is ipc/port.h. Not ipc/ipc_port.h. * ipc/port.h: Update comment.
2013-12-09ipc/mach_port.c: use boolean instead of an intMarin Ramesa
* ipc/mach_port.c (mach_port_deallocate_debug): Use boolean instead of an int.
2013-12-09ipc/ipc_init.c: qualify constant with constMarin Ramesa
* ipc/ipc_init.c (ipc_kernel_map_size): Qualify constant with const.
2013-12-08ipc/ipc_port.c: trivial stylistic fix for consistencyMarin Ramesa
* ipc/ipc_port.c (indent): Trivial stylistic fix for consistency.
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-05ipc/mach_port.c: remove forward declarationMarin Ramesa
* ipc/mach_port.c (mach_port_get_receive_status): Remove forward declaration. * ipc/mach_port.h (mach_port_get_receive_status): Add prototype.
2013-12-05ipc/ipc_entry.c: remove forward declarationMarin Ramesa
* ipc/ipc_entry.c (db_ipc_object_by_name): Remove forward declaration. * ipc/ipc_entry.h (db_ipc_object_by_name): Add prototype.
2013-12-05ipc/ipc_kmsg.h: update commentMarin Ramesa
Struct ipc_kmsg_queue is not defined in kern/thread.h. * ipc/ipc_kmsg.h: Update comment.
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-05ipc/mach_msg.c: remove forward declarationsMarin Ramesa
* ipc/mach_msg.c: Include kern/exception.h. (exception_raise_continue, exception_raise_continue_fast): Remove forward declarations. * kern/exception.h: Include ipc/ipc_types.h. Include ipc/ipc_kmsg.h.
2013-12-05ipc/ipc_table.c: remove forward declarationMarin Ramesa
* ipc/ipc_table.c (ipc_table_fill): Remove forward declaration. * ipc/ipc_table.h (ipc_table_fill): Add prototype.
2013-12-05ipc/ipc_kmsg.c: remove forward declarationsMarin Ramesa
* ipc/ipc_kmsg.c (copyinmap, copyoutmap, ipc_msg_print): Remove forward declarations. * ipc/ipc_kmsg.h (ipc_msg_print): Add prototype.
2013-11-24Export mach_port_destroy declarationRichard Braun
* ipc/mach_port.h (mach_port_destroy): Add prototype.
2013-11-20ipc/ipc_print.h: include ipc/ipc_pset.h for ipc_pset_tMarin Ramesa
* ipc/ipc_print.h: Include ipc/ipc_pset.h for ipc_pset_t.
2013-11-19Add copyrightMarin Ramesa
* ddb/db_write_cmd.h: Add copyright. * ipc/ipc_print.h: Likewise. * vm/vm_print.h: Likewise.
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-11ipc: remove register qualifiersMarin Ramesa
* ipc/ipc_thread.h: Remove register qualifiers.
2013-11-11ipc: remove register qualifiersMarin Ramesa
* ipc/mach_msg.c: Remove register qualifiers.
2013-11-11ipc: qualify constants with constMarin Ramesa
* ipc/ipc_table.c: Qualify constants with const.
2013-11-11ipc: trivial stylistic fix for consistencyMarin Ramesa
* ipc/ipc_pset.c: Trivial stylistic fix for consistency.
2013-11-11ipc: remove register qualifiersMarin Ramesa
* ipc/ipc_kmsg.c: Remove register qualifiers.
2013-07-18ipc: organize ipc print function prototypesMarin Ramesa
* ipc/ipc_print.h: New file. [MACH_KDB] Include <mach/mach_types.h>. [MACH_KDB] Include <mach/message.h>. [MACH_KDB] Include <ipc/ipc_types.h>. (ipc_port_print): Add prototype. (ipc_pset_print): Likewise. (ipc_kmsg_print): Likewise. (ipc_msg_print): Likewise. * ipc/ipc_port.h (ipc_port_print): Remove prototype. * ipc/ipc_port.c [MACH_KDB]: Include <ipc/ipc_print.h>. * ipc/ipc_pset.h (ipc_pset_print): Remove prototype. * ipc/ipc_pset.c [MACH_KDB]: Include <ipc/ipc_print.h>. * ipc/ipc_kmsg.c [MACH_KDB]: Include <ipc/ipc_print.h>.
2013-06-02Remove unused variableMiguel Figueiredo
* ipc/mach_port.c (mach_port_set_syscall_right): Remove unused variable.
2013-01-13Add statistics for task_events_infoDavid Höppner
* ipc/ipc_mqueue.c (ipc_mqueue_send, ipc_mqueue_receive): Increment counters for message sent and received. * kern/ipc_kobject.c (ipc_kobject_server): Increment sent and received counters for the kernel task. * kern/task.c (task_create): Zero statistics. * kern/task.c (task_info): Add task_events_info call. * kern/task.h: Add statistics. * vm/vm_fault.c (vm_fault_page): Increment zero_fills, pageins, reactivations and cow_faults counters. * vm/vm_fault.c (vm_fault_wire_fast): Increment faults counters. * vm/vm_pageout.c (vm_pageout_scan): Increment reactivations counter.
2013-01-04Fix compilation warning implicit function declaration kdbprintfDavid Höppner
When kernel debugger support is requested ipc and vm need the prototype for the debugger function kdbprintf. * ddb/db_output.h: Add prototype for kdbprintf. * ipc/ipc_object.c: Add include file ddb/db_output.h * ipc/ipc_port.c: Likewise. * ipc/ipc_pset.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_object.c: Likewise. * vm/vm_resident.c: Likewise.
2012-08-24Store threads waiting on a message queue in LIFO orderRichard Braun
* ipc/ipc_thread.h (ipc_thread_enqueue_macro): Insert thread at the head of the list instead of the tail.
2012-07-07Merge kalloc_map into kmem_mapRichard Braun
* ipc/ipc_table.c: Add #include <kern/slab.h>. (ipc_table_alloc): Use kmem_map instead of kalloc_map when allocating a table. (ipc_table_realloc): Likewise for reallocation. (ipc_table_free): Likewise for release. * kern/kalloc.h (kalloc_map): Remove declaration. * kern/slab.c (KMEM_MAP_SIZE): Increase to 128 MiB. (KALLOC_MAP_SIZE): Remove macro. (kalloc_map_store): Remove variable. (kalloc_map): Likewise. (kalloc_pagealloc): Use kmem_map instead of kalloc_map for general purpose allocations. (kalloc_pagefree): Likewise. (kalloc_init): Remove the creation of kalloc_map.
2012-03-09Use unsigned long for addresses and sizesSamuel Thibault
TODO: remonter formats * i386/include/mach/i386/vm_types.h (vm_offset_t): Define to unsigned long. (signed32_t): Define to signed int. (unsigned32_t): Define to unsigned int. * i386/include/mach/sa/stdarg.h (__va_size): Use sizeof(unsigned long)-1 instead of 3. * include/mach/port.h (mach_port_t): Define to vm_offset_t instead of natural_t. * include/sys/types.h (size_t): Define to unsigned long instead of natural_t. * linux/src/include/asm-i386/posix_types.h (__kernel_size_t): Define to unsigned long. (__kernel_ssize_t): Define to long. * linux/src/include/linux/stddef.h (size_t): Define to unsigned long. * device/dev_pager.c (dev_pager_hash): Cast port to vm_offset_t insted of natural_t. (device_pager_data_request): Fix format. * device/ds_routines.c (ds_no_senders): Fix format. * i386/i386/io_map.c (io_map): Likewise. * i386/i386at/autoconf.c (take_dev_irq): Likewise. * i386/i386at/com.c (comattach): Likewise. * i386/i386at/lpr.c (lprattach): Likewise. * i386/i386at/model_dep.c (mem_size_init, mem_size_init, c_boot_entry): Likewise. * i386/intel/pmap.c (pmap_enter): Likewise. * ipc/ipc_notify.c (ipc_notify_port_deleted, ipc_notify_msg_accepted, ipc_notify_dead_name): Likewise. * ipc/mach_port.c (mach_port_destroy, mach_port_deallocate): Likewise. * kern/ipc_kobject.c (ipc_kobject_destroy): Likewise. * kern/slab.c (kalloc_init): Likewise. * vm/vm_fault.c (vm_fault_page): Likewise. * vm/vm_map.c (vm_map_pmap_enter): Likewise. * xen/block.c (device_read): Likewise. * device/net_io.c (bpf_match): Take unsigned long * instead of unsigned int *. (bpf_do_filter): Make mem unsigned long instead of long. * i386/i386/ktss.c (ktss_init): Cast pointer to unsigned long instead of unsigned. * i386/i386/pcb.c (stack_attach, switch_ktss): Cast pointers to long instead of int. * i386/i386/trap.c (dump_ss): Likewise. * ipc/ipc_hash.c (IH_LOCAL_HASH): Cast object to vm_offset_t. * ipc/mach_msg.c (mach_msg_receive, mach_msg_receive_continue): Cast kmsg to vm_offset_t instead of natural_t. * kern/pc_sample.c (take_pc_sample): Cast to vm_offset_t instead of natural_t. * kern/boot_script.c (sym, arg): Set type of `val' field to long instead of int. (create_task, builtin_symbols, boot_script_parse_line, boot_script_define_function): Cast to long instead of int. * kern/bootstrap.c (bootstrap_create): Likewise. * kern/sched_prim.c (decl_simple_lock_data): Likewise. * kern/printf.c (vsnprintf): Set size type to size_t. * kern/printf.h (vsnprintf): Likewise. * vm/vm_map.h (kentry_data_size): Fix type to vm_size_t. * vm/vm_object.c (vm_object_pmap_protect_by_page): Fix size parameter type to vm_size_t.
2012-01-09Improve ipc hash/marequest init readabilityRichard Braun
Use macros instead of raw numeric values. * ipc/ipc_hash.h (IPC_HASH_GLOBAL_SIZE): New macro. * ipc/ipc_hash.c (ipc_hash_init): Directly set the global hash table size to IPC_HASH_GLOBAL_SIZE. * ipc/ipc_marequest.h (IPC_MAREQUEST_SIZE): New macro. * ipc/ipc_marequest.c (ipc_marequest_init): Directly set the marequest hash table size to IPC_MAREQUEST_SIZE.
2011-12-17Remove arbitrary limits used by the zone systemRichard Braun
The zone allocator could limit the size of its zones to an arbitrary value set at zinit() time. There is no such parameter with the slab module. As a result of removing those limits, the kern/mach_param.h header becomes empty, and is simply removed altogether. * Makefrag.am (libkernel_a_SOURCES): Remove kern/mach_param.h. * i386/i386/fpu.c: Remove #include <kern/mach_param.h>. * i386/i386/machine_task.c: Likewise. * i386/i386/pcb.c: Likewise. * ipc/ipc_init.c: Likewise. (ipc_space_max): Remove variable. (ipc_tree_entry_max): Likewise. (ipc_port_max): Likewise. (ipc_pset_max): Likewise. * ipc/ipc_init.h (IPC_ZONE_TYPE): Remove macro. (ipc_space_max): Remove extern declaration. (ipc_tree_entry_max): Likewise. (ipc_port_max): Likewise. (ipc_pset_max): Likewise. * ipc/ipc_hash.c (ipc_hash_init): Don't use ipc_tree_entry_max to compute ipc_hash_global_size. * ipc/ipc_marequest.c: Remove #include <kern/mach_param.h>. (ipc_marequest_max): Remove variable. (ipc_marequest_init): Don't use ipc_marequest_max to compute ipc_marequest_size. (ipc_marequest_info): Return (unsigned int)-1 in maxp. * kern/act.c: Remove #include <kern/mach_param.h>. * kern/mach_clock.c: Likewise. * kern/priority.c: Likewise. * kern/task.c: Likewise. * kern/thread.c: Likewise. * vm/memory_object_proxy.c: Likewise. * vm/vm_fault.c: Likewise.
2011-12-17Adjust VM initializationRichard Braun
Unlike the zone allocator, the slab code can't be fed with an initial chunk of memory. Some VM objects used early during startup now have to be statically allocated, and kernel map entries need a special path to avoid recursion when being allocated. * vm/vm_map.c (vm_submap_object_store): New variable. (vm_submap_object): Point to vm_submap_object_store. (kentry_data_size): Initialize to arbitrary value. (kentry_count): Remove variable. (kentry_pagealloc): New function. (vm_map_setup): Likewise. (vm_map_create): Replace initialization with a call to vm_map_setup(). * vm/vm_map.h (vm_map_setup): New prototype. * vm/vm_kern.c (kernel_map_store): New variable. (kernel_map): Point to kernel_map_store. (kmem_suballoc): Remove function. Replaced with... (kmem_submap): New function. (kmem_init): Call vm_map_setup() instead of vm_map_create(). * vm/vm_kern.h (kmem_suballoc): Remove prototype. (kmem_submap): New prototype. * vm/vm_object.c (kernel_object_store): New variable. (kernel_object): Point to kernel_object_store. (vm_object_template): Change type from vm_object_t to struct vm_object. (_vm_object_setup): New function. (_vm_object_allocate): Replace initialization with a call to _vm_object_setup(). (vm_object_bootstrap): Don't allocate vm_object_template, and use it as a structure instead of a pointer. Initialize kernel_object and vm_submap_object with _vm_object_setup() instead of _vm_object_allocate(). * vm/vm_resident.c (vm_page_bootstrap): Don't initialize kentry_data_size. * device/ds_routines.c (device_io_map_store): New variable. (device_io_map): Point to device_io_map_store. (mach_device_init): Call kmem_submap() instead of kmem_suballoc(). * ipc/ipc_init.c (ipc_kernel_map_store): New variable. (ipc_kernel_map): Point to ipc_kernel_map_store.
2011-12-17Adjust the kernel to use the slab allocatorRichard Braun
* device/dev_lookup.c: Replace zalloc header, types and function calls with their slab counterparts. * device/dev_pager.c: Likewise. * device/ds_routines.c: Likewise. * device/io_req.h: Likewise. * device/net_io.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_perm.c: Likewise. * i386/i386/machine_task.c: Likewise. * i386/i386/pcb.c: Likewise. * i386/i386/task.h: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/pmap.h: Remove #include <kernel/zalloc.h>. * include/mach_debug/mach_debug.defs (host_zone_info): Replace routine declaration with skip directive. (host_slab_info): New routine declaration. * include/mach_debug/mach_debug_types.defs (zone_name_t) (zone_name_array_t, zone_info_t, zone_info_array_t): Remove types. (cache_info_t, cache_info_array_t): New types. * include/mach_debug/mach_debug_types.h: Replace #include <mach_debug/zone_info.h> with <mach_debug/slab_info.h>. * ipc/ipc_entry.c: Replace zalloc header, types and function calls with their slab counterparts. * ipc/ipc_entry.h: Likewise. * ipc/ipc_init.c: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_object.c: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_space.c: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_table.c (kalloc_map): Remove extern declaration. * kern/act.c: Replace zalloc header, types and function calls with their slab counterparts. * kern/kalloc.h: Add #include <vm/vm_types.h>. (MINSIZE): Remove definition. (kalloc_map): Add extern declaration. (kget): Remove prototype. * kern/mach_clock.c: Adjust comment. * kern/processor.c: Replace zalloc header, types and function calls with their slab counterparts. * kern/startup.c: Remove #include <kernel/zalloc.h>. * kern/task.c: Replace zalloc header, types and function calls with their slab counterparts. * kern/thread.c: Likewise. * vm/memory_object_proxy.c: Likewise. * vm/vm_external.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_init.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_object.c: Likewise. * vm/vm_page.h: Remove #include <kernel/zalloc.h>. * vm/vm_pageout.c: Replace zalloc header, types and function calls with their slab counterparts. * vm/vm_resident.c: Likewise. (zdata, zdata_size): Remove declarations. (vm_page_bootstrap): Don't steal memory for the zone system.