aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300/kernel/sys_h8300.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-03-10 18:21:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:32 -0500
commitbaed7fc9b580bd3fb8252ff1d9b36eaf1f86b670 (patch)
tree38f23cd9888b92de3f73ed1f4ce48cd83e940e0e /arch/h8300/kernel/sys_h8300.c
parenta4679373cf4ee0e7792dc56205365732b725c2c1 (diff)
Add generic sys_ipc wrapper
Add a generic implementation of the ipc demultiplexer syscall. Except for s390 and sparc64 all implementations of the sys_ipc are nearly identical. There are slight differences in the types of the parameters, where mips and powerpc as the only 64-bit architectures with sys_ipc use unsigned long for the "third" argument as it gets casted to a pointer later, while it traditionally is an "int" like most other paramters. frv goes even further and uses unsigned long for all parameters execept for "ptr" which is a pointer type everywhere. The change from int to unsigned long for "third" and back to "int" for the others on frv should be fine due to the in-register calling conventions for syscalls (we already had a similar issue with the generic sys_ptrace), but I'd prefer to have the arch maintainers looks over this in details. Except for that h8300, m68k and m68knommu lack an impplementation of the semtimedop sub call which this patch adds, and various architectures have gets used - at least on i386 it seems superflous as the compat code on x86-64 and ia64 doesn't even bother to implement it. [akpm@linux-foundation.org: add sys_ipc to sys_ni.c] Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Reviewed-by: H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: James Morris <jmorris@namei.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: David Howells <dhowells@redhat.com> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/h8300/kernel/sys_h8300.c')
-rw-r--r--arch/h8300/kernel/sys_h8300.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 1f13fd6e5309..f9b3f44da69f 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -26,94 +26,6 @@
26#include <asm/traps.h> 26#include <asm/traps.h>
27#include <asm/unistd.h> 27#include <asm/unistd.h>
28 28
29/*
30 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
31 *
32 * This is really horribly ugly.
33 */
34asmlinkage int sys_ipc (uint call, int first, int second,
35 int third, void *ptr, long fifth)
36{
37 int version, ret;
38
39 version = call >> 16; /* hack for backward compatibility */
40 call &= 0xffff;
41
42 if (call <= SEMCTL)
43 switch (call) {
44 case SEMOP:
45 return sys_semop (first, (struct sembuf *)ptr, second);
46 case SEMGET:
47 return sys_semget (first, second, third);
48 case SEMCTL: {
49 union semun fourth;
50 if (!ptr)
51 return -EINVAL;
52 if (get_user(fourth.__pad, (void **) ptr))
53 return -EFAULT;
54 return sys_semctl (first, second, third, fourth);
55 }
56 default:
57 return -EINVAL;
58 }
59 if (call <= MSGCTL)
60 switch (call) {
61 case MSGSND:
62 return sys_msgsnd (first, (struct msgbuf *) ptr,
63 second, third);
64 case MSGRCV:
65 switch (version) {
66 case 0: {
67 struct ipc_kludge tmp;
68 if (!ptr)
69 return -EINVAL;
70 if (copy_from_user (&tmp,
71 (struct ipc_kludge *)ptr,
72 sizeof (tmp)))
73 return -EFAULT;
74 return sys_msgrcv (first, tmp.msgp, second,
75 tmp.msgtyp, third);
76 }
77 default:
78 return sys_msgrcv (first,
79 (struct msgbuf *) ptr,
80 second, fifth, third);
81 }
82 case MSGGET:
83 return sys_msgget ((key_t) first, second);
84 case MSGCTL:
85 return sys_msgctl (first, second,
86 (struct msqid_ds *) ptr);
87 default:
88 return -EINVAL;
89 }
90 if (call <= SHMCTL)
91 switch (call) {
92 case SHMAT:
93 switch (version) {
94 default: {
95 ulong raddr;
96 ret = do_shmat (first, (char *) ptr,
97 second, &raddr);
98 if (ret)
99 return ret;
100 return put_user (raddr, (ulong *) third);
101 }
102 }
103 case SHMDT:
104 return sys_shmdt ((char *)ptr);
105 case SHMGET:
106 return sys_shmget (first, second, third);
107 case SHMCTL:
108 return sys_shmctl (first, second,
109 (struct shmid_ds *) ptr);
110 default:
111 return -EINVAL;
112 }
113
114 return -EINVAL;
115}
116
117/* sys_cacheflush -- no support. */ 29/* sys_cacheflush -- no support. */
118asmlinkage int 30asmlinkage int
119sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 31sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)