diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-09-28 18:52:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-09-28 18:52:05 +0000 |
commit | a8b4c6caa0059e35247ea2d0964c85075b4e3431 (patch) | |
tree | 0f1d5142f33488748b2add1d689cc75163f466b6 /sys | |
parent | 38607a0ec7c00ec1a22cd6444f4837a1bf98e38c (diff) |
Replace uvm_km_alloc(9) and uvm_km_free(9) with the equivalent km_alooc(9)
and km_free(9) calls.
ok tedu@, mlarkin@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_exec.c | 15 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 0fbe007a905..ec83a6b04b3 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.145 2014/09/08 01:47:06 guenther Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.146 2014/09/28 18:52:04 kettenis Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -73,6 +73,11 @@ #include <dev/systrace.h> #endif +const struct kmem_va_mode kv_exec = { + .kv_wait = 1, + .kv_map = &exec_map +}; + /* * Map the shared signal code. */ @@ -317,7 +322,7 @@ sys_execve(struct proc *p, void *v, register_t *retval) /* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */ /* allocate an argument buffer */ - argp = (char *) uvm_km_valloc_wait(exec_map, NCARGS); + argp = km_alloc(NCARGS, &kv_exec, &kp_pageable, &kd_waitok); #ifdef DIAGNOSTIC if (argp == NULL) panic("execve: argp == NULL"); @@ -617,7 +622,7 @@ sys_execve(struct proc *p, void *v, register_t *retval) timespecclear(&p->p_tu.tu_runtime); p->p_tu.tu_uticks = p->p_tu.tu_sticks = p->p_tu.tu_iticks = 0; - uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS); + km_free(argp, NCARGS, &kv_exec, &kp_pageable); pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf); vn_close(pack.ep_vp, FREAD, cred, p); @@ -717,7 +722,7 @@ bad: /* close and put the exec'd file */ vn_close(pack.ep_vp, FREAD, cred, p); pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf); - uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS); + km_free(argp, NCARGS, &kv_exec, &kp_pageable); freehdr: free(pack.ep_hdr, M_EXEC, 0); @@ -746,7 +751,7 @@ exec_abort: free(pack.ep_emul_arg, M_TEMP, 0); pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf); vn_close(pack.ep_vp, FREAD, cred, p); - uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS); + km_free(argp, NCARGS, &kv_exec, &kp_pageable); free_pack_abort: free(pack.ep_hdr, M_EXEC, 0); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index cf8d88b51e7..0fff90220e8 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.66 2014/08/31 01:42:36 guenther Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.67 2014/09/28 18:52:04 kettenis Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -201,7 +201,7 @@ pipespace(struct pipe *cpipe, u_int size) { caddr_t buffer; - buffer = (caddr_t)uvm_km_valloc(kernel_map, size); + buffer = km_alloc(size, &kv_any, &kp_pageable, &kd_waitok); if (buffer == NULL) { return (ENOMEM); } @@ -748,8 +748,8 @@ pipe_free_kmem(struct pipe *cpipe) if (cpipe->pipe_buffer.size > PIPE_SIZE) --nbigpipe; amountpipekva -= cpipe->pipe_buffer.size; - uvm_km_free(kernel_map, (vaddr_t)cpipe->pipe_buffer.buffer, - cpipe->pipe_buffer.size); + km_free(cpipe->pipe_buffer.buffer, cpipe->pipe_buffer.size, + &kv_any, &kp_pageable); cpipe->pipe_buffer.buffer = NULL; } } |