1 /* MN10300 Weird system calls
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/syscalls.h>
15 #include <linux/smp.h>
16 #include <linux/sem.h>
17 #include <linux/msg.h>
18 #include <linux/shm.h>
19 #include <linux/stat.h>
20 #include <linux/mman.h>
21 #include <linux/file.h>
22 #include <linux/tty.h>
24 #include <asm/uaccess.h>
26 asmlinkage long old_mmap(unsigned long addr, unsigned long len,
27 unsigned long prot, unsigned long flags,
28 unsigned long fd, unsigned long offset)
30 if (offset & ~PAGE_MASK)
32 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
36 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
38 * This is really horribly ugly.
40 asmlinkage long sys_ipc(uint call, int first, int second,
41 int third, void __user *ptr, long fifth)
45 version = call >> 16; /* hack for backward compatibility */
50 return sys_semtimedop(first, (struct sembuf __user *)ptr,
53 return sys_semtimedop(first, (struct sembuf __user *)ptr,
55 (const struct timespec __user *)fifth);
57 return sys_semget(first, second, third);
62 if (get_user(fourth.__pad, (void __user * __user *) ptr))
64 return sys_semctl(first, second, third, fourth);
68 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
73 struct ipc_kludge tmp;
77 if (copy_from_user(&tmp,
78 (struct ipc_kludge __user *) ptr,
81 return sys_msgrcv(first, tmp.msgp, second,
85 return sys_msgrcv(first,
86 (struct msgbuf __user *) ptr,
87 second, fifth, third);
90 return sys_msgget((key_t) first, second);
92 return sys_msgctl(first, second,
93 (struct msqid_ds __user *) ptr);
99 ret = do_shmat(first, (char __user *) ptr, second,
103 return put_user(raddr, (ulong *) third);
105 case 1: /* iBCS2 emulator entry point */
106 if (!segment_eq(get_fs(), get_ds()))
108 return do_shmat(first, (char __user *) ptr, second,
112 return sys_shmdt((char __user *)ptr);
114 return sys_shmget(first, second, third);
116 return sys_shmctl(first, second,
117 (struct shmid_ds __user *) ptr);