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);
46 local_irq_restore(flags);
49 #else /* CONFIG_SMP */
50 #include <linux/spinlock.h>
52 static DEFINE_SPINLOCK(tas_lock);
54 asmlinkage int sys_tas(int *addr)
58 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
61 _raw_spin_lock(&tas_lock);
65 _raw_spin_unlock(&tas_lock);
69 #endif /* CONFIG_SMP */
72 * sys_pipe() is the normal C calling standard for creating
73 * a pipe. It's not the way Unix traditionally does this, though.
76 sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2,
77 unsigned long r3, unsigned long r4, unsigned long r5,
78 unsigned long r6, struct pt_regs regs)
85 if (copy_to_user((void *)r0, (void *)fd, 2*sizeof(int)))
91 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
92 unsigned long prot, unsigned long flags,
93 unsigned long fd, unsigned long pgoff)
96 struct file *file = NULL;
98 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
99 if (!(flags & MAP_ANONYMOUS)) {
105 down_write(¤t->mm->mmap_sem);
106 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
107 up_write(¤t->mm->mmap_sem);
116 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
118 * This is really horribly ugly.
120 asmlinkage int sys_ipc(uint call, int first, int second,
121 int third, void __user *ptr, long fifth)
125 version = call >> 16; /* hack for backward compatibility */
130 return sys_semtimedop(first, (struct sembuf __user *)ptr,
133 return sys_semtimedop(first, (struct sembuf __user *)ptr,
134 second, (const struct timespec __user *)fifth);
136 return sys_semget (first, second, third);
141 if (get_user(fourth.__pad, (void __user * __user *) ptr))
143 return sys_semctl (first, second, third, fourth);
147 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
152 struct ipc_kludge tmp;
156 if (copy_from_user(&tmp,
157 (struct ipc_kludge __user *) ptr,
160 return sys_msgrcv (first, tmp.msgp, second,
164 return sys_msgrcv (first,
165 (struct msgbuf __user *) ptr,
166 second, fifth, third);
169 return sys_msgget ((key_t) first, second);
171 return sys_msgctl (first, second,
172 (struct msqid_ds __user *) ptr);
176 if (!access_ok(VERIFY_WRITE, (ulong __user *) third,
179 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
182 return put_user (raddr, (ulong __user *) third);
185 return sys_shmdt ((char __user *)ptr);
187 return sys_shmget (first, second, third);
189 return sys_shmctl (first, second,
190 (struct shmid_ds __user *) ptr);
196 asmlinkage int sys_uname(struct old_utsname * name)
202 err=copy_to_user(name, &system_utsname, sizeof (*name));
204 return err?-EFAULT:0;
207 asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
209 /* This should flush more selectivly ... */
214 asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
216 /* Not implemented yet. */