get_unmapped_area handles MAP_FIXED on parisc
[linux-2.6.git] / arch / parisc / kernel / sys_parisc.c
index 7958cd8..6fed080 100644 (file)
@@ -31,6 +31,8 @@
 #include <linux/shm.h>
 #include <linux/smp_lock.h>
 #include <linux/syscalls.h>
+#include <linux/utsname.h>
+#include <linux/personality.h>
 
 int sys_pipe(int __user *fildes)
 {
@@ -104,6 +106,11 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
 {
        if (len > TASK_SIZE)
                return -ENOMEM;
+       /* Might want to check for cache aliasing issues for MAP_FIXED case
+        * like ARM or MIPS ??? --BenH.
+        */
+       if (flags & MAP_FIXED)
+               return addr;
        if (!addr)
                addr = TASK_UNMAPPED_BASE;
 
@@ -161,17 +168,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
        }
 }
 
-long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
-{
-       unsigned long raddr;
-       int r;
-
-       r = do_shmat(shmid, shmaddr, shmflag, &raddr);
-       if (r < 0)
-               return r;
-       return raddr;
-}
-
 /* Fucking broken ABI */
 
 #ifdef CONFIG_64BIT
@@ -242,6 +238,14 @@ asmlinkage long parisc_fadvise64_64(int fd,
                        (loff_t)high_len << 32 | low_len, advice);
 }
 
+asmlinkage long parisc_sync_file_range(int fd,
+                       u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes,
+                       unsigned int flags)
+{
+       return sys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off,
+                       (loff_t)hi_nbytes << 32 | lo_nbytes, flags);
+}
+
 asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
 {
        return -ENOMEM;
@@ -251,3 +255,33 @@ asmlinkage int sys_free_hugepages(unsigned long addr)
 {
        return -EINVAL;
 }
+
+long parisc_personality(unsigned long personality)
+{
+       long err;
+
+       if (personality(current->personality) == PER_LINUX32
+           && personality == PER_LINUX)
+               personality = PER_LINUX32;
+
+       err = sys_personality(personality);
+       if (err == PER_LINUX32)
+               err = PER_LINUX;
+
+       return err;
+}
+
+long parisc_newuname(struct new_utsname __user *name)
+{
+       int err = sys_newuname(name);
+
+#ifdef CONFIG_COMPAT
+       if (!err && personality(current->personality) == PER_LINUX32) {
+               if (__put_user(0, name->machine + 6) ||
+                   __put_user(0, name->machine + 7))
+                       err = -EFAULT;
+       }
+#endif
+
+       return err;
+}