Commit 8fc41201 authored by Ralf Bächle's avatar Ralf Bächle Committed by Linus Torvalds

[PATCH] mips: IRIX 5 compat fixes

Start to resurrect the IRIX 5 binary compatibility code.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e58595ec
/*
* 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
/*
* 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 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
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);
}
......
......@@ -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);
......@@ -624,7 +624,7 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
}
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)
......
......@@ -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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment