summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Bächle <ralf@linux-mips.org>2005-02-01 16:40:16 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-02-01 16:40:16 -0800
commit8fc41201d25e2a1462630d37a471d0b7acaa8c46 (patch)
tree26f02a84f4d0af23900e3dbb295c39d123e75b42
parente58595ec1d2a7f7c2a5ec56df087ccbd225c655b (diff)
[PATCH] mips: IRIX 5 compat fixes
Start to resurrect the IRIX 5 binary compatibility code. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/mips/kernel/irix5sys.S (renamed from arch/mips/kernel/irix5sys.h)54
-rw-r--r--arch/mips/kernel/irixelf.c37
-rw-r--r--arch/mips/kernel/irixinv.c8
-rw-r--r--arch/mips/kernel/irixsig.c2
-rw-r--r--arch/mips/kernel/sysirix.c4
5 files changed, 65 insertions, 40 deletions
diff --git a/arch/mips/kernel/irix5sys.h b/arch/mips/kernel/irix5sys.S
index 250c782cb51f..eeef891093ed 100644
--- a/arch/mips/kernel/irix5sys.h
+++ b/arch/mips/kernel/irix5sys.S
@@ -1,25 +1,27 @@
/*
- * irix5sys.h: 32-bit IRIX5 ABI system call table.
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
*
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ * 32-bit IRIX5 ABI system call table derived from original file 'irix5sys.h'
+ * created by David S. Miller.
+ *
+ * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com>
+ * Copyright (C) 2004 Steven J. Hill <sjhill@realitydiluted.com>
*/
+#include <asm/asm.h>
-/* This file is being included twice - once to build a list of all
- * syscalls and once to build a table of how many arguments each syscall
- * accepts. Syscalls that receive a pointer to the saved registers are
- * marked as having zero arguments.
- */
-#include <linux/config.h>
+ /*
+ * Key:
+ * V == Valid and should work as expected for most cases.
+ * HV == Half Valid, some things will work, some likely will not
+ * IV == InValid, certainly will not work at all yet
+ * ?V == ?'ably Valid, I have not done enough looking into it
+ * DC == Don't Care, a rats ass we couldn't give
+ */
-/* Keys:
- * V == Valid and should work as expected for most cases.
- * HV == Half Valid, some things will work, some likely will not
- * IV == InValid, certainly will not work at all yet
- * ?V == ?'ably Valid, I have not done enough looking into it
- * DC == Don't Care, a rats ass we couldn't give
- */
+ .macro irix5syscalltable
-#ifdef CONFIG_BINFMT_IRIX
sys sys_syscall 0 /* 1000 sysindir() V*/
sys sys_exit 1 /* 1001 exit() V*/
sys sys_fork 0 /* 1002 fork() V*/
@@ -247,7 +249,7 @@
sys irix_unimp 0 /* 1224 XXX psema_cntl() */
sys irix_unimp 0 /* 1225 XXX restartreturn() */
-/* Just to pad things out nicely. */
+ /* Just to pad things out nicely. */
sys irix_unimp 0
sys irix_unimp 0
sys irix_unimp 0
@@ -1022,8 +1024,18 @@
sys irix_unimp 0
sys irix_unimp 0
sys irix_unimp 0
-#else
- mille sys_ni_syscall 0
-#endif
-/* YEEEEEEEEEEEEEEEEEE!!!! */
+ .endm
+
+ /*
+ * Pre-compute the number of _instruction_ bytes needed to load
+ * or store the arguments 6-8. Negative values are ignored.
+ */
+ .macro sys function, nargs
+ PTR \function
+ LONG (\nargs << 2) - (5 << 2)
+ .endm
+
+ .align 4
+EXPORT(sys_call_table_irix5)
+ irix5syscalltable
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 43c254299e4a..42fb65f890dd 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -1,15 +1,16 @@
/*
- * irixelf.c: Code to load IRIX ELF executables which conform to
- * the MIPS ABI.
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
*
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ * irixelf.c: Code to load IRIX ELF executables conforming to the MIPS ABI.
+ * Based off of work by Eric Youngdale.
*
- * Based upon work which is:
- * Copyright 1993, 1994: Eric Youngdale (ericy@cais.com).
+ * Copyright (C) 1993 - 1994 Eric Youngdale <ericy@cais.com>
+ * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com>
+ * Copyright (C) 2004 Steven J. Hill <sjhill@realitydiluted.com>
*/
-
#include <linux/module.h>
-
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/sched.h>
@@ -211,13 +212,13 @@ unsigned long * create_irix_tables(char * p, int argc, int envc,
__put_user((unsigned long)p,argv++);
p += strlen_user(p);
}
- __put_user(NULL, argv);
+ __put_user((unsigned long) NULL, argv);
current->mm->arg_end = current->mm->env_start = (unsigned long) p;
while (envc-->0) {
__put_user((unsigned long)p,envp++);
p += strlen_user(p);
}
- __put_user(NULL, envp);
+ __put_user((unsigned long) NULL, envp);
current->mm->env_end = (unsigned long) p;
return sp;
}
@@ -622,6 +623,7 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
}
retval = kernel_read(bprm->file, elf_ex.e_phoff, (char *)elf_phdata, size);
+
if (retval < 0)
goto out_free_ph;
@@ -934,7 +936,8 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
}
#ifdef DEBUG_ELF
- printk("irix_mapelf: Success, returning %08lx\n", user_phdrp->p_vaddr);
+ printk("irix_mapelf: Success, returning %08lx\n",
+ (unsigned long) user_phdrp->p_vaddr);
#endif
fput(filp);
return user_phdrp->p_vaddr;
@@ -1297,6 +1300,20 @@ end_coredump:
static int __init init_irix_binfmt(void)
{
+ int init_inventory(void);
+ extern asmlinkage unsigned long sys_call_table;
+ extern asmlinkage unsigned long sys_call_table_irix5;
+
+ init_inventory();
+
+ /*
+ * Copy the IRIX5 syscall table (8000 bytes) into the main syscall
+ * table. The IRIX5 calls are located by an offset of 8000 bytes
+ * from the beginning of the main table.
+ */
+ memcpy((void *) ((unsigned long) &sys_call_table + 8000),
+ &sys_call_table_irix5, 8000);
+
return register_binfmt(&irix_format);
}
diff --git a/arch/mips/kernel/irixinv.c b/arch/mips/kernel/irixinv.c
index eea2582451e4..b8f1446eebc2 100644
--- a/arch/mips/kernel/irixinv.c
+++ b/arch/mips/kernel/irixinv.c
@@ -6,10 +6,8 @@
* Miguel de Icaza, 1997.
*/
#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <asm/uaccess.h>
#include <asm/inventory.h>
+#include <asm/uaccess.h>
#define MAX_INVENTORY 50
int inventory_items = 0;
@@ -49,7 +47,7 @@ int dump_inventory_to_user (void *userbuf, int size)
return inventory_items * sizeof (inventory_t);
}
-static int __init init_inventory(void)
+int __init init_inventory(void)
{
/*
* gross hack while we put the right bits all over the kernel
@@ -77,5 +75,3 @@ static int __init init_inventory(void)
return 0;
}
-
-module_init(init_inventory);
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 64d46091a60e..298af9916db3 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -624,7 +624,7 @@ repeat:
}
goto end_waitsys;
- case TASK_ZOMBIE:
+ case EXIT_ZOMBIE:
current->signal->cutime += p->utime + p->signal->cutime;
current->signal->cstime += p->stime + p->signal->cstime;
if (ru != NULL)
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 00254cd557fb..3bb59d7f5913 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -1648,7 +1648,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
struct kstatfs kbuf;
int error, i;
- printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n",
+ printk("[%s:%d] Wheee.. irix_statvfs64(%s,%p)\n",
current->comm, current->pid, fname, buf);
error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs64));
if(error)
@@ -1694,7 +1694,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
struct file *file;
int error, i;
- printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n",
+ printk("[%s:%d] Wheee.. irix_fstatvfs64(%d,%p)\n",
current->comm, current->pid, fd, buf);
error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs));