Removed a hack to make PowerPC mmap work. This could have side effects on

alpha and i386. It has been tested and works on i386.
This commit is contained in:
manu 2001-09-08 07:09:43 +00:00
parent ef3e53a669
commit 6bbacb9d3f
11 changed files with 40 additions and 142 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscalls.c,v 1.40 2001/07/04 10:26:28 jdolecek Exp $ */
/* $NetBSD: linux_syscalls.c,v 1.41 2001/09/08 07:09:43 manu Exp $ */
/*
* System call names.

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.35 2001/07/04 10:25:32 jdolecek Exp $
$NetBSD: syscalls.master,v 1.36 2001/09/08 07:09:43 manu Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -173,7 +173,7 @@
70 UNIMPL
;71 ALIAS osf1_sys_mmap
71 NOARGS { int linux_sys_mmap(unsigned long addr, size_t len, \
int prot, int flags, int fd, off_t offset); }
int prot, int flags, int fd, linux_off_t offset); }
72 UNIMPL
73 NOARGS { int sys_munmap(void *addr, size_t len); }
74 NOARGS { int sys_mprotect(void *addr, size_t len, int prot); }

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_mmap.h,v 1.2 2001/01/19 01:31:25 manu Exp $ */
/* $NetBSD: linux_mmap.h,v 1.3 2001/09/08 07:09:43 manu Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -56,20 +56,4 @@
#define LINUX_MAP_DENYWRITE 0x0800
#define LINUX_MAP_EXECUTABLE 0x1000
/*
* On the PowerPC, we have a problem with the offset argument. It's 32 bit
* long on Linux and 64 bit long on NetBSD. Therefore we use a wrapper
* function linux_sys_powerpc_mmap() to linux_sys_mmap()
*
* Linux's off_t is __kernel_off_t (include/linux/types.h) which in turn
* is a long (include/asm-ppc/posix_types.h)
*/
#define linux_off_t long
#ifdef _KERNEL
__BEGIN_DECLS
int linux_sys_powerpc_mmap(struct proc *, void *, register_t *);
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_POWERPC_LINUX_MMAP_H */

View File

@ -1,79 +0,0 @@
/* $NetBSD: linux_mmap_powerpc.c,v 1.1 2001/01/19 01:36:51 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/cdefs.h>
#include <compat/linux/arch/powerpc/linux_types.h>
#include <compat/linux/arch/powerpc/linux_signal.h>
#include <compat/linux/arch/powerpc/linux_syscallargs.h>
#include <compat/linux/common/linux_mmap.h>
/*
* This wraps linux_sys_powerpc_mmap() to linux_sys_mmap(). We do this
* because the offset agrument has no the same length (see linux_mmap.h)
*
* XXX This should die. We should use a linux_off_t in the
* common linux_sys_mmap() function
*/
int linux_sys_powerpc_mmap(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct linux_sys_powerpc_mmap_args /* {
syscallarg(unsigned long) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(linux_off_t) offset;
} */ *uap = v;
struct linux_sys_mmap_args cma;
SCARG(&cma,addr) = SCARG(uap, addr);
SCARG(&cma,len) = SCARG(uap, len);
SCARG(&cma,prot) = SCARG(uap, prot);
SCARG(&cma,flags) = SCARG(uap, flags);
SCARG(&cma,fd) = SCARG(uap, fd);
SCARG(&cma,offset) = (off_t) SCARG(uap, offset);
return linux_sys_mmap(p, &cma, retval);
}

View File

@ -1,10 +1,10 @@
/* $NetBSD: linux_syscall.h,v 1.9 2001/05/30 11:37:27 mrg Exp $ */
/* $NetBSD: linux_syscall.h,v 1.10 2001/09/08 07:09:44 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.5 2001/05/13 20:54:45 manu Exp
* created from NetBSD: syscalls.master,v 1.6 2001/05/30 11:37:27 mrg Exp
*/
/* syscall: "syscall" ret: "int" args: */
@ -246,8 +246,8 @@
/* syscall: "readdir" ret: "int" args: "int" "caddr_t" "unsigned int" */
#define LINUX_SYS_readdir 89
/* syscall: "powerpc_mmap" ret: "int" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */
#define LINUX_SYS_powerpc_mmap 90
/* syscall: "mmap" ret: "int" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */
#define LINUX_SYS_mmap 90
/* syscall: "munmap" ret: "int" args: "caddr_t" "int" */
#define LINUX_SYS_munmap 91

View File

@ -1,10 +1,10 @@
/* $NetBSD: linux_syscallargs.h,v 1.9 2001/05/30 11:37:27 mrg Exp $ */
/* $NetBSD: linux_syscallargs.h,v 1.10 2001/09/08 07:09:44 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.5 2001/05/13 20:54:45 manu Exp
* created from NetBSD: syscalls.master,v 1.6 2001/05/30 11:37:27 mrg Exp
*/
#ifndef _LINUX_SYS__SYSCALLARGS_H_
@ -234,15 +234,6 @@ struct linux_sys_readdir_args {
syscallarg(unsigned int) count;
};
struct linux_sys_powerpc_mmap_args {
syscallarg(unsigned long) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(linux_off_t) offset;
};
struct linux_sys_truncate_args {
syscallarg(const char *) path;
syscallarg(long) length;
@ -581,7 +572,7 @@ int linux_sys_uselib(struct proc *, void *, register_t *);
int linux_sys_swapon(struct proc *, void *, register_t *);
int linux_sys_reboot(struct proc *, void *, register_t *);
int linux_sys_readdir(struct proc *, void *, register_t *);
int linux_sys_powerpc_mmap(struct proc *, void *, register_t *);
int linux_sys_mmap(struct proc *, void *, register_t *);
int sys_munmap(struct proc *, void *, register_t *);
int linux_sys_truncate(struct proc *, void *, register_t *);
int compat_43_sys_ftruncate(struct proc *, void *, register_t *);

View File

@ -1,10 +1,10 @@
/* $NetBSD: linux_syscalls.c,v 1.9 2001/05/30 11:37:27 mrg Exp $ */
/* $NetBSD: linux_syscalls.c,v 1.10 2001/09/08 07:09:44 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.5 2001/05/13 20:54:45 manu Exp
* created from NetBSD: syscalls.master,v 1.6 2001/05/30 11:37:27 mrg Exp
*/
#if defined(_KERNEL_OPT)
@ -117,7 +117,7 @@ const char *const linux_syscallnames[] = {
"swapon", /* 87 = swapon */
"reboot", /* 88 = reboot */
"readdir", /* 89 = readdir */
"powerpc_mmap", /* 90 = powerpc_mmap */
"mmap", /* 90 = mmap */
"munmap", /* 91 = munmap */
"truncate", /* 92 = truncate */
"ftruncate", /* 93 = ftruncate */

View File

@ -1,10 +1,10 @@
/* $NetBSD: linux_sysent.c,v 1.9 2001/05/30 11:37:27 mrg Exp $ */
/* $NetBSD: linux_sysent.c,v 1.10 2001/09/08 07:09:44 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.5 2001/05/13 20:54:45 manu Exp
* created from NetBSD: syscalls.master,v 1.6 2001/05/30 11:37:27 mrg Exp
*/
#if defined(_KERNEL_OPT)
@ -207,8 +207,8 @@ struct sysent linux_sysent[] = {
linux_sys_reboot }, /* 88 = reboot */
{ 3, s(struct linux_sys_readdir_args), 0,
linux_sys_readdir }, /* 89 = readdir */
{ 6, s(struct linux_sys_powerpc_mmap_args), 0,
linux_sys_powerpc_mmap }, /* 90 = powerpc_mmap */
{ 6, s(struct linux_sys_mmap_args), 0,
linux_sys_mmap }, /* 90 = mmap */
{ 2, s(struct sys_munmap_args), 0,
sys_munmap }, /* 91 = munmap */
{ 2, s(struct linux_sys_truncate_args), 0,

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.6 2001/05/30 11:37:27 mrg Exp $
$NetBSD: syscalls.master,v 1.7 2001/09/08 07:09:44 manu Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -93,7 +93,8 @@
7 STD { int linux_sys_waitpid(int pid, int *status, \
int options);}
8 STD { int linux_sys_creat(const char *path, int mode); }
9 STD { int linux_sys_link(const char *path, const char *link); }
9 STD { int linux_sys_link(const char *path, const \
char *link); }
10 STD { int linux_sys_unlink(const char *path); }
11 STD { int linux_sys_execve(const char *path, char **argp, \
char **envp); }
@ -115,7 +116,7 @@
24 NOARGS { uid_t sys_getuid(void); }
25 STD { int linux_sys_stime(linux_time_t *t); }
26 STD { int linux_sys_ptrace(int request, int pid, \
int addr, int data); }
int addr, int data); }
27 STD { int linux_sys_alarm(unsigned int secs); }
28 OBSOL ofstat
29 STD { int linux_sys_pause(void); }
@ -152,7 +153,8 @@
56 OBSOL mpx
57 NOARGS { int sys_setpgid(int pid, int pgid); }
58 OBSOL ulimit
59 STD { int linux_sys_olduname(struct linux_old_utsname *up); }
59 STD { int linux_sys_olduname(struct linux_old_utsname \
*up); }
60 NOARGS { int sys_umask(int newmask); }
61 NOARGS { int sys_chroot(char *path); }
62 UNIMPL ustat
@ -198,14 +200,14 @@
int cmd, void *arg); }
89 STD { int linux_sys_readdir(int fd, caddr_t dent, \
unsigned int count); }
90 STD { int linux_sys_powerpc_mmap(unsigned long addr, size_t len, \
int prot, int flags, int fd, linux_off_t offset); }
90 NOARGS { int linux_sys_mmap(unsigned long addr, size_t len, \
int prot, int flags, int fd, linux_off_t offset); }
91 NOARGS { int sys_munmap(caddr_t addr, int len); }
92 STD { int linux_sys_truncate(const char *path, \
long length); }
93 NOARGS { int compat_43_sys_ftruncate(int fd, long length); }
94 NOARGS { int sys_fchmod(int fd, int mode); }
95 NOARGS { int sys___posix_fchown(int fd, int uid, int gid); }
95 NOARGS { int sys___posix_fchown(int fd, int uid, int gid); }
96 NOARGS { int sys_getpriority(int which, int who); }
97 NOARGS { int sys_setpriority(int which, int who, int prio); }
98 NOARGS { int sys_profil(caddr_t samples, u_int size, \
@ -214,8 +216,8 @@
struct linux_statfs *sp); }
100 STD { int linux_sys_fstatfs(int fd, \
struct linux_statfs *sp); }
101 STD { int linux_sys_ioperm(unsigned int lo, \
unsigned int hi, int val); }
101 STD { int linux_sys_ioperm(unsigned int lo, \
unsigned int hi, int val); }
102 STD { int linux_sys_socketcall(int what, void *args); }
103 UNIMPL syslog
104 NOARGS { int sys_setitimer(u_int which, \
@ -234,17 +236,17 @@
113 UNIMPL vm86old
114 STD { int linux_sys_wait4(int pid, int *status, \
int options, struct rusage *rusage); }
115 STD { int linux_sys_swapoff(const char *path); }
116 STD { int linux_sys_sysinfo(struct linux_sysinfo *arg); }
115 STD { int linux_sys_swapoff(const char *path); }
116 STD { int linux_sys_sysinfo(struct linux_sysinfo *arg); }
117 STD { int linux_sys_ipc(int what, int a1, int a2, int a3, \
caddr_t ptr); }
118 NOARGS { int sys_fsync(int fd); }
119 STD { int linux_sys_sigreturn(struct linux_sigcontext *scp); }
120 STD { int linux_sys_clone(int flags, void *stack); }
121 STD { int linux_sys_setdomainname(char *domainname, \
int len); }
int len); }
122 STD { int linux_sys_new_uname(struct linux_utsname *up); }
123 UNIMPL modify_ldt
123 UNIMPL modify_ldt
124 UNIMPL adjtimex
125 NOARGS { int sys_mprotect(caddr_t addr, int len, int prot); }
126 STD { int linux_sys_sigprocmask(int how, \
@ -267,7 +269,7 @@
u_int32_t olow, caddr_t res, int whence); }
141 STD { int linux_sys_getdents(int fd, \
struct linux_dirent *dent, unsigned int count); }
142 STD { int linux_sys_new_select(int nfds, fd_set *readfds, \
142 STD { int linux_sys_new_select(int nfds, fd_set *readfds, \
fd_set *writefds, fd_set *exceptfds, \
struct timeval *timeout); }
143 NOARGS { int sys_flock(int fd, int how); }
@ -312,7 +314,7 @@
gid_t *sgid); }
171 UNIMPL prctl
172 STD { int linux_sys_rt_sigreturn( \
struct linux_rt_sigframe *sfp); }
struct linux_rt_sigframe *sfp); }
173 STD { int linux_sys_rt_sigaction(int signum, \
const struct linux_sigaction *nsa, \
struct linux_sigaction *osa, \

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.93 2001/07/18 19:11:14 thorpej Exp $ */
/* $NetBSD: linux_misc.c,v 1.94 2001/09/08 07:09:44 manu Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@ -391,7 +391,7 @@ linux_sys_mmap(p, v, retval)
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(off_t) offset;
syscallarg(linux_off_t) offset;
} */ *uap = v;
struct sys_mmap_args cma;
int flags;
@ -411,7 +411,7 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = flags & MAP_ANON ? -1 : SCARG(uap, fd);
SCARG(&cma,pad) = 0;
SCARG(&cma,pos) = SCARG(uap, offset);
SCARG(&cma,pos) = (off_t)SCARG(uap, offset);
return sys_mmap(p, &cma, retval);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_mmap.h,v 1.8 2001/01/19 12:35:47 manu Exp $ */
/* $NetBSD: linux_mmap.h,v 1.9 2001/09/08 07:09:44 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -82,7 +82,7 @@ struct linux_sys_mmap_args {
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(off_t) offset;
syscallarg(linux_off_t) offset;
};
#ifdef _KERNEL