summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-02-20 22:23:31 +0000
committerdg <dg@FreeBSD.org>1995-02-20 22:23:31 +0000
commit80d6bd62277e274c458ddf671134238fc6c0bf24 (patch)
tree843bfeb240cb65cf94c99ad6b5ea3b52fcc7f231 /sys
parentd59996f398d56d8eb85aa88910c9fd1a1200ecdc (diff)
downloadFreeBSD-src-80d6bd62277e274c458ddf671134238fc6c0bf24.zip
FreeBSD-src-80d6bd62277e274c458ddf671134238fc6c0bf24.tar.gz
Use of vm_allocate() and vm_deallocate() has been deprecated.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/vm_machdep.c6
-rw-r--r--sys/i386/i386/vm_machdep.c6
-rw-r--r--sys/kern/imgact_aout.c22
-rw-r--r--sys/kern/imgact_gzip.c32
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_exec.c38
-rw-r--r--sys/kern/sysv_shm.c6
7 files changed, 59 insertions, 55 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index e6c8d98..cb7ce5d 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.30 1995/01/09 16:04:40 davidg Exp $
+ * $Id: vm_machdep.c,v 1.31 1995/01/21 15:34:03 bde Exp $
*/
#include "npx.h"
@@ -861,8 +861,8 @@ grow(p, sp)
v = vm->vm_maxsaddr;
grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT);
}
- if (vm_allocate(&vm->vm_map, (vm_offset_t *)&v,
- grow_amount, FALSE) != KERN_SUCCESS) {
+ if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v,
+ grow_amount, FALSE) != KERN_SUCCESS)) {
return (0);
}
vm->vm_ssize += grow_amount >> PAGE_SHIFT;
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index e6c8d98..cb7ce5d 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.30 1995/01/09 16:04:40 davidg Exp $
+ * $Id: vm_machdep.c,v 1.31 1995/01/21 15:34:03 bde Exp $
*/
#include "npx.h"
@@ -861,8 +861,8 @@ grow(p, sp)
v = vm->vm_maxsaddr;
grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT);
}
- if (vm_allocate(&vm->vm_map, (vm_offset_t *)&v,
- grow_amount, FALSE) != KERN_SUCCESS) {
+ if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v,
+ grow_amount, FALSE) != KERN_SUCCESS)) {
return (0);
}
vm->vm_ssize += grow_amount >> PAGE_SHIFT;
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index 5d6454c..bdce10d 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: imgact_aout.c,v 1.9 1994/09/25 19:33:31 phk Exp $
+ * $Id: imgact_aout.c,v 1.10 1995/02/14 19:22:27 sos Exp $
*/
#include <sys/param.h>
@@ -170,15 +170,17 @@ exec_aout_imgact(iparams)
if (error)
return (error);
- /*
- * Allocate demand-zeroed area for uninitialized data
- * "bss" = 'block started by symbol' - named after the IBM 7090
- * instruction of the same name.
- */
- vmaddr = virtual_offset + a_out->a_text + a_out->a_data;
- error = vm_allocate(&vmspace->vm_map, &vmaddr, bss_size, FALSE);
- if (error)
- return (error);
+ if (bss_size != 0) {
+ /*
+ * Allocate demand-zeroed area for uninitialized data
+ * "bss" = 'block started by symbol' - named after the IBM 7090
+ * instruction of the same name.
+ */
+ vmaddr = virtual_offset + a_out->a_text + a_out->a_data;
+ error = vm_map_find(&vmspace->vm_map, NULL, 0, &vmaddr, bss_size, FALSE);
+ if (error)
+ return (error);
+ }
/* Fill in process VM information */
vmspace->vm_tsize = a_out->a_text >> PAGE_SHIFT;
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c
index 4d08c49..3178d10 100644
--- a/sys/kern/imgact_gzip.c
+++ b/sys/kern/imgact_gzip.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: imgact_gzip.c,v 1.10 1994/10/22 11:55:16 phk Exp $
+ * $Id: imgact_gzip.c,v 1.11 1995/02/13 07:40:33 phk Exp $
*
* This module handles execution of a.out files which have been run through
* "gzip". This saves diskspace, but wastes cpu-cycles and VM.
@@ -109,8 +109,8 @@ exec_gzip_imgact(iparams)
if (igz.inbuf) {
error2 =
- vm_deallocate(kernel_map, (vm_offset_t) igz.inbuf,
- PAGE_SIZE);
+ vm_map_remove(kernel_map, (vm_offset_t) igz.inbuf,
+ (vm_offset_t) igz.inbuf + PAGE_SIZE);
}
if (igz.error || error || error2) {
printf("Output=%lu ", igz.output);
@@ -243,16 +243,18 @@ do_aout_hdr(struct imgact_gzip * gz)
gz->where = __LINE__;
return (error);
}
- /*
- * Allocate demand-zeroed area for uninitialized data "bss" = 'block
- * started by symbol' - named after the IBM 7090 instruction of the
- * same name.
- */
- vmaddr = gz->virtual_offset + gz->a_out.a_text + gz->a_out.a_data;
- error = vm_allocate(&vmspace->vm_map, &vmaddr, gz->bss_size, FALSE);
- if (error) {
- gz->where = __LINE__;
- return (error);
+ if (gz->bss_size != 0) {
+ /*
+ * Allocate demand-zeroed area for uninitialized data "bss" = 'block
+ * started by symbol' - named after the IBM 7090 instruction of the
+ * same name.
+ */
+ vmaddr = gz->virtual_offset + gz->a_out.a_text + gz->a_out.a_data;
+ error = vm_map_find(&vmspace->vm_map, NULL, 0, &vmaddr, gz->bss_size, FALSE);
+ if (error) {
+ gz->where = __LINE__;
+ return (error);
+ }
}
/* Fill in process VM information */
vmspace->vm_tsize = gz->a_out.a_text >> PAGE_SHIFT;
@@ -283,8 +285,8 @@ NextByte(void *vp)
return igz->inbuf[(igz->idx++) - igz->offset];
}
if (igz->inbuf) {
- error = vm_deallocate(kernel_map,
- (vm_offset_t) igz->inbuf, PAGE_SIZE);
+ error = vm_map_remove(kernel_map, (vm_offset_t) igz->inbuf,
+ (vm_offset_t) igz->inbuf + PAGE_SIZE);
if (error) {
igz->where = __LINE__;
igz->error = error;
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 8a49935..b882e88 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
- * $Id: init_main.c,v 1.16 1994/11/06 05:01:58 davidg Exp $
+ * $Id: init_main.c,v 1.17 1994/11/25 07:58:16 davidg Exp $
*/
#include <sys/param.h>
@@ -392,7 +392,7 @@ start_init(p, framep)
* Need just enough stack to hold the faked-up "execve()" arguments.
*/
addr = trunc_page(VM_MAXUSER_ADDRESS - PAGE_SIZE);
- if (vm_allocate(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, FALSE) != 0)
+ if (vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &addr, PAGE_SIZE, FALSE) != 0)
panic("init: couldn't allocate argument space");
p->p_vmspace->vm_maxsaddr = (caddr_t)addr;
p->p_vmspace->vm_ssize = 1;
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 94b5dc2..e77db82 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_exec.c,v 1.11 1995/01/09 16:04:49 davidg Exp $
+ * $Id: kern_exec.c,v 1.12 1995/02/14 19:22:28 sos Exp $
*/
#include <sys/param.h>
@@ -98,8 +98,9 @@ execve(p, uap, retval)
* Allocate temporary demand zeroed space for argument and
* environment strings
*/
- error = vm_allocate(exec_map, (vm_offset_t *)&iparams->stringbase,
- ARG_MAX, TRUE);
+ iparams->stringbase = (char *)vm_map_min(exec_map);
+ error = vm_map_find(exec_map, NULL, 0, (vm_offset_t *)&iparams->stringbase,
+ ARG_MAX, TRUE);
if (error) {
log(LOG_WARNING, "execve: failed to allocate string space\n");
return (error);
@@ -128,8 +129,8 @@ interpret:
error = namei(ndp);
if (error) {
- vm_deallocate(exec_map, (vm_offset_t)iparams->stringbase,
- ARG_MAX);
+ vm_map_remove(exec_map, (vm_offset_t)iparams->stringbase,
+ (vm_offset_t)iparams->stringbase + ARG_MAX);
goto exec_fail;
}
@@ -187,8 +188,8 @@ interpret:
/* free old vnode and name buffer */
vput(ndp->ni_vp);
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
- if (vm_deallocate(kernel_map,
- (vm_offset_t)image_header, PAGE_SIZE))
+ if (vm_map_remove(kernel_map, (vm_offset_t)image_header,
+ (vm_offset_t)image_header + PAGE_SIZE))
panic("execve: header dealloc failed (1)");
/* set new name to that of the interpreter */
@@ -302,9 +303,11 @@ interpret:
/*
* free various allocated resources
*/
- if (vm_deallocate(exec_map, (vm_offset_t)iparams->stringbase, ARG_MAX))
+ if (vm_map_remove(exec_map, (vm_offset_t)iparams->stringbase,
+ (vm_offset_t)iparams->stringbase + ARG_MAX))
panic("execve: string buffer dealloc failed (1)");
- if (vm_deallocate(kernel_map, (vm_offset_t)image_header, PAGE_SIZE))
+ if (vm_map_remove(kernel_map, (vm_offset_t)image_header,
+ (vm_offset_t)image_header + PAGE_SIZE))
panic("execve: header dealloc failed (2)");
vput(ndp->ni_vp);
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
@@ -313,12 +316,12 @@ interpret:
exec_fail_dealloc:
if (iparams->stringbase && iparams->stringbase != (char *)-1)
- if (vm_deallocate(exec_map, (vm_offset_t)iparams->stringbase,
- ARG_MAX))
+ if (vm_map_remove(exec_map, (vm_offset_t)iparams->stringbase,
+ (vm_offset_t)iparams->stringbase + ARG_MAX))
panic("execve: string buffer dealloc failed (2)");
if (iparams->image_header && iparams->image_header != (char *)-1)
- if (vm_deallocate(kernel_map,
- (vm_offset_t)iparams->image_header, PAGE_SIZE))
+ if (vm_map_remove(kernel_map, (vm_offset_t)image_header,
+ (vm_offset_t)image_header + PAGE_SIZE))
panic("execve: header dealloc failed (3)");
vput(ndp->ni_vp);
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
@@ -326,9 +329,6 @@ exec_fail_dealloc:
exec_fail:
if (iparams->vmspace_destroyed) {
/* sorry, no more process anymore. exit gracefully */
-#if 0 /* XXX */
- vm_deallocate(&vs->vm_map, USRSTACK - MAXSSIZ, MAXSSIZ);
-#endif
exit1(p, W_EXITCODE(0, SIGABRT));
/* NOT REACHED */
return(0);
@@ -357,11 +357,11 @@ exec_new_vmspace(iparams)
if (vmspace->vm_shm)
shmexit(iparams->proc);
#endif
- vm_deallocate(&vmspace->vm_map, 0, USRSTACK);
+ vm_map_remove(&vmspace->vm_map, 0, USRSTACK);
/* Allocate a new stack */
- error = vm_allocate(&vmspace->vm_map, (vm_offset_t *)&stack_addr,
- SGROWSIZ, FALSE);
+ error = vm_map_find(&vmspace->vm_map, NULL, 0, (vm_offset_t *)&stack_addr,
+ SGROWSIZ, FALSE);
if (error)
return(error);
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index cb1a664..09fe34b 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $Id: sysv_shm.c,v 1.2 1994/09/16 17:43:22 dfr Exp $ */
+/* $Id: sysv_shm.c,v 1.3 1994/10/02 17:35:28 phk Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@@ -127,7 +127,7 @@ shm_deallocate_segment(shmseg)
shm_handle = shmseg->shm_internal;
size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET;
- vm_deallocate(sysvshm_map, shm_handle->kva, size);
+ (void) vm_map_remove(sysvshm_map, shm_handle->kva, shm_handle->kva + size);
free((caddr_t)shm_handle, M_SHM);
shmseg->shm_internal = NULL;
shm_committed -= btoc(size);
@@ -147,7 +147,7 @@ shm_delete_mapping(p, shmmap_s)
segnum = IPCID_TO_IX(shmmap_s->shmid);
shmseg = &shmsegs[segnum];
size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET;
- result = vm_deallocate(&p->p_vmspace->vm_map, shmmap_s->va, size);
+ result = vm_map_remove(&p->p_vmspace->vm_map, shmmap_s->va, shmmap_s->va + size);
if (result != KERN_SUCCESS)
return EINVAL;
shmmap_s->shmid = -1;
OpenPOWER on IntegriCloud