--- Gnu-Mach/kern/act.c 2020/09/02 04:42:45 1.1.1.2 +++ Gnu-Mach/kern/act.c 2020/09/02 04:47:30 1.1.1.4 @@ -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]; @@ -63,14 +64,11 @@ static Act free_acts[ACT_STATIC_KLUDGE]; Act null_act; void -global_act_init() +global_act_init(void) { #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; @@ -260,7 +257,7 @@ void act_detach(Act *cur_act) so RPC entry paths need not check it. Locking: Act */ -void act_execute_returnhandlers() +void act_execute_returnhandlers(void) { Act *act = current_act(); @@ -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; @@ -1028,11 +1013,11 @@ act_set_special_port(Act *act, int which * Return thread's machine-dependent state. */ kern_return_t -act_get_state_immediate(act, flavor, old_state, old_state_count) - register Act *act; - int flavor; - void *old_state; /* pointer to OUT array */ - unsigned int *old_state_count; /*IN/OUT*/ +act_get_state_immediate( + Act *act, + int flavor, + void *old_state, /* pointer to OUT array */ + unsigned int *old_state_count) /*IN/OUT*/ { kern_return_t ret; @@ -1054,11 +1039,11 @@ act_get_state_immediate(act, flavor, old * Change thread's machine-dependent state. */ kern_return_t -act_set_state_immediate(act, flavor, new_state, new_state_count) - register Act *act; - int flavor; - void *new_state; - unsigned int new_state_count; +act_set_state_immediate( + Act *act, + int flavor, + void *new_state, + unsigned int new_state_count) { kern_return_t ret; @@ -1076,7 +1061,7 @@ act_set_state_immediate(act, flavor, new return act_set_state(act, flavor, new_state, new_state_count); } -void act_count() +void act_count(void) { int i; Act *act; @@ -1091,7 +1076,7 @@ void act_count() ACT_STATIC_KLUDGE-i, ACT_STATIC_KLUDGE, ACT_STATIC_KLUDGE-amin); } -dump_act(act) +void dump_act(act) Act *act; { act_count(); @@ -1112,8 +1097,7 @@ dump_act(act) #ifdef ACTWATCH Act * -get_next_act(sp) - int sp; +get_next_act(int sp) { static int i; Act *act; @@ -1129,6 +1113,6 @@ get_next_act(sp) return act; } } -#endif +#endif /* ACTWATCH */ #endif /* MIGRATING_THREADS */