Index: conf/files =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/conf/files,v retrieving revision 1.27 diff -u -u -r1.27 files --- conf/files 14 Nov 2003 01:53:54 -0000 1.27 +++ conf/files 14 Nov 2003 04:24:43 -0000 @@ -1592,3 +1592,4 @@ emulation/43bsd/43bsd_exit.c optional compat_43 emulation/43bsd/43bsd_resource.c optional compat_43 emulation/43bsd/43bsd_hostinfo.c optional compat_43 +emulation/43bsd/43bsd_vm.c optional compat_43 Index: emulation/43bsd/43bsd_vm.c =================================================================== RCS file: emulation/43bsd/43bsd_vm.c diff -N emulation/43bsd/43bsd_vm.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ emulation/43bsd/43bsd_vm.c 14 Nov 2003 04:45:01 -0000 @@ -0,0 +1,106 @@ +/* + * 43BSD_VM.C - 4.3BSD compatibility virtual memory syscalls + * + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly$ + * from: DragonFly vm/vm_unix.c,v 1.3 + * from: DragonFly vm/vm_mmap.c,v 1.15 + */ + +#include "opt_compat.h" + +#include +#include +#include +#include + +int +ovadvise(struct ovadvise_args *uap) +{ + return (EINVAL); +} + +int +ogetpagesize(struct getpagesize_args *uap) +{ + uap->sysmsg_result = PAGE_SIZE; + return (0); +} + +int +ommap(struct ommap_args *uap) +{ + static const char cvtbsdprot[8] = { + 0, + PROT_EXEC, + PROT_WRITE, + PROT_EXEC | PROT_WRITE, + PROT_READ, + PROT_EXEC | PROT_READ, + PROT_WRITE | PROT_READ, + PROT_EXEC | PROT_WRITE | PROT_READ, + }; + int error, flags, prot; + +#define OMAP_ANON 0x0002 +#define OMAP_COPY 0x0020 +#define OMAP_SHARED 0x0010 +#define OMAP_FIXED 0x0100 +#define OMAP_INHERIT 0x0800 + + prot = cvtbsdprot[uap->prot & 0x7]; + flags = 0; + if (uap->flags & OMAP_ANON) + flags |= MAP_ANON; + if (uap->flags & OMAP_COPY) + flags |= MAP_COPY; + if (uap->flags & OMAP_SHARED) + flags |= MAP_SHARED; + else + flags |= MAP_PRIVATE; + if (uap->flags & OMAP_FIXED) + flags |= MAP_FIXED; + if (uap->flags & OMAP_INHERIT) + flags |= MAP_INHERIT; + + prot = cvtbsdprot[uap->prot]; + error = kern_mmap(uap->addr, uap->len, prot, flags, uap->fd, uap->pos, + &uap->sysmsg_resultp); + + return (error); +} Index: sys/kern_syscall.h =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/sys/kern_syscall.h,v retrieving revision 1.13 diff -u -u -r1.13 kern_syscall.h --- sys/kern_syscall.h 13 Nov 2003 04:04:42 -0000 1.13 +++ sys/kern_syscall.h 14 Nov 2003 10:12:08 -0000 @@ -140,4 +140,10 @@ int kern_unlink(struct nameidata *nd); int kern_utimes(struct nameidata *nd, struct timeval *tptr); +/* + * Prototypes for syscalls in vm/vm_mmap.c + */ +int kern_mmap(caddr_t addr, size_t len, int prot, int flags, int fd, + off_t pos, void **res); + #endif /* !_SYS_KERN_SYSCALL_H_ */ Index: vm/vm_mmap.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/vm/vm_mmap.c,v retrieving revision 1.15 diff -u -u -r1.15 vm_mmap.c --- vm/vm_mmap.c 19 Oct 2003 00:23:30 -0000 1.15 +++ vm/vm_mmap.c 14 Nov 2003 10:12:24 -0000 @@ -46,13 +46,12 @@ * Mapped file (mmap) interface to VM */ -#include "opt_compat.h" - #include #include #include #include #include +#include #include #include #include @@ -123,21 +122,6 @@ return (EOPNOTSUPP); } -#if defined(COMPAT_43) || defined(COMPAT_SUNOS) - -/* - * getpagesize_args(int dummy) - */ -/* ARGSUSED */ -int -ogetpagesize(struct getpagesize_args *uap) -{ - uap->sysmsg_result = PAGE_SIZE; - return (0); -} -#endif /* COMPAT_43 || COMPAT_SUNOS */ - - /* * mmap_args(void *addr, size_t len, int prot, int flags, int fd, * long pad, off_t pos) @@ -160,7 +144,8 @@ */ int -mmap(struct mmap_args *uap) +kern_mmap(caddr_t uaddr, size_t ulen, int uprot, int uflags, int fd, + off_t upos, void **res) { struct thread *td = curthread; struct proc *p = td->td_proc; @@ -179,19 +164,19 @@ KKASSERT(p); - addr = (vm_offset_t) uap->addr; - size = uap->len; - prot = uap->prot & VM_PROT_ALL; - flags = uap->flags; - pos = uap->pos; + addr = (vm_offset_t) uaddr; + size = ulen; + prot = uprot & VM_PROT_ALL; + flags = uflags; + pos = upos; /* make sure mapping fits into numeric range etc */ - if ((ssize_t) uap->len < 0 || - ((flags & MAP_ANON) && uap->fd != -1)) + if ((ssize_t) ulen < 0 || + ((flags & MAP_ANON) && fd != -1)) return (EINVAL); if (flags & MAP_STACK) { - if ((uap->fd != -1) || + if ((fd != -1) || ((prot & (PROT_READ | PROT_WRITE)) != (PROT_READ | PROT_WRITE))) return (EINVAL); flags |= MAP_ANON; @@ -257,8 +242,8 @@ * Mapping file, get fp for validation. Obtain vnode and make * sure it is of appropriate type. */ - if (((unsigned) uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if (((unsigned) fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[fd]) == NULL) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (EINVAL); @@ -385,60 +370,23 @@ error = vm_mmap(&vms->vm_map, &addr, size, prot, maxprot, flags, handle, pos); if (error == 0) - uap->sysmsg_resultp = (void *)(addr + pageoff); + *res = (void *)(addr + pageoff); done: if (fp) fdrop(fp, td); return (error); } -#ifdef COMPAT_43 -/* - * ommap_args(caddr_t addr, int len, int prot, int flags, int fd, long pos) - */ int -ommap(struct ommap_args *uap) +mmap(struct mmap_args *uap) { - struct mmap_args nargs; - static const char cvtbsdprot[8] = { - 0, - PROT_EXEC, - PROT_WRITE, - PROT_EXEC | PROT_WRITE, - PROT_READ, - PROT_EXEC | PROT_READ, - PROT_WRITE | PROT_READ, - PROT_EXEC | PROT_WRITE | PROT_READ, - }; - -#define OMAP_ANON 0x0002 -#define OMAP_COPY 0x0020 -#define OMAP_SHARED 0x0010 -#define OMAP_FIXED 0x0100 -#define OMAP_INHERIT 0x0800 - - nargs.addr = uap->addr; - nargs.len = uap->len; - nargs.prot = cvtbsdprot[uap->prot & 0x7]; - nargs.flags = 0; - if (uap->flags & OMAP_ANON) - nargs.flags |= MAP_ANON; - if (uap->flags & OMAP_COPY) - nargs.flags |= MAP_COPY; - if (uap->flags & OMAP_SHARED) - nargs.flags |= MAP_SHARED; - else - nargs.flags |= MAP_PRIVATE; - if (uap->flags & OMAP_FIXED) - nargs.flags |= MAP_FIXED; - if (uap->flags & OMAP_INHERIT) - nargs.flags |= MAP_INHERIT; - nargs.fd = uap->fd; - nargs.pos = uap->pos; - return (mmap(&nargs)); -} -#endif /* COMPAT_43 */ + int error; + + error = kern_mmap(uap->addr, uap->len, uap->prot, uap->flags, + uap->fd, uap->pos, &uap->sysmsg_resultp); + return (error); +} /* * msync_args(void *addr, int len, int flags) Index: vm/vm_unix.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/vm/vm_unix.c,v retrieving revision 1.3 diff -u -u -r1.3 vm_unix.c --- vm/vm_unix.c 23 Jun 2003 17:55:51 -0000 1.3 +++ vm/vm_unix.c 14 Nov 2003 04:09:41 -0000 @@ -111,13 +111,3 @@ } return (0); } - -/* - * ovadvise_args(int anom) - */ -/* ARGSUSED */ -int -ovadvise(struct ovadvise_args *uap) -{ - return (EINVAL); -}