1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/m32r/kernel/sys_m32r.c
5 * This file contains various random system calls that
6 * have a non-standard calling sequence on the Linux/M32R platform.
8 * Taken from i386 version.
11 #include <linux/errno.h>
12 #include <linux/sched.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/syscalls.h>
21 #include <linux/mman.h>
22 #include <linux/file.h>
23 #include <linux/utsname.h>
24 #include <linux/ipc.h>
26 #include <linux/uaccess.h>
27 #include <asm/cachectl.h>
28 #include <asm/cacheflush.h>
29 #include <asm/syscall.h>
30 #include <asm/unistd.h>
33 * sys_tas() - test-and-set
35 asmlinkage
int sys_tas(int __user
*addr
)
39 if (!access_ok(VERIFY_WRITE
, addr
, sizeof (int)))
43 * oldval = *addr; *addr = 1;
45 __asm__
__volatile__ (
46 DCACHE_CLEAR("%0", "r4", "%1")
49 " lock %0, @%1 -> unlock %2, @%1\n"
52 * The m32r processor can accept interrupts only
53 * at the 32-bit instruction boundary.
54 * So, in the above code, the "unlock" instruction
55 * can be executed continuously after the "lock"
56 * instruction execution without any interruptions.
58 ".section .fixup,\"ax\"\n"
61 " seth r14, #high(2b)\n"
62 " or3 r14, r14, #low(2b)\n"
65 ".section __ex_table,\"a\"\n"
70 : "r" (addr
), "r" (1), "i"(-EFAULT
)
72 #ifdef CONFIG_CHIP_M32700_TS1
74 #endif /* CONFIG_CHIP_M32700_TS1 */
80 asmlinkage
int sys_cacheflush(void *addr
, int bytes
, int cache
)
82 /* This should flush more selectively ... */
87 asmlinkage
int sys_cachectl(char *addr
, int nbytes
, int op
)
89 /* Not implemented yet. */