diff -urN linux-2.2.orig/arch/mips/config.in linux-2.2/arch/mips/config.in --- linux-2.2.orig/arch/mips/config.in Thu Jun 10 01:02:19 1999 +++ linux-2.2/arch/mips/config.in Mon Jul 5 13:29:13 1999 @@ -92,6 +92,9 @@ bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC +if [ "$CONFIG_SYSVIPC" = "y" ]; then + bool 'DIPC (Distributed System V IPC)' CONFIG_SYSVIPC_DIPC +fi bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL diff -urN linux-2.2.orig/arch/mips/defconfig linux-2.2/arch/mips/defconfig --- linux-2.2.orig/arch/mips/defconfig Mon Jun 14 23:29:03 1999 +++ linux-2.2/arch/mips/defconfig Mon Jul 5 14:10:13 1999 @@ -41,6 +41,7 @@ # CONFIG_BINFMT_MISC is not set CONFIG_NET=y CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_DIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y # CONFIG_PARPORT is not set diff -urN linux-2.2.orig/arch/mips/kernel/ipc.c linux-2.2/arch/mips/kernel/ipc.c --- linux-2.2.orig/arch/mips/kernel/ipc.c Mon Dec 15 02:37:26 1997 +++ linux-2.2/arch/mips/kernel/ipc.c Mon Jul 5 13:38:33 1999 @@ -1,5 +1,4 @@ -/* - * linux/arch/mips/kernel/ipc.c +/* $Id$ * * This file contains various random system calls that * have a non-standard calling sequence on the Linux/MIPS @@ -13,6 +12,9 @@ #include #include #include +#ifdef CONFIG_SYSVIPC_DIPC +#include +#endif #include #include @@ -22,106 +24,101 @@ * * This is really horribly ugly. FIXME: Get rid of this wrapper. */ -asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) +asmlinkage int sys_ipc (uint call, int first, int second, + int third, void *ptr, long fifth) { int version, ret; - lock_kernel(); version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; if (call <= SEMCTL) switch (call) { case SEMOP: - ret = sys_semop (first, (struct sembuf *)ptr, second); - goto out; + return sys_semop (first, (struct sembuf *)ptr, second); case SEMGET: - ret = sys_semget (first, second, third); - goto out; + return sys_semget (first, second, third); case SEMCTL: { union semun fourth; - ret = -EINVAL; if (!ptr) - goto out; - ret = -EFAULT; + return -EINVAL; if (get_user(fourth.__pad, (void **) ptr)) - goto out; - ret = sys_semctl (first, second, third, fourth); - goto out; + return -EFAULT; + return sys_semctl (first, second, third, fourth); } default: - ret = -EINVAL; - goto out; + return -EINVAL; } + if (call <= MSGCTL) switch (call) { case MSGSND: - ret = sys_msgsnd (first, (struct msgbuf *) ptr, + return sys_msgsnd (first, (struct msgbuf *) ptr, second, third); - goto out; case MSGRCV: switch (version) { case 0: { struct ipc_kludge tmp; - ret = -EINVAL; if (!ptr) - goto out; - ret = -EFAULT; - if (copy_from_user(&tmp,(struct ipc_kludge *) ptr, - sizeof (tmp))) - goto out; - ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); - goto out; + return -EINVAL; + + if (copy_from_user(&tmp, + (struct ipc_kludge *) ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); } - case 1: default: - ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); - goto out; + default: + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); } case MSGGET: - ret = sys_msgget ((key_t) first, second); - goto out; + return sys_msgget ((key_t) first, second); case MSGCTL: - ret = sys_msgctl (first, second, (struct msqid_ds *) ptr); - goto out; + return sys_msgctl (first, second, + (struct msqid_ds *) ptr); default: - ret = -EINVAL; - goto out; + return -EINVAL; } if (call <= SHMCTL) switch (call) { case SHMAT: switch (version) { - case 0: default: { + default: { ulong raddr; - ret = sys_shmat (first, (char *) ptr, second, &raddr); + ret = sys_shmat (first, (char *) ptr, + second, &raddr); if (ret) - goto out; - ret = put_user (raddr, (ulong *) third); - goto out; + return ret; + return put_user (raddr, (ulong *) third); } case 1: /* iBCS2 emulator entry point */ - ret = -EINVAL; if (!segment_eq(get_fs(), get_ds())) - goto out; - ret = sys_shmat (first, (char *) ptr, second, (ulong *) third); - goto out; + return -EINVAL; + return sys_shmat (first, (char *) ptr, + second, (ulong *) third); } case SHMDT: - ret = sys_shmdt ((char *)ptr); - goto out; + return sys_shmdt ((char *)ptr); case SHMGET: - ret = sys_shmget (first, second, third); - goto out; + return sys_shmget (first, second, third); case SHMCTL: - ret = sys_shmctl (first, second, (struct shmid_ds *) ptr); - goto out; + return sys_shmctl (first, second, + (struct shmid_ds *) ptr); + default: + return -EINVAL; + } +#ifdef CONFIG_SYSVIPC_DIPC + if (call <= DIPC) + switch (call) { + case DIPC: + return sys_dipc (first, second, (int *)third); default: - ret = -EINVAL; - goto out; + return -EINVAL; } - else - ret = -EINVAL; -out: - unlock_kernel(); - return ret; +#endif + + return -EINVAL; } diff -urN linux-2.2.orig/arch/mips/mm/fault.c linux-2.2/arch/mips/mm/fault.c --- linux-2.2.orig/arch/mips/mm/fault.c Mon Oct 19 14:27:37 1998 +++ linux-2.2/arch/mips/mm/fault.c Mon Jul 5 13:43:38 1999 @@ -4,7 +4,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle + * Copyright (C) 1995 - 1999 by Ralf Baechle */ #include #include @@ -31,6 +31,11 @@ extern void die(char *, struct pt_regs *, unsigned long write); +#ifdef CONFIG_SYSVIPC_DIPC +extern int dipc_shm_fault(struct vm_area_struct *vma, unsigned long address, + unsigned long error_code); +#endif + unsigned long asid_cache; /* @@ -65,6 +70,15 @@ vma = find_vma(mm, address); if (!vma) goto bad_area; + +#ifdef CONFIG_SYSVIPC_DIPC + if(vma->vm_flags & VM_SHM) { + if(dipc_shm_fault(vma, address, writeaccess)) { + up(&mm->mmap_sem); + return; + } + } +#endif if (vma->vm_start <= address) goto good_area; if (!(vma->vm_flags & VM_GROWSDOWN)) diff -urN linux-2.2.orig/include/asm-i386/dipc.h linux-2.2/include/asm-i386/dipc.h --- linux-2.2.orig/include/asm-i386/dipc.h Wed Dec 31 16:00:00 1969 +++ linux-2.2/include/asm-i386/dipc.h Mon Jul 5 13:53:13 1999 @@ -0,0 +1,13 @@ +/* + * 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. + */ +#ifndef _ASM_DIPC_H +#define _ASM_DIPC_H + +#define MY_DIPC_ARCH LINUX_LITTLE_32 +#define DIPC_PAGE_RW(x) ((x) | _PAGE_RW) +#define DIPC_PAGE_RO(x) ((x) & ~_PAGE_RW) + +#endif _ASM_DIPC_H diff -urN linux-2.2.orig/include/asm-m68k/dipc.h linux-2.2/include/asm-m68k/dipc.h --- linux-2.2.orig/include/asm-m68k/dipc.h Wed Dec 31 16:00:00 1969 +++ linux-2.2/include/asm-m68k/dipc.h Mon Jul 5 13:53:22 1999 @@ -0,0 +1,13 @@ +/* + * 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. + */ +#ifndef _ASM_DIPC_H +#define _ASM_DIPC_H + +#define MY_DIPC_ARCH LINUX_BIG_32 +#define DIPC_PAGE_RW(x) ((x) & ~_PAGE_RONLY) +#define DIPC_PAGE_RO(x) ((x) | _PAGE_RONLY) + +#endif _ASM_DIPC_H diff -urN linux-2.2.orig/include/asm-mips/dipc.h linux-2.2/include/asm-mips/dipc.h --- linux-2.2.orig/include/asm-mips/dipc.h Wed Dec 31 16:00:00 1969 +++ linux-2.2/include/asm-mips/dipc.h Mon Jul 5 14:02:19 1999 @@ -0,0 +1,22 @@ +/* $Id$ + * + * 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) 1999 by Ralf Baechle (ralf@gnu.org) + */ +#ifndef _ASM_DIPC_H +#define _ASM_DIPC_H + +#ifdef __MIPSEB__ +#define MY_DIPC_ARCH LINUX_BIG_32 +#endif +#ifdef __MIPSEL__ +#define MY_DIPC_ARCH LINUX_LITTLE_32 +#endif + +#define DIPC_PAGE_RW(x) ((x) | (_PAGE_WRITE | _PAGE_SILENT_WRITE)) +#define DIPC_PAGE_RO(x) ((x) & ~(_PAGE_WRITE | _PAGE_SILENT_WRITE)) + +#endif _ASM_DIPC_H diff -urN linux-2.2.orig/include/linux/dipc.h linux-2.2/include/linux/dipc.h --- linux-2.2.orig/include/linux/dipc.h Mon Jul 5 13:27:19 1999 +++ linux-2.2/include/linux/dipc.h Mon Jul 5 14:03:16 1999 @@ -5,8 +5,10 @@ */ #ifndef _LINUX_DIPC_H #define _LINUX_DIPC_H + #ifdef __KERNEL__ #include +#include #endif extern int dipc(int first, int cmd, void *ptr); @@ -133,19 +135,6 @@ #define LINUX_BIG_64 0x90909090 #define LINUX_NBOR 0xffffffff - -/* define architecture, according to build definitions - add new archs here! */ -#if defined(__i386__) -#define MY_DIPC_ARCH LINUX_LITTLE_32 -#define DIPC_PAGE_RW(x) ((x) | _PAGE_RW) -#define DIPC_PAGE_RO(x) ((x) & ~_PAGE_RW) -#elif defined(__mc68000__) -#define MY_DIPC_ARCH LINUX_BIG_32 -#define DIPC_PAGE_RW(x) ((x) & ~_PAGE_RONLY) -#define DIPC_PAGE_RO(x) ((x) | _PAGE_RONLY) -#else -#error "unsupported DIPC architecture!" -#endif /* Back door definitions */ #define REFEREE_BACKDOOR "referee_backdoor"