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/errno.h>
11 #include <linux/sched.h>
13 #include <linux/smp.h>
14 #include <linux/smp_lock.h>
15 #include <linux/sem.h>
16 #include <linux/msg.h>
17 #include <linux/shm.h>
18 #include <linux/stat.h>
19 #include <linux/syscalls.h>
20 #include <linux/mman.h>
21 #include <linux/file.h>
22 #include <linux/utsname.h>
24 #include <asm/uaccess.h>
25 #include <asm/cachectl.h>
26 #include <asm/cacheflush.h>
30 * sys_tas() - test-and-set
32 asmlinkage
int sys_tas(int *addr
)
36 if (!access_ok(VERIFY_WRITE
, addr
, sizeof (int)))
40 * oldval = *addr; *addr = 1;
42 __asm__
__volatile__ (
43 DCACHE_CLEAR("%0", "r4", "%1")
46 " lock %0, @%1 -> unlock %2, @%1\n"
49 * The m32r processor can accept interrupts only
50 * at the 32-bit instruction boundary.
51 * So, in the above code, the "unlock" instruction
52 * can be executed continuously after the "lock"
53 * instruction execution without any interruptions.
55 ".section .fixup,\"ax\"\n"
58 " seth r14, #high(2b)\n"
59 " or3 r14, r14, #low(2b)\n"
62 ".section __ex_table,\"a\"\n"
67 : "r" (addr
), "r" (1), "i"(-EFAULT
)
69 #ifdef CONFIG_CHIP_M32700_TS1
71 #endif /* CONFIG_CHIP_M32700_TS1 */
78 * sys_pipe() is the normal C calling standard for creating
79 * a pipe. It's not the way Unix traditionally does this, though.
82 sys_pipe(unsigned long r0
, unsigned long r1
, unsigned long r2
,
83 unsigned long r3
, unsigned long r4
, unsigned long r5
,
84 unsigned long r6
, struct pt_regs regs
)
91 if (copy_to_user((void *)r0
, (void *)fd
, 2*sizeof(int)))
97 asmlinkage
long sys_mmap2(unsigned long addr
, unsigned long len
,
98 unsigned long prot
, unsigned long flags
,
99 unsigned long fd
, unsigned long pgoff
)
102 struct file
*file
= NULL
;
104 flags
&= ~(MAP_EXECUTABLE
| MAP_DENYWRITE
);
105 if (!(flags
& MAP_ANONYMOUS
)) {
111 down_write(¤t
->mm
->mmap_sem
);
112 error
= do_mmap_pgoff(file
, addr
, len
, prot
, flags
, pgoff
);
113 up_write(¤t
->mm
->mmap_sem
);
122 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
124 * This is really horribly ugly.
126 asmlinkage
int sys_ipc(uint call
, int first
, int second
,
127 int third
, void __user
*ptr
, long fifth
)
131 version
= call
>> 16; /* hack for backward compatibility */
136 return sys_semtimedop(first
, (struct sembuf __user
*)ptr
,
139 return sys_semtimedop(first
, (struct sembuf __user
*)ptr
,
140 second
, (const struct timespec __user
*)fifth
);
142 return sys_semget (first
, second
, third
);
147 if (get_user(fourth
.__pad
, (void __user
* __user
*) ptr
))
149 return sys_semctl (first
, second
, third
, fourth
);
153 return sys_msgsnd (first
, (struct msgbuf __user
*) ptr
,
158 struct ipc_kludge tmp
;
162 if (copy_from_user(&tmp
,
163 (struct ipc_kludge __user
*) ptr
,
166 return sys_msgrcv (first
, tmp
.msgp
, second
,
170 return sys_msgrcv (first
,
171 (struct msgbuf __user
*) ptr
,
172 second
, fifth
, third
);
175 return sys_msgget ((key_t
) first
, second
);
177 return sys_msgctl (first
, second
,
178 (struct msqid_ds __user
*) ptr
);
182 if (!access_ok(VERIFY_WRITE
, (ulong __user
*) third
,
185 ret
= do_shmat (first
, (char __user
*) ptr
, second
, &raddr
);
188 return put_user (raddr
, (ulong __user
*) third
);
191 return sys_shmdt ((char __user
*)ptr
);
193 return sys_shmget (first
, second
, third
);
195 return sys_shmctl (first
, second
,
196 (struct shmid_ds __user
*) ptr
);
202 asmlinkage
int sys_uname(struct old_utsname
* name
)
208 err
=copy_to_user(name
, &system_utsname
, sizeof (*name
));
210 return err
?-EFAULT
:0;
213 asmlinkage
int sys_cacheflush(void *addr
, int bytes
, int cache
)
215 /* This should flush more selectivly ... */
220 asmlinkage
int sys_cachectl(char *addr
, int nbytes
, int op
)
222 /* Not implemented yet. */
This page took 0.046698 seconds and 6 git commands to generate.