In load_shared_file, do zero-fill uninitialized data segments that

explicitely request to be zero filled.
This commit is contained in:
manu 2002-12-05 22:48:53 +00:00
parent 675b5ba3f5
commit f0332ec923
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: darwin_mman.c,v 1.2 2002/11/17 16:51:13 manu Exp $ */
/* $NetBSD: darwin_mman.c,v 1.3 2002/12/05 22:48:54 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -104,7 +104,7 @@ darwin_sys_load_shared_file(p, v, retval)
if ((error = copyin(SCARG(uap, flags), &flags, sizeof(base))) != 0)
return error;
DPRINTF(("mach_sys_load_shared_file: filename = %p ",
DPRINTF(("darwin_sys_load_shared_file: filename = %p ",
SCARG(uap, filename)));
DPRINTF(("addr = %p len = 0x%08lx base = %p ",
SCARG(uap, addr), SCARG(uap, len), SCARG(uap, base)));
@ -201,7 +201,10 @@ darwin_sys_load_shared_file(p, v, retval)
evc.ev_len = mapp[i].size;
evc.ev_prot = mapp[i].protection & VM_PROT_ALL;
evc.ev_flags = 0;
evc.ev_proc = vmcmd_map_readvn;
if (mapp[i].protection & MACH_VM_PROT_ZF)
evc.ev_proc = vmcmd_map_zero;
else
evc.ev_proc = vmcmd_map_readvn;
evc.ev_offset = mapp[i].file_offset;
evc.ev_vp = vp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_vm.h,v 1.6 2002/12/04 22:55:11 manu Exp $ */
/* $NetBSD: mach_vm.h,v 1.7 2002/12/05 22:48:53 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -52,6 +52,9 @@
#define MACH_SF_PREV_LOADED 1
#define MACH_SYSTEM_REGION_BACKED 2
#define MACH_VM_PROT_COW 0x8
#define MACH_VM_PROT_ZF 0x10
typedef struct mach_sf_mapping {
mach_vm_offset_t mapping_offset;
mach_vm_size_t size;