2 * linux/arch/m32r/kernel/sys_m32r.c
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/M32R platform.
7 * Taken from i386 version.
10 #include <linux/config.h>
11 #include <linux/errno.h>
12 #include <linux/sched.h>
14 #include <linux/smp.h>
15 #include <linux/smp_lock.h>
16 #include <linux/sem.h>
17 #include <linux/msg.h>
18 #include <linux/shm.h>
19 #include <linux/stat.h>
20 #include <linux/syscalls.h>
21 #include <linux/mman.h>
22 #include <linux/file.h>
23 #include <linux/utsname.h>
25 #include <asm/uaccess.h>
26 #include <asm/cachectl.h>
27 #include <asm/cacheflush.h>
31 * sys_tas() - test-and-set
32 * linuxthreads testing version
35 asmlinkage int sys_tas(int *addr)
40 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
42 local_irq_save(flags);
45 local_irq_restore(flags);
48 #else /* CONFIG_SMP */
49 #include <linux/spinlock.h>
51 static DEFINE_SPINLOCK(tas_lock);
53 asmlinkage int sys_tas(int *addr)
57 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
60 _raw_spin_lock(&tas_lock);
63 _raw_spin_unlock(&tas_lock);
67 #endif /* CONFIG_SMP */
70 * sys_pipe() is the normal C calling standard for creating
71 * a pipe. It's not the way Unix traditionally does this, though.
74 sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2,
75 unsigned long r3, unsigned long r4, unsigned long r5,
76 unsigned long r6, struct pt_regs regs)
83 if (copy_to_user((void *)r0, (void *)fd, 2*sizeof(int)))
89 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
90 unsigned long prot, unsigned long flags,
91 unsigned long fd, unsigned long pgoff)
94 struct file *file = NULL;
96 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
97 if (!(flags & MAP_ANONYMOUS)) {
103 down_write(¤t->mm->mmap_sem);
104 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
105 up_write(¤t->mm->mmap_sem);
114 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
116 * This is really horribly ugly.
118 asmlinkage int sys_ipc(uint call, int first, int second,
119 int third, void __user *ptr, long fifth)
123 version = call >> 16; /* hack for backward compatibility */
128 return sys_semtimedop(first, (struct sembuf __user *)ptr,
131 return sys_semtimedop(first, (struct sembuf __user *)ptr,
132 second, (const struct timespec __user *)fifth);
134 return sys_semget (first, second, third);
139 if (get_user(fourth.__pad, (void __user * __user *) ptr))
141 return sys_semctl (first, second, third, fourth);
145 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
150 struct ipc_kludge tmp;
154 if (copy_from_user(&tmp,
155 (struct ipc_kludge __user *) ptr,
158 return sys_msgrcv (first, tmp.msgp, second,
162 return sys_msgrcv (first,
163 (struct msgbuf __user *) ptr,
164 second, fifth, third);
167 return sys_msgget ((key_t) first, second);
169 return sys_msgctl (first, second,
170 (struct msqid_ds __user *) ptr);
174 if (!access_ok(VERIFY_WRITE, (ulong __user *) third,
177 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
180 return put_user (raddr, (ulong __user *) third);
183 return sys_shmdt ((char __user *)ptr);
185 return sys_shmget (first, second, third);
187 return sys_shmctl (first, second,
188 (struct shmid_ds __user *) ptr);
194 asmlinkage int sys_uname(struct old_utsname * name)
200 err=copy_to_user(name, &system_utsname, sizeof (*name));
202 return err?-EFAULT:0;
205 asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
207 /* This should flush more selectivly ... */
212 asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
214 /* Not implemented yet. */