diff options
30 files changed, 64 insertions, 117 deletions
diff --git a/arch/alpha/include/asm/segment.h b/arch/alpha/include/asm/segment.h deleted file mode 100644 index 0453d97daae7..000000000000 --- a/arch/alpha/include/asm/segment.h +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | #ifndef __ALPHA_SEGMENT_H | ||
| 2 | #define __ALPHA_SEGMENT_H | ||
| 3 | |||
| 4 | /* Only here because we have some old header files that expect it.. */ | ||
| 5 | |||
| 6 | #endif | ||
diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c index 4dbd4e415041..bbbd34586de0 100644 --- a/arch/alpha/kernel/smc37c669.c +++ b/arch/alpha/kernel/smc37c669.c | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | #include <asm/hwrpb.h> | 11 | #include <asm/hwrpb.h> |
| 12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
| 13 | #include <asm/segment.h> | ||
| 14 | 13 | ||
| 15 | #if 0 | 14 | #if 0 |
| 16 | # define DBG_DEVS(args) printk args | 15 | # define DBG_DEVS(args) printk args |
diff --git a/arch/alpha/kernel/smc37c93x.c b/arch/alpha/kernel/smc37c93x.c index 733f08966fd2..71cd7aca38ce 100644 --- a/arch/alpha/kernel/smc37c93x.c +++ b/arch/alpha/kernel/smc37c93x.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | #include <asm/hwrpb.h> | 12 | #include <asm/hwrpb.h> |
| 13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
| 14 | #include <asm/segment.h> | ||
| 15 | 14 | ||
| 16 | #define SMC_DEBUG 0 | 15 | #define SMC_DEBUG 0 |
| 17 | 16 | ||
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index eabc3efa6c6d..526418543379 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h | |||
| @@ -742,6 +742,7 @@ extern long arc_strnlen_user_noinline(const char __user *src, long n); | |||
| 742 | 742 | ||
| 743 | #endif | 743 | #endif |
| 744 | 744 | ||
| 745 | #include <asm/segment.h> | ||
| 745 | #include <asm-generic/uaccess.h> | 746 | #include <asm-generic/uaccess.h> |
| 746 | 747 | ||
| 747 | #endif | 748 | #endif |
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index 0b2ecc98e086..60de9d13181a 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild | |||
| @@ -14,7 +14,6 @@ generic-y += msi.h | |||
| 14 | generic-y += parport.h | 14 | generic-y += parport.h |
| 15 | generic-y += preempt.h | 15 | generic-y += preempt.h |
| 16 | generic-y += seccomp.h | 16 | generic-y += seccomp.h |
| 17 | generic-y += segment.h | ||
| 18 | generic-y += serial.h | 17 | generic-y += serial.h |
| 19 | generic-y += simd.h | 18 | generic-y += simd.h |
| 20 | generic-y += trace_clock.h | 19 | generic-y += trace_clock.h |
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 9e977dedf193..1de6e05ce48b 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild | |||
| @@ -17,7 +17,6 @@ generic-y += mmiowb.h | |||
| 17 | generic-y += msi.h | 17 | generic-y += msi.h |
| 18 | generic-y += qrwlock.h | 18 | generic-y += qrwlock.h |
| 19 | generic-y += qspinlock.h | 19 | generic-y += qspinlock.h |
| 20 | generic-y += segment.h | ||
| 21 | generic-y += serial.h | 20 | generic-y += serial.h |
| 22 | generic-y += set_memory.h | 21 | generic-y += set_memory.h |
| 23 | generic-y += switch_to.h | 22 | generic-y += switch_to.h |
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 6b168d32fbff..2162eb32dcec 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
| @@ -30,7 +30,6 @@ generic-y += pci.h | |||
| 30 | generic-y += percpu.h | 30 | generic-y += percpu.h |
| 31 | generic-y += pgalloc.h | 31 | generic-y += pgalloc.h |
| 32 | generic-y += preempt.h | 32 | generic-y += preempt.h |
| 33 | generic-y += segment.h | ||
| 34 | generic-y += serial.h | 33 | generic-y += serial.h |
| 35 | generic-y += shmparam.h | 34 | generic-y += shmparam.h |
| 36 | generic-y += tlbflush.h | 35 | generic-y += tlbflush.h |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 61c01db6c292..ecfc4b4b6373 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
| @@ -23,6 +23,7 @@ config H8300 | |||
| 23 | select HAVE_ARCH_KGDB | 23 | select HAVE_ARCH_KGDB |
| 24 | select HAVE_ARCH_HASH | 24 | select HAVE_ARCH_HASH |
| 25 | select CPU_NO_EFFICIENT_FFS | 25 | select CPU_NO_EFFICIENT_FFS |
| 26 | select UACCESS_MEMCPY | ||
| 26 | 27 | ||
| 27 | config CPU_BIG_ENDIAN | 28 | config CPU_BIG_ENDIAN |
| 28 | def_bool y | 29 | def_bool y |
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index f2e22058e488..79cd1e605ec4 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
| @@ -47,6 +47,7 @@ generic-y += timex.h | |||
| 47 | generic-y += tlbflush.h | 47 | generic-y += tlbflush.h |
| 48 | generic-y += topology.h | 48 | generic-y += topology.h |
| 49 | generic-y += trace_clock.h | 49 | generic-y += trace_clock.h |
| 50 | generic-y += uaccess.h | ||
| 50 | generic-y += unaligned.h | 51 | generic-y += unaligned.h |
| 51 | generic-y += vga.h | 52 | generic-y += vga.h |
| 52 | generic-y += word-at-a-time.h | 53 | generic-y += word-at-a-time.h |
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h deleted file mode 100644 index bc8031949d07..000000000000 --- a/arch/h8300/include/asm/uaccess.h +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_UACCESS_H | ||
| 3 | #define _ASM_UACCESS_H | ||
| 4 | |||
| 5 | #include <linux/string.h> | ||
| 6 | |||
| 7 | static inline __must_check unsigned long | ||
| 8 | raw_copy_from_user(void *to, const void __user * from, unsigned long n) | ||
| 9 | { | ||
| 10 | if (__builtin_constant_p(n)) { | ||
| 11 | switch(n) { | ||
| 12 | case 1: | ||
| 13 | *(u8 *)to = *(u8 __force *)from; | ||
| 14 | return 0; | ||
| 15 | case 2: | ||
| 16 | *(u16 *)to = *(u16 __force *)from; | ||
| 17 | return 0; | ||
| 18 | case 4: | ||
| 19 | *(u32 *)to = *(u32 __force *)from; | ||
| 20 | return 0; | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | memcpy(to, (const void __force *)from, n); | ||
| 25 | return 0; | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline __must_check unsigned long | ||
| 29 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
| 30 | { | ||
| 31 | if (__builtin_constant_p(n)) { | ||
| 32 | switch(n) { | ||
| 33 | case 1: | ||
| 34 | *(u8 __force *)to = *(u8 *)from; | ||
| 35 | return 0; | ||
| 36 | case 2: | ||
| 37 | *(u16 __force *)to = *(u16 *)from; | ||
| 38 | return 0; | ||
| 39 | case 4: | ||
| 40 | *(u32 __force *)to = *(u32 *)from; | ||
| 41 | return 0; | ||
| 42 | default: | ||
| 43 | break; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | memcpy((void __force *)to, from, n); | ||
| 48 | return 0; | ||
| 49 | } | ||
| 50 | #define INLINE_COPY_FROM_USER | ||
| 51 | #define INLINE_COPY_TO_USER | ||
| 52 | |||
| 53 | #include <asm-generic/uaccess.h> | ||
| 54 | |||
| 55 | #endif | ||
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index 4a3d72f76ea2..84bb1ed1b931 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild | |||
| @@ -29,7 +29,6 @@ generic-y += pci.h | |||
| 29 | generic-y += percpu.h | 29 | generic-y += percpu.h |
| 30 | generic-y += preempt.h | 30 | generic-y += preempt.h |
| 31 | generic-y += sections.h | 31 | generic-y += sections.h |
| 32 | generic-y += segment.h | ||
| 33 | generic-y += serial.h | 32 | generic-y += serial.h |
| 34 | generic-y += shmparam.h | 33 | generic-y += shmparam.h |
| 35 | generic-y += topology.h | 34 | generic-y += topology.h |
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h index a30e58d5f351..7a34092e8b58 100644 --- a/arch/hexagon/include/asm/uaccess.h +++ b/arch/hexagon/include/asm/uaccess.h | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | * User space memory access functions | 24 | * User space memory access functions |
| 25 | */ | 25 | */ |
| 26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
| 27 | #include <asm/segment.h> | ||
| 28 | #include <asm/sections.h> | 27 | #include <asm/sections.h> |
| 29 | 28 | ||
| 30 | /* | 29 | /* |
diff --git a/arch/ia64/include/asm/segment.h b/arch/ia64/include/asm/segment.h deleted file mode 100644 index b89e2b3d648f..000000000000 --- a/arch/ia64/include/asm/segment.h +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | #ifndef _ASM_IA64_SEGMENT_H | ||
| 2 | #define _ASM_IA64_SEGMENT_H | ||
| 3 | |||
| 4 | /* Only here because we have some old header files that expect it.. */ | ||
| 5 | |||
| 6 | #endif /* _ASM_IA64_SEGMENT_H */ | ||
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild index 87b86cdf126a..a03cd4e24f37 100644 --- a/arch/mips/include/asm/Kbuild +++ b/arch/mips/include/asm/Kbuild | |||
| @@ -19,7 +19,6 @@ generic-y += preempt.h | |||
| 19 | generic-y += qrwlock.h | 19 | generic-y += qrwlock.h |
| 20 | generic-y += qspinlock.h | 20 | generic-y += qspinlock.h |
| 21 | generic-y += sections.h | 21 | generic-y += sections.h |
| 22 | generic-y += segment.h | ||
| 23 | generic-y += trace_clock.h | 22 | generic-y += trace_clock.h |
| 24 | generic-y += unaligned.h | 23 | generic-y += unaligned.h |
| 25 | generic-y += user.h | 24 | generic-y += user.h |
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild index f67a327777b5..d8ce778d0640 100644 --- a/arch/nds32/include/asm/Kbuild +++ b/arch/nds32/include/asm/Kbuild | |||
| @@ -37,7 +37,6 @@ generic-y += pci.h | |||
| 37 | generic-y += percpu.h | 37 | generic-y += percpu.h |
| 38 | generic-y += preempt.h | 38 | generic-y += preempt.h |
| 39 | generic-y += sections.h | 39 | generic-y += sections.h |
| 40 | generic-y += segment.h | ||
| 41 | generic-y += serial.h | 40 | generic-y += serial.h |
| 42 | generic-y += switch_to.h | 41 | generic-y += switch_to.h |
| 43 | generic-y += timex.h | 42 | generic-y += timex.h |
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild index d7ef3512504a..a8ffdd007f6c 100644 --- a/arch/nios2/include/asm/Kbuild +++ b/arch/nios2/include/asm/Kbuild | |||
| @@ -33,7 +33,6 @@ generic-y += pci.h | |||
| 33 | generic-y += percpu.h | 33 | generic-y += percpu.h |
| 34 | generic-y += preempt.h | 34 | generic-y += preempt.h |
| 35 | generic-y += sections.h | 35 | generic-y += sections.h |
| 36 | generic-y += segment.h | ||
| 37 | generic-y += serial.h | 36 | generic-y += serial.h |
| 38 | generic-y += spinlock.h | 37 | generic-y += spinlock.h |
| 39 | generic-y += topology.h | 38 | generic-y += topology.h |
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index 1919cc5e0f11..164be10062bc 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild | |||
| @@ -34,7 +34,6 @@ generic-y += qspinlock.h | |||
| 34 | generic-y += qrwlock_types.h | 34 | generic-y += qrwlock_types.h |
| 35 | generic-y += qrwlock.h | 35 | generic-y += qrwlock.h |
| 36 | generic-y += sections.h | 36 | generic-y += sections.h |
| 37 | generic-y += segment.h | ||
| 38 | generic-y += shmparam.h | 37 | generic-y += shmparam.h |
| 39 | generic-y += switch_to.h | 38 | generic-y += switch_to.h |
| 40 | generic-y += topology.h | 39 | generic-y += topology.h |
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c index eb97a8e7c8aa..e8fb2a764f46 100644 --- a/arch/openrisc/kernel/ptrace.c +++ b/arch/openrisc/kernel/ptrace.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <linux/elf.h> | 30 | #include <linux/elf.h> |
| 31 | 31 | ||
| 32 | #include <asm/thread_info.h> | 32 | #include <asm/thread_info.h> |
| 33 | #include <asm/segment.h> | ||
| 34 | #include <asm/page.h> | 33 | #include <asm/page.h> |
| 35 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
| 36 | 35 | ||
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index c605bdad1746..17c00d06d91b 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include <linux/device.h> | 39 | #include <linux/device.h> |
| 40 | 40 | ||
| 41 | #include <asm/sections.h> | 41 | #include <asm/sections.h> |
| 42 | #include <asm/segment.h> | ||
| 43 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
| 44 | #include <asm/types.h> | 43 | #include <asm/types.h> |
| 45 | #include <asm/setup.h> | 44 | #include <asm/setup.h> |
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index d8981cbb852a..6ed7293ef007 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <linux/kallsyms.h> | 35 | #include <linux/kallsyms.h> |
| 36 | #include <linux/uaccess.h> | 36 | #include <linux/uaccess.h> |
| 37 | 37 | ||
| 38 | #include <asm/segment.h> | ||
| 39 | #include <asm/io.h> | 38 | #include <asm/io.h> |
| 40 | #include <asm/pgtable.h> | 39 | #include <asm/pgtable.h> |
| 41 | #include <asm/unwinder.h> | 40 | #include <asm/unwinder.h> |
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index abe87e54e231..e63cb4a91a3e 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <linux/blkdev.h> /* for initrd_* */ | 32 | #include <linux/blkdev.h> /* for initrd_* */ |
| 33 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
| 34 | 34 | ||
| 35 | #include <asm/segment.h> | ||
| 36 | #include <asm/pgalloc.h> | 35 | #include <asm/pgalloc.h> |
| 37 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
| 38 | #include <asm/dma.h> | 37 | #include <asm/dma.h> |
diff --git a/arch/openrisc/mm/tlb.c b/arch/openrisc/mm/tlb.c index 6c253a2e86bc..7f9f50161dfe 100644 --- a/arch/openrisc/mm/tlb.c +++ b/arch/openrisc/mm/tlb.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
| 27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
| 28 | 28 | ||
| 29 | #include <asm/segment.h> | ||
| 30 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
| 31 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
| 32 | #include <asm/mmu_context.h> | 31 | #include <asm/mmu_context.h> |
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild index ed2d8cc94909..005ee8ad0446 100644 --- a/arch/parisc/include/asm/Kbuild +++ b/arch/parisc/include/asm/Kbuild | |||
| @@ -19,7 +19,6 @@ generic-y += mmiowb.h | |||
| 19 | generic-y += percpu.h | 19 | generic-y += percpu.h |
| 20 | generic-y += preempt.h | 20 | generic-y += preempt.h |
| 21 | generic-y += seccomp.h | 21 | generic-y += seccomp.h |
| 22 | generic-y += segment.h | ||
| 23 | generic-y += trace_clock.h | 22 | generic-y += trace_clock.h |
| 24 | generic-y += user.h | 23 | generic-y += user.h |
| 25 | generic-y += vga.h | 24 | generic-y += vga.h |
diff --git a/arch/s390/include/asm/segment.h b/arch/s390/include/asm/segment.h deleted file mode 100644 index 97a0582b8d0f..000000000000 --- a/arch/s390/include/asm/segment.h +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_SEGMENT_H | ||
| 3 | #define _ASM_SEGMENT_H | ||
| 4 | |||
| 5 | #endif | ||
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index cd3df5514552..ad71132374f0 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/seccomp.h> | 24 | #include <linux/seccomp.h> |
| 25 | #include <linux/compat.h> | 25 | #include <linux/compat.h> |
| 26 | #include <trace/syscall.h> | 26 | #include <trace/syscall.h> |
| 27 | #include <asm/segment.h> | ||
| 28 | #include <asm/page.h> | 27 | #include <asm/page.h> |
| 29 | #include <asm/pgtable.h> | 28 | #include <asm/pgtable.h> |
| 30 | #include <asm/pgalloc.h> | 29 | #include <asm/pgalloc.h> |
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index c93dc6478cb2..5fe2426bb7a5 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
| @@ -28,7 +28,6 @@ generic-y += parport.h | |||
| 28 | generic-y += percpu.h | 28 | generic-y += percpu.h |
| 29 | generic-y += preempt.h | 29 | generic-y += preempt.h |
| 30 | generic-y += sections.h | 30 | generic-y += sections.h |
| 31 | generic-y += segment.h | ||
| 32 | generic-y += serial.h | 31 | generic-y += serial.h |
| 33 | generic-y += shmparam.h | 32 | generic-y += shmparam.h |
| 34 | generic-y += syscalls.h | 33 | generic-y += syscalls.h |
diff --git a/arch/xtensa/include/asm/segment.h b/arch/xtensa/include/asm/segment.h deleted file mode 100644 index 98964ad15ca2..000000000000 --- a/arch/xtensa/include/asm/segment.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-xtensa/segment.h | ||
| 3 | * | ||
| 4 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 5 | * License. See the file "COPYING" in the main directory of this archive | ||
| 6 | * for more details. | ||
| 7 | * | ||
| 8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef _XTENSA_SEGMENT_H | ||
| 12 | #define _XTENSA_SEGMENT_H | ||
| 13 | |||
| 14 | #include <linux/uaccess.h> | ||
| 15 | |||
| 16 | #endif /* _XTENSA_SEGEMENT_H */ | ||
diff --git a/include/asm-generic/segment.h b/include/asm-generic/segment.h deleted file mode 100644 index 5580eace622c..000000000000 --- a/include/asm-generic/segment.h +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | #ifndef __ASM_GENERIC_SEGMENT_H | ||
| 2 | #define __ASM_GENERIC_SEGMENT_H | ||
| 3 | /* | ||
| 4 | * Only here because we have some old header files that expect it... | ||
| 5 | * | ||
| 6 | * New architectures probably don't want to have their own version. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #endif /* __ASM_GENERIC_SEGMENT_H */ | ||
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index b3d2241e03f8..e935318804f8 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h | |||
| @@ -9,7 +9,63 @@ | |||
| 9 | */ | 9 | */ |
| 10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
| 11 | 11 | ||
| 12 | #include <asm/segment.h> | 12 | #ifdef CONFIG_UACCESS_MEMCPY |
| 13 | static inline __must_check unsigned long | ||
| 14 | raw_copy_from_user(void *to, const void __user * from, unsigned long n) | ||
| 15 | { | ||
| 16 | if (__builtin_constant_p(n)) { | ||
| 17 | switch(n) { | ||
| 18 | case 1: | ||
| 19 | *(u8 *)to = *(u8 __force *)from; | ||
| 20 | return 0; | ||
| 21 | case 2: | ||
| 22 | *(u16 *)to = *(u16 __force *)from; | ||
| 23 | return 0; | ||
| 24 | case 4: | ||
| 25 | *(u32 *)to = *(u32 __force *)from; | ||
| 26 | return 0; | ||
| 27 | #ifdef CONFIG_64BIT | ||
| 28 | case 8: | ||
| 29 | *(u64 *)to = *(u64 __force *)from; | ||
| 30 | return 0; | ||
| 31 | #endif | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | memcpy(to, (const void __force *)from, n); | ||
| 36 | return 0; | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline __must_check unsigned long | ||
| 40 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
| 41 | { | ||
| 42 | if (__builtin_constant_p(n)) { | ||
| 43 | switch(n) { | ||
| 44 | case 1: | ||
| 45 | *(u8 __force *)to = *(u8 *)from; | ||
| 46 | return 0; | ||
| 47 | case 2: | ||
| 48 | *(u16 __force *)to = *(u16 *)from; | ||
| 49 | return 0; | ||
| 50 | case 4: | ||
| 51 | *(u32 __force *)to = *(u32 *)from; | ||
| 52 | return 0; | ||
| 53 | #ifdef CONFIG_64BIT | ||
| 54 | case 8: | ||
| 55 | *(u64 __force *)to = *(u64 *)from; | ||
| 56 | return 0; | ||
| 57 | #endif | ||
| 58 | default: | ||
| 59 | break; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | memcpy((void __force *)to, from, n); | ||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | #define INLINE_COPY_FROM_USER | ||
| 67 | #define INLINE_COPY_TO_USER | ||
| 68 | #endif /* CONFIG_UACCESS_MEMCPY */ | ||
| 13 | 69 | ||
| 14 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | 70 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) |
| 15 | 71 | ||
diff --git a/lib/Kconfig b/lib/Kconfig index 3577609b61be..8d9239a4156c 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -601,6 +601,10 @@ config ARCH_NO_SG_CHAIN | |||
| 601 | config ARCH_HAS_PMEM_API | 601 | config ARCH_HAS_PMEM_API |
| 602 | bool | 602 | bool |
| 603 | 603 | ||
| 604 | # use memcpy to implement user copies for nommu architectures | ||
| 605 | config UACCESS_MEMCPY | ||
| 606 | bool | ||
| 607 | |||
| 604 | config ARCH_HAS_UACCESS_FLUSHCACHE | 608 | config ARCH_HAS_UACCESS_FLUSHCACHE |
| 605 | bool | 609 | bool |
| 606 | 610 | ||
