--- Gnu-Mach/ipc/ipc_hash.c 2020/09/02 04:36:56 1.1.1.1 +++ Gnu-Mach/ipc/ipc_hash.c 2020/09/02 04:47:20 1.1.1.3 @@ -31,6 +31,7 @@ * Entry hash table operations. */ +#include #include #include #include @@ -43,7 +44,6 @@ #include #include -#include #if MACH_IPC_DEBUG #include #include @@ -64,11 +64,11 @@ */ boolean_t -ipc_hash_lookup(space, obj, namep, entryp) - ipc_space_t space; - ipc_object_t obj; - mach_port_t *namep; - ipc_entry_t *entryp; +ipc_hash_lookup( + ipc_space_t space, + ipc_object_t obj, + mach_port_t *namep, + ipc_entry_t *entryp) { return (ipc_hash_local_lookup(space, obj, namep, entryp) || ((space->is_tree_hash > 0) && @@ -136,8 +136,6 @@ ipc_hash_delete( * Within each bucket, move-to-front is used. */ -typedef natural_t ipc_hash_index_t; - ipc_hash_index_t ipc_hash_global_size; ipc_hash_index_t ipc_hash_global_mask; @@ -328,7 +326,7 @@ ipc_hash_global_delete( */ #define IH_LOCAL_HASH(obj, size) \ - ((((mach_port_index_t) (obj)) >> 6) % (size)) + ((((mach_port_index_t) (vm_offset_t) (obj)) >> 6) & (size - 1)) /* * Routine: ipc_hash_local_lookup @@ -537,13 +535,9 @@ ipc_hash_init(void) { ipc_hash_index_t i; - /* if not configured, initialize ipc_hash_global_size */ + /* initialize ipc_hash_global_size */ - if (ipc_hash_global_size == 0) { - ipc_hash_global_size = ipc_tree_entry_max >> 8; - if (ipc_hash_global_size < 32) - ipc_hash_global_size = 32; - } + ipc_hash_global_size = IPC_HASH_GLOBAL_SIZE; /* make sure it is a power of two */