MCPcopy Create free account
hub / github.com/F-Stack/f-stack / exec_alloc_args_kva

Function exec_alloc_args_kva

freebsd/kern/kern_exec.c:1316–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1314SYSINIT(exec_args_kva, SI_SUB_EXEC, SI_ORDER_ANY, exec_prealloc_args_kva, NULL);
1315
1316static vm_offset_t
1317exec_alloc_args_kva(void **cookie)
1318{
1319 struct exec_args_kva *argkva;
1320
1321 argkva = (void *)atomic_readandclear_ptr(
1322 (uintptr_t *)DPCPU_PTR(exec_args_kva));
1323 if (argkva == NULL) {
1324 mtx_lock(&exec_args_kva_mtx);
1325 while ((argkva = SLIST_FIRST(&exec_args_kva_freelist)) == NULL)
1326 (void)mtx_sleep(&exec_args_kva_freelist,
1327 &exec_args_kva_mtx, 0, "execkva", 0);
1328 SLIST_REMOVE_HEAD(&exec_args_kva_freelist, next);
1329 mtx_unlock(&exec_args_kva_mtx);
1330 }
1331 *(struct exec_args_kva **)cookie = argkva;
1332 return (argkva->addr);
1333}
1334
1335static void
1336exec_release_args_kva(struct exec_args_kva *argkva, u_int gen)

Callers 1

exec_alloc_argsFunction · 0.85

Calls 2

mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected