Remove the 'prot' argument from elf_load_psection(). It is not used

outside, and can be declared locally. Clearer.

ok christos@
This commit is contained in:
maxv 2014-03-16 07:57:25 +00:00
parent e2fc5c59a0
commit 7c09916210
1 changed files with 13 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf.c,v 1.63 2014/03/06 09:30:37 matt Exp $ */
/* $NetBSD: exec_elf.c,v 1.64 2014/03/16 07:57:25 maxv Exp $ */
/*-
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.63 2014/03/06 09:30:37 matt Exp $");
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.64 2014/03/16 07:57:25 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@ -103,7 +103,7 @@ elf_load_file(struct lwp *, struct exec_package *, char *,
struct exec_vmcmd_set *, u_long *, Elf_Addr *);
static void
elf_load_psection(struct exec_vmcmd_set *, struct vnode *, const Elf_Phdr *,
Elf_Addr *, u_long *, int *, int);
Elf_Addr *, u_long *, int);
int netbsd_elf_signature(struct lwp *, struct exec_package *, Elf_Ehdr *);
int netbsd_elf_probe(struct lwp *, struct exec_package *, void *, char *,
@ -317,10 +317,11 @@ elf_check_header(Elf_Ehdr *eh)
*/
static void
elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
const Elf_Phdr *ph, Elf_Addr *addr, u_long *size, int *prot, int flags)
const Elf_Phdr *ph, Elf_Addr *addr, u_long *size, int flags)
{
u_long msize, psize, rm, rf;
long diff, offset;
int vmprot = 0;
/*
* If the user specified an address, then we load there.
@ -342,9 +343,9 @@ elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
} else
diff = 0;
*prot |= (ph->p_flags & PF_R) ? VM_PROT_READ : 0;
*prot |= (ph->p_flags & PF_W) ? VM_PROT_WRITE : 0;
*prot |= (ph->p_flags & PF_X) ? VM_PROT_EXECUTE : 0;
vmprot |= (ph->p_flags & PF_R) ? VM_PROT_READ : 0;
vmprot |= (ph->p_flags & PF_W) ? VM_PROT_WRITE : 0;
vmprot |= (ph->p_flags & PF_X) ? VM_PROT_EXECUTE : 0;
/*
* Adjust everything so it all starts on a page boundary.
@ -372,12 +373,12 @@ elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
if (psize > 0) {
NEW_VMCMD2(vcset, ph->p_align < PAGE_SIZE ?
vmcmd_map_readvn : vmcmd_map_pagedvn, psize, *addr, vp,
offset, *prot, flags);
offset, vmprot, flags);
flags &= VMCMD_RELATIVE;
}
if (psize < *size) {
NEW_VMCMD2(vcset, vmcmd_map_readvn, *size - psize,
*addr + psize, vp, offset + psize, *prot, flags);
*addr + psize, vp, offset + psize, vmprot, flags);
}
/*
@ -389,7 +390,7 @@ elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
if (rm != rf) {
NEW_VMCMD2(vcset, vmcmd_map_zero, rm - rf, rf, NULLVP,
0, *prot, flags & VMCMD_RELATIVE);
0, vmprot, flags & VMCMD_RELATIVE);
*size = msize;
}
}
@ -556,7 +557,6 @@ elf_load_file(struct lwp *l, struct exec_package *epp, char *path,
switch (ph[i].p_type) {
case PT_LOAD: {
u_long size;
int prot = 0;
int flags;
if (base_ph == NULL) {
@ -596,7 +596,7 @@ elf_load_file(struct lwp *l, struct exec_package *epp, char *path,
}
last_ph = &ph[i];
elf_load_psection(vcset, vp, &ph[i], &addr,
&size, &prot, flags);
&size, flags);
/*
* If entry is within this psection then this
* must contain the .text section. *entryoff is
@ -749,12 +749,11 @@ exec_elf_makecmds(struct lwp *l, struct exec_package *epp)
for (i = 0; i < eh->e_phnum; i++) {
Elf_Addr addr = ELFDEFNNAME(NO_ADDR);
u_long size = 0;
int prot = 0;
switch (ph[i].p_type) {
case PT_LOAD:
elf_load_psection(&epp->ep_vmcmds, epp->ep_vp,
&ph[i], &addr, &size, &prot, VMCMD_FIXED);
&ph[i], &addr, &size, VMCMD_FIXED);
/*
* Consider this as text segment, if it is executable.