summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2003-05-09 00:48:43 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2003-05-09 00:48:43 +0000
commit1567d4b3ec1b725c0bd3817596aef986a91e4296 (patch)
treeed77f430507c40b41e756c458dd150be28e3154b
parent9fdb7d5897cc8e842c7d04270630f6793754e300 (diff)
vmcmd_map_readvn - don't map the initial mapping with X unless the
final protection has an X. Doesn't really change anything except reducing I$ flushing. niklas@ ok
-rw-r--r--sys/kern/exec_subr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index 7b0ba7b6da6..d31c7b128e5 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.24 2002/12/19 00:57:07 mickey Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.25 2003/05/09 00:48:42 art Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -228,20 +228,22 @@ vmcmd_map_pagedvn(p, cmd)
* appropriate for non-demand-paged text/data segments, i.e. impure
* objects (a la OMAGIC and NMAGIC).
*/
+
int
-vmcmd_map_readvn(p, cmd)
- struct proc *p;
- struct exec_vmcmd *cmd;
+vmcmd_map_readvn(struct proc *p, struct exec_vmcmd *cmd)
{
int error;
+ vm_prot_t prot;
if (cmd->ev_len == 0)
return (0);
-
+
+ prot = cmd->ev_prot;
+
cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
+ UVM_MAPFLAG(prot | UVM_PROT_WRITE, UVM_PROT_ALL, UVM_INH_COPY,
UVM_ADV_NORMAL,
UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
@@ -264,7 +266,7 @@ vmcmd_map_readvn(p, cmd)
return (uvm_map_protect(&p->p_vmspace->vm_map,
trunc_page(cmd->ev_addr),
round_page(cmd->ev_addr + cmd->ev_len),
- cmd->ev_prot, FALSE));
+ prot, FALSE));
}
return (0);
}