summaryrefslogtreecommitdiff
path: root/arch/m32r/lib/usercopy.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-02 20:20:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-02 20:20:12 -0700
commitf5a8eb632b562bd9c16c389f5db3a5260fba4157 (patch)
tree82687234d772ff8f72a31e598fe16553885c56c9 /arch/m32r/lib/usercopy.c
parentc9297d284126b80c9cfd72c690e0da531c99fc48 (diff)
parentdd3b8c329aa270027fba61a02a12600972dc3983 (diff)
Merge tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pul removal of obsolete architecture ports from Arnd Bergmann: "This removes the entire architecture code for blackfin, cris, frv, m32r, metag, mn10300, score, and tile, including the associated device drivers. I have been working with the (former) maintainers for each one to ensure that my interpretation was right and the code is definitely unused in mainline kernels. Many had fond memories of working on the respective ports to start with and getting them included in upstream, but also saw no point in keeping the port alive without any users. In the end, it seems that while the eight architectures are extremely different, they all suffered the same fate: There was one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem, which was more costly than licensing newer off-the-shelf CPU cores from a third party (typically ARM, MIPS, or RISC-V). It seems that all the SoC product lines are still around, but have not used the custom CPU architectures for several years at this point. In contrast, CPU instruction sets that remain popular and have actively maintained kernel ports tend to all be used across multiple licensees. [ See the new nds32 port merged in the previous commit for the next generation of "one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem" - Linus ] The removal came out of a discussion that is now documented at https://lwn.net/Articles/748074/. Unlike the original plans, I'm not marking any ports as deprecated but remove them all at once after I made sure that they are all unused. Some architectures (notably tile, mn10300, and blackfin) are still being shipped in products with old kernels, but those products will never be updated to newer kernel releases. After this series, we still have a few architectures without mainline gcc support: - unicore32 and hexagon both have very outdated gcc releases, but the maintainers promised to work on providing something newer. At least in case of hexagon, this will only be llvm, not gcc. - openrisc, risc-v and nds32 are still in the process of finishing their support or getting it added to mainline gcc in the first place. They all have patched gcc-7.3 ports that work to some degree, but complete upstream support won't happen before gcc-8.1. Csky posted their first kernel patch set last week, their situation will be similar [ Palmer Dabbelt points out that RISC-V support is in mainline gcc since gcc-7, although gcc-7.3.0 is the recommended minimum - Linus ]" This really says it all: 2498 files changed, 95 insertions(+), 467668 deletions(-) * tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (74 commits) MAINTAINERS: UNICORE32: Change email account staging: iio: remove iio-trig-bfin-timer driver tty: hvc: remove tile driver tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers serial: remove tile uart driver serial: remove m32r_sio driver serial: remove blackfin drivers serial: remove cris/etrax uart drivers usb: Remove Blackfin references in USB support usb: isp1362: remove blackfin arch glue usb: musb: remove blackfin port usb: host: remove tilegx platform glue pwm: remove pwm-bfin driver i2c: remove bfin-twi driver spi: remove blackfin related host drivers watchdog: remove bfin_wdt driver can: remove bfin_can driver mmc: remove bfin_sdh driver input: misc: remove blackfin rotary driver input: keyboard: remove bf54x driver ...
Diffstat (limited to 'arch/m32r/lib/usercopy.c')
-rw-r--r--arch/m32r/lib/usercopy.c362
1 files changed, 0 insertions, 362 deletions
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c
deleted file mode 100644
index 0892a4341b3a4..0000000000000
--- a/arch/m32r/lib/usercopy.c
+++ /dev/null
@@ -1,362 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * User address space access functions.
- * The non inlined parts of asm-m32r/uaccess.h are here.
- *
- * Copyright 1997 Andi Kleen <ak@muc.de>
- * Copyright 1997 Linus Torvalds
- * Copyright 2001, 2002, 2004 Hirokazu Takata
- */
-#include <linux/prefetch.h>
-#include <linux/string.h>
-#include <linux/thread_info.h>
-#include <linux/uaccess.h>
-
-/*
- * Copy a null terminated string from userspace.
- */
-
-#ifdef CONFIG_ISA_DUAL_ISSUE
-
-#define __do_strncpy_from_user(dst,src,count,res) \
-do { \
- int __d0, __d1, __d2; \
- __asm__ __volatile__( \
- " beqz %1, 2f\n" \
- " .fillinsn\n" \
- "0: ldb r14, @%3 || addi %3, #1\n" \
- " stb r14, @%4 || addi %4, #1\n" \
- " beqz r14, 1f\n" \
- " addi %1, #-1\n" \
- " bnez %1, 0b\n" \
- " .fillinsn\n" \
- "1: sub %0, %1\n" \
- " .fillinsn\n" \
- "2:\n" \
- ".section .fixup,\"ax\"\n" \
- " .balign 4\n" \
- "3: seth r14, #high(2b)\n" \
- " or3 r14, r14, #low(2b)\n" \
- " jmp r14 || ldi %0, #%5\n" \
- ".previous\n" \
- ".section __ex_table,\"a\"\n" \
- " .balign 4\n" \
- " .long 0b,3b\n" \
- ".previous" \
- : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
- "=&r" (__d2) \
- : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
- "4"(dst) \
- : "r14", "cbit", "memory"); \
-} while (0)
-
-#else /* not CONFIG_ISA_DUAL_ISSUE */
-
-#define __do_strncpy_from_user(dst,src,count,res) \
-do { \
- int __d0, __d1, __d2; \
- __asm__ __volatile__( \
- " beqz %1, 2f\n" \
- " .fillinsn\n" \
- "0: ldb r14, @%3\n" \
- " stb r14, @%4\n" \
- " addi %3, #1\n" \
- " addi %4, #1\n" \
- " beqz r14, 1f\n" \
- " addi %1, #-1\n" \
- " bnez %1, 0b\n" \
- " .fillinsn\n" \
- "1: sub %0, %1\n" \
- " .fillinsn\n" \
- "2:\n" \
- ".section .fixup,\"ax\"\n" \
- " .balign 4\n" \
- "3: ldi %0, #%5\n" \
- " seth r14, #high(2b)\n" \
- " or3 r14, r14, #low(2b)\n" \
- " jmp r14\n" \
- ".previous\n" \
- ".section __ex_table,\"a\"\n" \
- " .balign 4\n" \
- " .long 0b,3b\n" \
- ".previous" \
- : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
- "=&r" (__d2) \
- : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
- "4"(dst) \
- : "r14", "cbit", "memory"); \
-} while (0)
-
-#endif /* CONFIG_ISA_DUAL_ISSUE */
-
-long
-strncpy_from_user(char *dst, const char __user *src, long count)
-{
- long res = -EFAULT;
- if (access_ok(VERIFY_READ, src, 1))
- __do_strncpy_from_user(dst, src, count, res);
- return res;
-}
-
-
-/*
- * Zero Userspace
- */
-
-#ifdef CONFIG_ISA_DUAL_ISSUE
-
-#define __do_clear_user(addr,size) \
-do { \
- int __dst, __c; \
- __asm__ __volatile__( \
- " beqz %1, 9f\n" \
- " and3 r14, %0, #3\n" \
- " bnez r14, 2f\n" \
- " and3 r14, %1, #3\n" \
- " bnez r14, 2f\n" \
- " and3 %1, %1, #3\n" \
- " beqz %2, 2f\n" \
- " addi %0, #-4\n" \
- " .fillinsn\n" \
- "0: ; word clear \n" \
- " st %6, @+%0 || addi %2, #-1\n" \
- " bnez %2, 0b\n" \
- " beqz %1, 9f\n" \
- " .fillinsn\n" \
- "2: ; byte clear \n" \
- " stb %6, @%0 || addi %1, #-1\n" \
- " addi %0, #1\n" \
- " bnez %1, 2b\n" \
- " .fillinsn\n" \
- "9:\n" \
- ".section .fixup,\"ax\"\n" \
- " .balign 4\n" \
- "4: slli %2, #2\n" \
- " seth r14, #high(9b)\n" \
- " or3 r14, r14, #low(9b)\n" \
- " jmp r14 || add %1, %2\n" \
- ".previous\n" \
- ".section __ex_table,\"a\"\n" \
- " .balign 4\n" \
- " .long 0b,4b\n" \
- " .long 2b,9b\n" \
- ".previous\n" \
- : "=&r"(__dst), "=&r"(size), "=&r"(__c) \
- : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \
- : "r14", "cbit", "memory"); \
-} while (0)
-
-#else /* not CONFIG_ISA_DUAL_ISSUE */
-
-#define __do_clear_user(addr,size) \
-do { \
- int __dst, __c; \
- __asm__ __volatile__( \
- " beqz %1, 9f\n" \
- " and3 r14, %0, #3\n" \
- " bnez r14, 2f\n" \
- " and3 r14, %1, #3\n" \
- " bnez r14, 2f\n" \
- " and3 %1, %1, #3\n" \
- " beqz %2, 2f\n" \
- " addi %0, #-4\n" \
- " .fillinsn\n" \
- "0: st %6, @+%0 ; word clear \n" \
- " addi %2, #-1\n" \
- " bnez %2, 0b\n" \
- " beqz %1, 9f\n" \
- " .fillinsn\n" \
- "2: stb %6, @%0 ; byte clear \n" \
- " addi %1, #-1\n" \
- " addi %0, #1\n" \
- " bnez %1, 2b\n" \
- " .fillinsn\n" \
- "9:\n" \
- ".section .fixup,\"ax\"\n" \
- " .balign 4\n" \
- "4: slli %2, #2\n" \
- " add %1, %2\n" \
- " seth r14, #high(9b)\n" \
- " or3 r14, r14, #low(9b)\n" \
- " jmp r14\n" \
- ".previous\n" \
- ".section __ex_table,\"a\"\n" \
- " .balign 4\n" \
- " .long 0b,4b\n" \
- " .long 2b,9b\n" \
- ".previous\n" \
- : "=&r"(__dst), "=&r"(size), "=&r"(__c) \
- : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \
- : "r14", "cbit", "memory"); \
-} while (0)
-
-#endif /* not CONFIG_ISA_DUAL_ISSUE */
-
-unsigned long
-clear_user(void __user *to, unsigned long n)
-{
- if (access_ok(VERIFY_WRITE, to, n))
- __do_clear_user(to, n);
- return n;
-}
-
-unsigned long
-__clear_user(void __user *to, unsigned long n)
-{
- __do_clear_user(to, n);
- return n;
-}
-
-/*
- * Return the size of a string (including the ending 0)
- *
- * Return 0 on exception, a value greater than N if too long
- */
-
-#ifdef CONFIG_ISA_DUAL_ISSUE
-
-long strnlen_user(const char __user *s, long n)
-{
- unsigned long mask = -__addr_ok(s);
- unsigned long res;
-
- __asm__ __volatile__(
- " and %0, %5 || mv r1, %1\n"
- " beqz %0, strnlen_exit\n"
- " and3 r0, %1, #3\n"
- " bnez r0, strnlen_byte_loop\n"
- " cmpui %0, #4\n"
- " bc strnlen_byte_loop\n"
- "strnlen_word_loop:\n"
- "0: ld r0, @%1+\n"
- " pcmpbz r0\n"
- " bc strnlen_last_bytes_fixup\n"
- " addi %0, #-4\n"
- " beqz %0, strnlen_exit\n"
- " bgtz %0, strnlen_word_loop\n"
- "strnlen_last_bytes:\n"
- " mv %0, %4\n"
- "strnlen_last_bytes_fixup:\n"
- " addi %1, #-4\n"
- "strnlen_byte_loop:\n"
- "1: ldb r0, @%1 || addi %0, #-1\n"
- " beqz r0, strnlen_exit\n"
- " addi %1, #1\n"
- " bnez %0, strnlen_byte_loop\n"
- "strnlen_exit:\n"
- " sub %1, r1\n"
- " add3 %0, %1, #1\n"
- " .fillinsn\n"
- "9:\n"
- ".section .fixup,\"ax\"\n"
- " .balign 4\n"
- "4: addi %1, #-4\n"
- " .fillinsn\n"
- "5: seth r1, #high(9b)\n"
- " or3 r1, r1, #low(9b)\n"
- " jmp r1 || ldi %0, #0\n"
- ".previous\n"
- ".section __ex_table,\"a\"\n"
- " .balign 4\n"
- " .long 0b,4b\n"
- " .long 1b,5b\n"
- ".previous"
- : "=&r" (res), "=r" (s)
- : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101)
- : "r0", "r1", "cbit");
-
- /* NOTE: strnlen_user() algorithm:
- * {
- * char *p;
- * for (p = s; n-- && *p != '\0'; ++p)
- * ;
- * return p - s + 1;
- * }
- */
-
- /* NOTE: If a null char. exists, return 0.
- * if ((x - 0x01010101) & ~x & 0x80808080)\n"
- * return 0;\n"
- */
-
- return res & mask;
-}
-
-#else /* not CONFIG_ISA_DUAL_ISSUE */
-
-long strnlen_user(const char __user *s, long n)
-{
- unsigned long mask = -__addr_ok(s);
- unsigned long res;
-
- __asm__ __volatile__(
- " and %0, %5\n"
- " mv r1, %1\n"
- " beqz %0, strnlen_exit\n"
- " and3 r0, %1, #3\n"
- " bnez r0, strnlen_byte_loop\n"
- " cmpui %0, #4\n"
- " bc strnlen_byte_loop\n"
- " sll3 r3, %6, #7\n"
- "strnlen_word_loop:\n"
- "0: ld r0, @%1+\n"
- " not r2, r0\n"
- " sub r0, %6\n"
- " and r2, r3\n"
- " and r2, r0\n"
- " bnez r2, strnlen_last_bytes_fixup\n"
- " addi %0, #-4\n"
- " beqz %0, strnlen_exit\n"
- " bgtz %0, strnlen_word_loop\n"
- "strnlen_last_bytes:\n"
- " mv %0, %4\n"
- "strnlen_last_bytes_fixup:\n"
- " addi %1, #-4\n"
- "strnlen_byte_loop:\n"
- "1: ldb r0, @%1\n"
- " addi %0, #-1\n"
- " beqz r0, strnlen_exit\n"
- " addi %1, #1\n"
- " bnez %0, strnlen_byte_loop\n"
- "strnlen_exit:\n"
- " sub %1, r1\n"
- " add3 %0, %1, #1\n"
- " .fillinsn\n"
- "9:\n"
- ".section .fixup,\"ax\"\n"
- " .balign 4\n"
- "4: addi %1, #-4\n"
- " .fillinsn\n"
- "5: ldi %0, #0\n"
- " seth r1, #high(9b)\n"
- " or3 r1, r1, #low(9b)\n"
- " jmp r1\n"
- ".previous\n"
- ".section __ex_table,\"a\"\n"
- " .balign 4\n"
- " .long 0b,4b\n"
- " .long 1b,5b\n"
- ".previous"
- : "=&r" (res), "=r" (s)
- : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101)
- : "r0", "r1", "r2", "r3", "cbit");
-
- /* NOTE: strnlen_user() algorithm:
- * {
- * char *p;
- * for (p = s; n-- && *p != '\0'; ++p)
- * ;
- * return p - s + 1;
- * }
- */
-
- /* NOTE: If a null char. exists, return 0.
- * if ((x - 0x01010101) & ~x & 0x80808080)\n"
- * return 0;\n"
- */
-
- return res & mask;
-}
-
-#endif /* CONFIG_ISA_DUAL_ISSUE */
-