linux-mips
[Top] [All Lists]

64-bit kernel patch.

To: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: 64-bit kernel patch.
From: Carsten Langgaard <carstenl@mips.com>
Date: Wed, 02 Oct 2002 15:22:59 +0200
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
I have a number of patches for the o32 syscall wrapper/conversion
routines, which is needed when running a 64-bit kernel on an o32
userland.
Here is the first one. Ralf, could you please apply it, so I can send
the next one.

/Carsten




--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com


Index: arch/mips64/kernel/linux32.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/linux32.c,v
retrieving revision 1.42.2.12
diff -u -r1.42.2.12 linux32.c
--- arch/mips64/kernel/linux32.c        27 Sep 2002 23:29:17 -0000      
1.42.2.12
+++ arch/mips64/kernel/linux32.c        2 Oct 2002 13:13:42 -0000
@@ -179,7 +179,32 @@
        return err;
 }
 
-asmlinkage int sys_mmap2(void) {return 0;}
+asmlinkage unsigned long
+sys32_mmap2(unsigned long addr, size_t len, unsigned long prot,
+         unsigned long flags, unsigned long fd, unsigned long pgoff)
+{
+       struct file * file = NULL;
+       unsigned long error;
+
+       error = -EINVAL;
+       if (!(flags & MAP_ANONYMOUS)) {
+               error = -EBADF;
+               file = fget(fd);
+               if (!file)
+                       goto out;
+       }
+       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+
+       down_write(&current->mm->mmap_sem);
+       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+       up_write(&current->mm->mmap_sem);
+       if (file)
+               fput(file);
+
+out:
+       return error;
+}
+
 
 asmlinkage long sys_truncate(const char * path, unsigned long length);
 
Index: arch/mips64/kernel/scall_o32.S
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/scall_o32.S,v
retrieving revision 1.48.2.15
diff -u -r1.48.2.15 scall_o32.S
--- arch/mips64/kernel/scall_o32.S      11 Sep 2002 13:56:36 -0000      
1.48.2.15
+++ arch/mips64/kernel/scall_o32.S      2 Oct 2002 13:13:42 -0000
@@ -522,7 +522,7 @@
        sys     sys_sendfile    4
        sys     sys_ni_syscall  0
        sys     sys_ni_syscall  0
-       sys     sys_mmap2       6                       /* 4210 */
+       sys     sys32_mmap2     6                       /* 4210 */
        sys     sys_truncate64  2
        sys     sys_ftruncate64 2
        sys     sys_newstat     2
<Prev in Thread] Current Thread [Next in Thread>