summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/linux/syscalls.master5
-rw-r--r--sys/compat/linux/linux_misc.c33
-rw-r--r--sys/i386/linux/linux_misc.c33
-rw-r--r--sys/i386/linux/linux_proto.h7
-rw-r--r--sys/i386/linux/linux_syscall.h1
-rw-r--r--sys/i386/linux/linux_sysent.c2
-rw-r--r--sys/i386/linux/syscalls.master5
7 files changed, 79 insertions, 7 deletions
diff --git a/sys/alpha/linux/syscalls.master b/sys/alpha/linux/syscalls.master
index 6da4c37..912cb32 100644
--- a/sys/alpha/linux/syscalls.master
+++ b/sys/alpha/linux/syscalls.master
@@ -1,4 +1,4 @@
- $Id: syscalls.master,v 1.10 1998/03/29 07:59:10 peter Exp $
+ $Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@@ -233,7 +233,8 @@
162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp); }
-163 UNIMPL LINUX mremap
+163 STD LINUX { int linux_mremap(caddr_t addr, int old_len, \
+ int new_len, int flags); }
164 UNIMPL LINUX setresuid
165 UNIMPL LINUX getresuid
166 UNIMPL LINUX new_vm86
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 7ae04c3..a3ca05d 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_misc.c,v 1.37 1998/04/06 08:26:01 phk Exp $
+ * $Id: linux_misc.c,v 1.38 1998/05/17 11:52:26 phk Exp $
*/
#include <sys/param.h>
@@ -615,6 +615,37 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
return mmap(p, &bsd_args);
}
+int
+linux_mremap(struct proc *p, struct linux_mremap_args *args)
+{
+ struct munmap_args /* {
+ void *addr;
+ size_t len;
+ } */ bsd_args;
+ int error = 0;
+
+#ifdef DEBUG
+ printf("Linux-emul(%d): mremap(%08x, %08x, %08x, %08x)\n",
+ p->p_pid, args->addr, args->old_len, args->new_len, args->flags);
+#endif
+ args->new_len = round_page(args->new_len);
+ args->old_len = round_page(args->old_len);
+
+ if (args->new_len > args->old_len) {
+ p->p_retval[0] = 0;
+ return ENOMEM;
+ }
+
+ if (args->new_len < args->old_len) {
+ bsd_args.addr = args->addr + args->new_len;
+ bsd_args.len = args->old_len - args->new_len;
+ error = munmap(p, &bsd_args);
+ }
+
+ p->p_retval[0] = error ? 0 : (int)args->addr;
+ return error;
+}
+
int
linux_msync(struct proc *p, struct linux_msync_args *args)
{
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c
index 7ae04c3..a3ca05d 100644
--- a/sys/i386/linux/linux_misc.c
+++ b/sys/i386/linux/linux_misc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_misc.c,v 1.37 1998/04/06 08:26:01 phk Exp $
+ * $Id: linux_misc.c,v 1.38 1998/05/17 11:52:26 phk Exp $
*/
#include <sys/param.h>
@@ -615,6 +615,37 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
return mmap(p, &bsd_args);
}
+int
+linux_mremap(struct proc *p, struct linux_mremap_args *args)
+{
+ struct munmap_args /* {
+ void *addr;
+ size_t len;
+ } */ bsd_args;
+ int error = 0;
+
+#ifdef DEBUG
+ printf("Linux-emul(%d): mremap(%08x, %08x, %08x, %08x)\n",
+ p->p_pid, args->addr, args->old_len, args->new_len, args->flags);
+#endif
+ args->new_len = round_page(args->new_len);
+ args->old_len = round_page(args->old_len);
+
+ if (args->new_len > args->old_len) {
+ p->p_retval[0] = 0;
+ return ENOMEM;
+ }
+
+ if (args->new_len < args->old_len) {
+ bsd_args.addr = args->addr + args->new_len;
+ bsd_args.len = args->old_len - args->new_len;
+ error = munmap(p, &bsd_args);
+ }
+
+ p->p_retval[0] = error ? 0 : (int)args->addr;
+ return error;
+}
+
int
linux_msync(struct proc *p, struct linux_msync_args *args)
{
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index f21b206..eedb566 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -367,6 +367,12 @@ struct linux_msync_args {
int len; char len_[PAD_(int)];
int fl; char fl_[PAD_(int)];
};
+struct linux_mremap_args {
+ caddr_t addr; char addr_[PAD_(caddr_t)];
+ int old_len; char old_len_[PAD_(int)];
+ int new_len; char new_len_[PAD_(int)];
+ int flags; char flags_[PAD_(int)];
+};
struct linux_chown_args {
char * path; char path_[PAD_(char *)];
int uid; char uid_[PAD_(int)];
@@ -466,6 +472,7 @@ int linux_llseek __P((struct proc *, struct linux_llseek_args *));
int linux_getdents __P((struct proc *, struct linux_getdents_args *));
int linux_newselect __P((struct proc *, struct linux_newselect_args *));
int linux_msync __P((struct proc *, struct linux_msync_args *));
+int linux_mremap __P((struct proc *, struct linux_mremap_args *));
int linux_chown __P((struct proc *, struct linux_chown_args *));
#ifdef COMPAT_43
diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h
index 7c8ef6d..c0b7147 100644
--- a/sys/i386/linux/linux_syscall.h
+++ b/sys/i386/linux/linux_syscall.h
@@ -161,5 +161,6 @@
#define LINUX_SYS_sched_get_priority_min 160
#define LINUX_SYS_sched_rr_get_interval 161
#define LINUX_SYS_nanosleep 162
+#define LINUX_SYS_linux_mremap 163
#define LINUX_SYS_linux_chown 182
#define LINUX_SYS_MAXSYSCALL 183
diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c
index 3768f57..da9ac24 100644
--- a/sys/i386/linux/linux_sysent.c
+++ b/sys/i386/linux/linux_sysent.c
@@ -177,7 +177,7 @@ struct sysent linux_sysent[] = {
{ 1, (sy_call_t *)sched_get_priority_min }, /* 160 = sched_get_priority_min */
{ 2, (sy_call_t *)sched_rr_get_interval }, /* 161 = sched_rr_get_interval */
{ 2, (sy_call_t *)nanosleep }, /* 162 = nanosleep */
- { 0, (sy_call_t *)nosys }, /* 163 = mremap */
+ { 4, (sy_call_t *)linux_mremap }, /* 163 = linux_mremap */
{ 0, (sy_call_t *)nosys }, /* 164 = setresuid */
{ 0, (sy_call_t *)nosys }, /* 165 = getresuid */
{ 0, (sy_call_t *)nosys }, /* 166 = new_vm86 */
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index 6da4c37..912cb32 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -1,4 +1,4 @@
- $Id: syscalls.master,v 1.10 1998/03/29 07:59:10 peter Exp $
+ $Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@@ -233,7 +233,8 @@
162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp); }
-163 UNIMPL LINUX mremap
+163 STD LINUX { int linux_mremap(caddr_t addr, int old_len, \
+ int new_len, int flags); }
164 UNIMPL LINUX setresuid
165 UNIMPL LINUX getresuid
166 UNIMPL LINUX new_vm86
OpenPOWER on IntegriCloud