--- Gnu-Mach/kern/act.c 2020/09/02 04:42:45 1.1.1.2 +++ Gnu-Mach/kern/act.c 2020/09/02 04:45:16 1.1.1.3 @@ -26,13 +26,14 @@ #ifdef MIGRATING_THREADS -#include /* XXX */ +#include + #include #include -#include /* XXX INCALL_... */ -#include +#include #include #include +#include #include #include #include "ipc_target.h" @@ -45,7 +46,7 @@ static void special_handler(ReturnHandle #endif #ifndef ACT_STATIC_KLUDGE -static zone_t act_zone; +static struct kmem_cache act_cache; #else static Act *act_freelist; static Act free_acts[ACT_STATIC_KLUDGE]; @@ -66,11 +67,8 @@ void global_act_init() { #ifndef ACT_STATIC_KLUDGE - act_zone = zinit( - sizeof(struct Act), - ACT_MAX * sizeof(struct Act), /* XXX */ - ACT_CHUNK * sizeof(struct Act), - 0, "activations"); + kmem_cache_init(&act_cache, "Act", sizeof(struct Act), 0, + NULL, NULL, NULL, 0); #else int i; @@ -99,10 +97,9 @@ kern_return_t act_create(task_t task, vm struct Act **new_act) { Act *act; - int rc; #ifndef ACT_STATIC_KLUDGE - act = (Act*)zalloc(act_zone); + act = (Act*)kmem_cache_alloc(&act_cache); if (act == 0) return(KERN_RESOURCE_SHORTAGE); #else @@ -113,7 +110,7 @@ kern_return_t act_create(task_t task, vm /* XXX ipt_unlock(act_freelist); */ act->ipt_next = 0; #endif - bzero(act, sizeof(*act)); /*XXX shouldn't be needed */ + memset(act, 0, sizeof(*act)); /*XXX shouldn't be needed */ #ifdef DEBUG act->lower = act->higher = 0; @@ -168,9 +165,9 @@ static void act_free(Act *inc) /* Drop the task reference. */ task_deallocate(inc->task); - /* Put the act back on the act zone */ + /* Put the act back on the act cache */ #ifndef ACT_STATIC_KLUDGE - zfree(act_zone, (vm_offset_t)inc); + kmem_cache_free(&act_cache, (vm_offset_t)inc); #else /* XXX ipt_lock(act_freelist); */ inc->ipt_next = act_freelist; @@ -930,12 +927,6 @@ act_get_special_port(Act *act, int which return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &act->reply_port; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &act->self_port; break; @@ -990,12 +981,6 @@ act_set_special_port(Act *act, int which return KERN_INVALID_ARGUMENT; switch (which) { -#if MACH_IPC_COMPAT - case THREAD_REPLY_PORT: - whichp = &act->reply_port; - break; -#endif /* MACH_IPC_COMPAT */ - case THREAD_KERNEL_PORT: whichp = &act->self_port; break;