Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/compat/pecoff Pull up revision 1.8 (requested by oki):
details: https://anonhg.NetBSD.org/src/rev/ac8ea39e0548
branches: netbsd-1-5
changeset: 490592:ac8ea39e0548
user: he <he%NetBSD.org@localhost>
date: Sat Feb 03 20:01:50 2001 +0000
description:
Pull up revision 1.8 (requested by oki):
Add support to mmap .bss section, using vmcmd_map_pagedvn if
possible.
diffstat:
sys/compat/pecoff/pecoff_exec.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diffs (67 lines):
diff -r 3b420b0abce9 -r ac8ea39e0548 sys/compat/pecoff/pecoff_exec.c
--- a/sys/compat/pecoff/pecoff_exec.c Sat Feb 03 20:00:02 2001 +0000
+++ b/sys/compat/pecoff/pecoff_exec.c Sat Feb 03 20:01:50 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pecoff_exec.c,v 1.2 2000/06/15 15:37:05 oki Exp $ */
+/* $NetBSD: pecoff_exec.c,v 1.2.2.1 2001/02/03 20:01:50 he Exp $ */
/*
* Copyright (c) 2000 Masaru OKI
@@ -303,17 +303,20 @@
*addr = COFF_ALIGN(sh->s_vaddr);
diff = (sh->s_vaddr - *addr);
offset = sh->s_scnptr - diff;
- *size = sh->s_size + diff;
+ *size = COFF_ROUND(sh->s_size + diff, COFF_LDPGSZ);
*prot |= (sh->s_flags & COFF_STYP_EXEC) ? VM_PROT_EXECUTE : 0;
*prot |= (sh->s_flags & COFF_STYP_READ) ? VM_PROT_READ : 0;
*prot |= (sh->s_flags & COFF_STYP_WRITE) ? VM_PROT_WRITE : 0;
- if ((sh->s_flags & COFF_STYP_BSS) == 0) {
- NEW_VMCMD(vcset, vmcmd_map_readvn, *size, *addr, vp,
- offset, *prot);
- }
- if (sh->s_size < sh->s_paddr) {
+ if (diff == 0 && offset == COFF_ALIGN(offset))
+ NEW_VMCMD(vcset, vmcmd_map_pagedvn, *size, *addr, vp,
+ offset, *prot);
+ else
+ NEW_VMCMD(vcset, vmcmd_map_readvn, sh->s_size, sh->s_vaddr, vp,
+ sh->s_scnptr, *prot);
+
+ if (*size < sh->s_paddr) {
u_long baddr, bsize;
baddr = *addr + COFF_ROUND(*size, COFF_LDPGSZ);
@@ -458,7 +461,7 @@
{
int error, i;
struct pecoff_opthdr *wp;
- long daddr, dsize; /*baddr, bsize;*/
+ long daddr, dsize, baddr, bsize;
struct coff_scnhdr *sh;
struct pecoff_args *argp;
int scnsiz = sizeof(struct coff_scnhdr) * fp->f_nscns;
@@ -503,16 +506,17 @@
dsize = daddr + dsize - epp->ep_daddr;
epp->ep_dsize = max(epp->ep_dsize, dsize);
}
-#if 0 /* no need? */
if ((sh[i].s_flags & COFF_STYP_BSS) != 0) {
/* set up command for bss segment */
- baddr = round_page(epp->ep_daddr + dsize);
- bsize = epp->ep_daddr + epp->ep_dsize - baddr;
+ baddr = sh[i].s_vaddr;
+ bsize = sh[i].s_paddr;
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
bsize, baddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+ epp->ep_daddr = min(epp->ep_daddr, baddr);
+ bsize = baddr + bsize - epp->ep_daddr;
+ epp->ep_dsize = max(epp->ep_dsize, bsize);
}
-#endif
}
/* set up ep_emul_arg */
argp = malloc(sizeof(struct pecoff_args), M_TEMP, M_WAITOK);
Home |
Main Index |
Thread Index |
Old Index