summaryrefslogtreecommitdiff
path: root/arch/parisc/kernel/sys_parisc.c
diff options
context:
space:
mode:
authorKyle McMartin <kyle@parisc-linux.org>2006-08-27 15:12:13 (GMT)
committerMatthew Wilcox <willy@parisc-linux.org>2006-10-04 12:46:53 (GMT)
commit75a4958154f5d0028d5464f2479b4297d55cf4a3 (patch)
tree54121490e3a1f423b18e78d7f216dfc32bc71b64 /arch/parisc/kernel/sys_parisc.c
parentdf570b9c284701d08b22aa00cbfcf870b7f1b7c1 (diff)
downloadlinux-fsl-qoriq-75a4958154f5d0028d5464f2479b4297d55cf4a3.tar.xz
[PARISC] Allow overriding personality with sys_personality
And now suddenly, linux32 works on parisc... Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/kernel/sys_parisc.c')
-rw-r--r--arch/parisc/kernel/sys_parisc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 8b5df98..1db5588 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -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)
{
@@ -248,3 +250,46 @@ 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;
+}
+
+static inline int override_machine(char __user *mach) {
+#ifdef CONFIG_COMPAT
+ if (personality(current->personality) == PER_LINUX32) {
+ if (__put_user(0, mach + 6) ||
+ __put_user(0, mach + 7))
+ return -EFAULT;
+ }
+
+ return 0;
+#else /*!CONFIG_COMPAT*/
+ return 0;
+#endif /*CONFIG_COMPAT*/
+}
+
+long parisc_newuname(struct new_utsname __user *utsname)
+{
+ int err = 0;
+
+ down_read(&uts_sem);
+ if (copy_to_user(utsname, &system_utsname, sizeof(*utsname)))
+ err = -EFAULT;
+ up_read(&uts_sem);
+
+ err = override_machine(utsname->machine);
+
+ return (long)err;
+}