diff options
Diffstat (limited to 'arch/sh')
48 files changed, 147 insertions, 414 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 3e723aaa5e18..31d9db7913e4 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -13,6 +13,7 @@ config SUPERH | |||
13 | select HAVE_DMA_ATTRS | 13 | select HAVE_DMA_ATTRS |
14 | select HAVE_IRQ_WORK | 14 | select HAVE_IRQ_WORK |
15 | select HAVE_PERF_EVENTS | 15 | select HAVE_PERF_EVENTS |
16 | select ARCH_HAVE_CUSTOM_GPIO_H | ||
16 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) | 17 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) |
17 | select PERF_USE_VMALLOC | 18 | select PERF_USE_VMALLOC |
18 | select HAVE_KERNEL_GZIP | 19 | select HAVE_KERNEL_GZIP |
@@ -29,6 +30,10 @@ config SUPERH | |||
29 | select GENERIC_ATOMIC64 | 30 | select GENERIC_ATOMIC64 |
30 | select GENERIC_IRQ_SHOW | 31 | select GENERIC_IRQ_SHOW |
31 | select GENERIC_SMP_IDLE_THREAD | 32 | select GENERIC_SMP_IDLE_THREAD |
33 | select GENERIC_CLOCKEVENTS | ||
34 | select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST | ||
35 | select GENERIC_STRNCPY_FROM_USER | ||
36 | select GENERIC_STRNLEN_USER | ||
32 | help | 37 | help |
33 | The SuperH is a RISC processor targeted for use in embedded systems | 38 | The SuperH is a RISC processor targeted for use in embedded systems |
34 | and consumer electronics; it was also used in the Sega Dreamcast | 39 | and consumer electronics; it was also used in the Sega Dreamcast |
@@ -87,16 +92,6 @@ config GENERIC_GPIO | |||
87 | config GENERIC_CALIBRATE_DELAY | 92 | config GENERIC_CALIBRATE_DELAY |
88 | bool | 93 | bool |
89 | 94 | ||
90 | config GENERIC_CLOCKEVENTS | ||
91 | def_bool y | ||
92 | |||
93 | config GENERIC_CLOCKEVENTS_BROADCAST | ||
94 | bool | ||
95 | |||
96 | config GENERIC_CMOS_UPDATE | ||
97 | def_bool y | ||
98 | depends on SH_SH03 || SH_DREAMCAST | ||
99 | |||
100 | config GENERIC_LOCKBREAK | 95 | config GENERIC_LOCKBREAK |
101 | def_bool y | 96 | def_bool y |
102 | depends on SMP && PREEMPT | 97 | depends on SMP && PREEMPT |
@@ -611,8 +606,6 @@ config SH_CLK_CPG_LEGACY | |||
611 | !CPU_SUBTYPE_SH7734 && !CPU_SUBTYPE_SH7264 && \ | 606 | !CPU_SUBTYPE_SH7734 && !CPU_SUBTYPE_SH7264 && \ |
612 | !CPU_SUBTYPE_SH7269 | 607 | !CPU_SUBTYPE_SH7269 |
613 | 608 | ||
614 | source "kernel/time/Kconfig" | ||
615 | |||
616 | endmenu | 609 | endmenu |
617 | 610 | ||
618 | menu "CPU Frequency scaling" | 611 | menu "CPU Frequency scaling" |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 46edf070da1c..aed701c7b11b 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -9,6 +9,12 @@ | |||
9 | # License. See the file "COPYING" in the main directory of this archive | 9 | # License. See the file "COPYING" in the main directory of this archive |
10 | # for more details. | 10 | # for more details. |
11 | # | 11 | # |
12 | ifneq ($(SUBARCH),$(ARCH)) | ||
13 | ifeq ($(CROSS_COMPILE),) | ||
14 | CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-) | ||
15 | endif | ||
16 | endif | ||
17 | |||
12 | isa-y := any | 18 | isa-y := any |
13 | isa-$(CONFIG_SH_DSP) := sh | 19 | isa-$(CONFIG_SH_DSP) := sh |
14 | isa-$(CONFIG_CPU_SH2) := sh2 | 20 | isa-$(CONFIG_CPU_SH2) := sh2 |
@@ -106,19 +112,13 @@ LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \ | |||
106 | KBUILD_DEFCONFIG := cayman_defconfig | 112 | KBUILD_DEFCONFIG := cayman_defconfig |
107 | endif | 113 | endif |
108 | 114 | ||
109 | ifneq ($(SUBARCH),$(ARCH)) | ||
110 | ifeq ($(CROSS_COMPILE),) | ||
111 | CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-) | ||
112 | endif | ||
113 | endif | ||
114 | |||
115 | ifdef CONFIG_CPU_LITTLE_ENDIAN | 115 | ifdef CONFIG_CPU_LITTLE_ENDIAN |
116 | ld-bfd := elf32-$(UTS_MACHINE)-linux | 116 | ld-bfd := elf32-$(UTS_MACHINE)-linux |
117 | LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' --oformat $(ld-bfd) | 117 | LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd) |
118 | LDFLAGS += -EL | 118 | LDFLAGS += -EL |
119 | else | 119 | else |
120 | ld-bfd := elf32-$(UTS_MACHINE)big-linux | 120 | ld-bfd := elf32-$(UTS_MACHINE)big-linux |
121 | LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' --oformat $(ld-bfd) | 121 | LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd) |
122 | LDFLAGS += -EB | 122 | LDFLAGS += -EB |
123 | endif | 123 | endif |
124 | 124 | ||
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 34cd0c5ff2e1..a8a1ca741c85 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c | |||
@@ -188,7 +188,6 @@ static struct platform_nand_data migor_nand_flash_data = { | |||
188 | .partitions = migor_nand_flash_partitions, | 188 | .partitions = migor_nand_flash_partitions, |
189 | .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions), | 189 | .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions), |
190 | .chip_delay = 20, | 190 | .chip_delay = 20, |
191 | .part_probe_types = (const char *[]) { "cmdlinepart", NULL }, | ||
192 | }, | 191 | }, |
193 | .ctrl = { | 192 | .ctrl = { |
194 | .dev_ready = migor_nand_flash_ready, | 193 | .dev_ready = migor_nand_flash_ready, |
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 7beb42322f60..7b673ddcd555 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -1,5 +1,39 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | generic-y += bitsperlong.h | ||
4 | generic-y += cputime.h | ||
5 | generic-y += current.h | ||
6 | generic-y += delay.h | ||
7 | generic-y += div64.h | ||
8 | generic-y += emergency-restart.h | ||
9 | generic-y += errno.h | ||
10 | generic-y += fcntl.h | ||
11 | generic-y += ioctl.h | ||
12 | generic-y += ipcbuf.h | ||
13 | generic-y += irq_regs.h | ||
14 | generic-y += kvm_para.h | ||
15 | generic-y += local.h | ||
16 | generic-y += local64.h | ||
17 | generic-y += param.h | ||
18 | generic-y += parport.h | ||
19 | generic-y += percpu.h | ||
20 | generic-y += poll.h | ||
21 | generic-y += mman.h | ||
22 | generic-y += msgbuf.h | ||
23 | generic-y += resource.h | ||
24 | generic-y += scatterlist.h | ||
25 | generic-y += sembuf.h | ||
26 | generic-y += serial.h | ||
27 | generic-y += shmbuf.h | ||
28 | generic-y += siginfo.h | ||
29 | generic-y += sizes.h | ||
30 | generic-y += socket.h | ||
31 | generic-y += statfs.h | ||
32 | generic-y += termbits.h | ||
33 | generic-y += termios.h | ||
34 | generic-y += ucontext.h | ||
35 | generic-y += xor.h | ||
36 | |||
3 | header-y += cachectl.h | 37 | header-y += cachectl.h |
4 | header-y += cpu-features.h | 38 | header-y += cpu-features.h |
5 | header-y += hw_breakpoint.h | 39 | header-y += hw_breakpoint.h |
diff --git a/arch/sh/include/asm/bitsperlong.h b/arch/sh/include/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b2..000000000000 --- a/arch/sh/include/asm/bitsperlong.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/bitsperlong.h> | ||
diff --git a/arch/sh/include/asm/cputime.h b/arch/sh/include/asm/cputime.h deleted file mode 100644 index 6ca395d1393e..000000000000 --- a/arch/sh/include/asm/cputime.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __SH_CPUTIME_H | ||
2 | #define __SH_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __SH_CPUTIME_H */ | ||
diff --git a/arch/sh/include/asm/current.h b/arch/sh/include/asm/current.h deleted file mode 100644 index 4c51401b5537..000000000000 --- a/arch/sh/include/asm/current.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/current.h> | ||
diff --git a/arch/sh/include/asm/delay.h b/arch/sh/include/asm/delay.h deleted file mode 100644 index 9670e127b7b2..000000000000 --- a/arch/sh/include/asm/delay.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/delay.h> | ||
diff --git a/arch/sh/include/asm/div64.h b/arch/sh/include/asm/div64.h deleted file mode 100644 index 6cd978cefb28..000000000000 --- a/arch/sh/include/asm/div64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/div64.h> | ||
diff --git a/arch/sh/include/asm/emergency-restart.h b/arch/sh/include/asm/emergency-restart.h deleted file mode 100644 index 108d8c48e42e..000000000000 --- a/arch/sh/include/asm/emergency-restart.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _ASM_EMERGENCY_RESTART_H | ||
2 | #define _ASM_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/sh/include/asm/errno.h b/arch/sh/include/asm/errno.h deleted file mode 100644 index 51cf6f9cebb8..000000000000 --- a/arch/sh/include/asm/errno.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_ERRNO_H | ||
2 | #define __ASM_SH_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* __ASM_SH_ERRNO_H */ | ||
diff --git a/arch/sh/include/asm/fcntl.h b/arch/sh/include/asm/fcntl.h deleted file mode 100644 index 46ab12db5739..000000000000 --- a/arch/sh/include/asm/fcntl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/fcntl.h> | ||
diff --git a/arch/sh/include/asm/ioctl.h b/arch/sh/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe5..000000000000 --- a/arch/sh/include/asm/ioctl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ioctl.h> | ||
diff --git a/arch/sh/include/asm/ipcbuf.h b/arch/sh/include/asm/ipcbuf.h deleted file mode 100644 index 84c7e51cb6d0..000000000000 --- a/arch/sh/include/asm/ipcbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ipcbuf.h> | ||
diff --git a/arch/sh/include/asm/irq_regs.h b/arch/sh/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b70270..000000000000 --- a/arch/sh/include/asm/irq_regs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/sh/include/asm/local.h b/arch/sh/include/asm/local.h deleted file mode 100644 index 9ed9b9cb459a..000000000000 --- a/arch/sh/include/asm/local.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef __ASM_SH_LOCAL_H | ||
2 | #define __ASM_SH_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* __ASM_SH_LOCAL_H */ | ||
7 | |||
diff --git a/arch/sh/include/asm/local64.h b/arch/sh/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239..000000000000 --- a/arch/sh/include/asm/local64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/local64.h> | ||
diff --git a/arch/sh/include/asm/mman.h b/arch/sh/include/asm/mman.h deleted file mode 100644 index 8eebf89f5ab1..000000000000 --- a/arch/sh/include/asm/mman.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/mman.h> | ||
diff --git a/arch/sh/include/asm/msgbuf.h b/arch/sh/include/asm/msgbuf.h deleted file mode 100644 index 809134c644a6..000000000000 --- a/arch/sh/include/asm/msgbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/msgbuf.h> | ||
diff --git a/arch/sh/include/asm/param.h b/arch/sh/include/asm/param.h deleted file mode 100644 index 965d45427975..000000000000 --- a/arch/sh/include/asm/param.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/param.h> | ||
diff --git a/arch/sh/include/asm/parport.h b/arch/sh/include/asm/parport.h deleted file mode 100644 index cf252af64590..000000000000 --- a/arch/sh/include/asm/parport.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/parport.h> | ||
diff --git a/arch/sh/include/asm/percpu.h b/arch/sh/include/asm/percpu.h deleted file mode 100644 index 4db4b39a4399..000000000000 --- a/arch/sh/include/asm/percpu.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ARCH_SH_PERCPU | ||
2 | #define __ARCH_SH_PERCPU | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ARCH_SH_PERCPU */ | ||
diff --git a/arch/sh/include/asm/poll.h b/arch/sh/include/asm/poll.h deleted file mode 100644 index c98509d3149e..000000000000 --- a/arch/sh/include/asm/poll.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/poll.h> | ||
diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h index abda58467ece..ba0bdc423b07 100644 --- a/arch/sh/include/asm/posix_types_32.h +++ b/arch/sh/include/asm/posix_types_32.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | typedef unsigned short __kernel_mode_t; | 4 | typedef unsigned short __kernel_mode_t; |
5 | #define __kernel_mode_t __kernel_mode_t | 5 | #define __kernel_mode_t __kernel_mode_t |
6 | typedef unsigned short __kernel_nlink_t; | ||
7 | #define __kernel_nlink_t __kernel_nlink_t | ||
8 | typedef unsigned short __kernel_ipc_pid_t; | 6 | typedef unsigned short __kernel_ipc_pid_t; |
9 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 7 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
10 | typedef unsigned short __kernel_uid_t; | 8 | typedef unsigned short __kernel_uid_t; |
diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h index fcda07b4a616..244f7e950e17 100644 --- a/arch/sh/include/asm/posix_types_64.h +++ b/arch/sh/include/asm/posix_types_64.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | typedef unsigned short __kernel_mode_t; | 4 | typedef unsigned short __kernel_mode_t; |
5 | #define __kernel_mode_t __kernel_mode_t | 5 | #define __kernel_mode_t __kernel_mode_t |
6 | typedef unsigned short __kernel_nlink_t; | ||
7 | #define __kernel_nlink_t __kernel_nlink_t | ||
8 | typedef unsigned short __kernel_ipc_pid_t; | 6 | typedef unsigned short __kernel_ipc_pid_t; |
9 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 7 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
10 | typedef unsigned short __kernel_uid_t; | 8 | typedef unsigned short __kernel_uid_t; |
diff --git a/arch/sh/include/asm/resource.h b/arch/sh/include/asm/resource.h deleted file mode 100644 index 9c2499a86ec0..000000000000 --- a/arch/sh/include/asm/resource.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_RESOURCE_H | ||
2 | #define __ASM_SH_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* __ASM_SH_RESOURCE_H */ | ||
diff --git a/arch/sh/include/asm/scatterlist.h b/arch/sh/include/asm/scatterlist.h deleted file mode 100644 index 98dfc3510f10..000000000000 --- a/arch/sh/include/asm/scatterlist.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SCATTERLIST_H | ||
2 | #define __ASM_SH_SCATTERLIST_H | ||
3 | |||
4 | #include <asm-generic/scatterlist.h> | ||
5 | |||
6 | #endif /* __ASM_SH_SCATTERLIST_H */ | ||
diff --git a/arch/sh/include/asm/sembuf.h b/arch/sh/include/asm/sembuf.h deleted file mode 100644 index 7673b83cfef7..000000000000 --- a/arch/sh/include/asm/sembuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sembuf.h> | ||
diff --git a/arch/sh/include/asm/serial.h b/arch/sh/include/asm/serial.h deleted file mode 100644 index a0cb0caff152..000000000000 --- a/arch/sh/include/asm/serial.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/serial.h> | ||
diff --git a/arch/sh/include/asm/shmbuf.h b/arch/sh/include/asm/shmbuf.h deleted file mode 100644 index 83c05fc2de38..000000000000 --- a/arch/sh/include/asm/shmbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/shmbuf.h> | ||
diff --git a/arch/sh/include/asm/siginfo.h b/arch/sh/include/asm/siginfo.h deleted file mode 100644 index 813040ed68a9..000000000000 --- a/arch/sh/include/asm/siginfo.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SIGINFO_H | ||
2 | #define __ASM_SH_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif /* __ASM_SH_SIGINFO_H */ | ||
diff --git a/arch/sh/include/asm/sizes.h b/arch/sh/include/asm/sizes.h deleted file mode 100644 index dd248c2e1085..000000000000 --- a/arch/sh/include/asm/sizes.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sizes.h> | ||
diff --git a/arch/sh/include/asm/socket.h b/arch/sh/include/asm/socket.h deleted file mode 100644 index 6b71384b9d8b..000000000000 --- a/arch/sh/include/asm/socket.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/socket.h> | ||
diff --git a/arch/sh/include/asm/statfs.h b/arch/sh/include/asm/statfs.h deleted file mode 100644 index 9202a023328f..000000000000 --- a/arch/sh/include/asm/statfs.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_STATFS_H | ||
2 | #define __ASM_SH_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* __ASM_SH_STATFS_H */ | ||
diff --git a/arch/sh/include/asm/termbits.h b/arch/sh/include/asm/termbits.h deleted file mode 100644 index 3935b106de79..000000000000 --- a/arch/sh/include/asm/termbits.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termbits.h> | ||
diff --git a/arch/sh/include/asm/termios.h b/arch/sh/include/asm/termios.h deleted file mode 100644 index 280d78a9d966..000000000000 --- a/arch/sh/include/asm/termios.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termios.h> | ||
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index 0c04ffc4f12c..bc13b57cdc83 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -169,7 +169,7 @@ static inline void set_restore_sigmask(void) | |||
169 | { | 169 | { |
170 | struct thread_info *ti = current_thread_info(); | 170 | struct thread_info *ti = current_thread_info(); |
171 | ti->status |= TS_RESTORE_SIGMASK; | 171 | ti->status |= TS_RESTORE_SIGMASK; |
172 | set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); | 172 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); |
173 | } | 173 | } |
174 | 174 | ||
175 | #define TI_FLAG_FAULT_CODE_SHIFT 24 | 175 | #define TI_FLAG_FAULT_CODE_SHIFT 24 |
@@ -189,6 +189,23 @@ static inline unsigned int get_thread_fault_code(void) | |||
189 | struct thread_info *ti = current_thread_info(); | 189 | struct thread_info *ti = current_thread_info(); |
190 | return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; | 190 | return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; |
191 | } | 191 | } |
192 | |||
193 | static inline void clear_restore_sigmask(void) | ||
194 | { | ||
195 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
196 | } | ||
197 | static inline bool test_restore_sigmask(void) | ||
198 | { | ||
199 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
200 | } | ||
201 | static inline bool test_and_clear_restore_sigmask(void) | ||
202 | { | ||
203 | struct thread_info *ti = current_thread_info(); | ||
204 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
205 | return false; | ||
206 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
207 | return true; | ||
208 | } | ||
192 | #endif /* !__ASSEMBLY__ */ | 209 | #endif /* !__ASSEMBLY__ */ |
193 | 210 | ||
194 | #endif /* __KERNEL__ */ | 211 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 050f221fa898..8698a80ed00c 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
@@ -25,6 +25,8 @@ | |||
25 | (__chk_user_ptr(addr), \ | 25 | (__chk_user_ptr(addr), \ |
26 | __access_ok((unsigned long __force)(addr), (size))) | 26 | __access_ok((unsigned long __force)(addr), (size))) |
27 | 27 | ||
28 | #define user_addr_max() (current_thread_info()->addr_limit.seg) | ||
29 | |||
28 | /* | 30 | /* |
29 | * Uh, these should become the main single-value transfer routines ... | 31 | * Uh, these should become the main single-value transfer routines ... |
30 | * They automatically use the right size if we just have the right | 32 | * They automatically use the right size if we just have the right |
@@ -100,6 +102,11 @@ struct __large_struct { unsigned long buf[100]; }; | |||
100 | # include "uaccess_64.h" | 102 | # include "uaccess_64.h" |
101 | #endif | 103 | #endif |
102 | 104 | ||
105 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | ||
106 | |||
107 | extern __must_check long strlen_user(const char __user *str); | ||
108 | extern __must_check long strnlen_user(const char __user *str, long n); | ||
109 | |||
103 | /* Generic arbitrary sized copy. */ | 110 | /* Generic arbitrary sized copy. */ |
104 | /* Return the number of bytes NOT copied */ | 111 | /* Return the number of bytes NOT copied */ |
105 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); | 112 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); |
@@ -137,37 +144,6 @@ __kernel_size_t __clear_user(void *addr, __kernel_size_t size); | |||
137 | __cl_size; \ | 144 | __cl_size; \ |
138 | }) | 145 | }) |
139 | 146 | ||
140 | /** | ||
141 | * strncpy_from_user: - Copy a NUL terminated string from userspace. | ||
142 | * @dst: Destination address, in kernel space. This buffer must be at | ||
143 | * least @count bytes long. | ||
144 | * @src: Source address, in user space. | ||
145 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
146 | * | ||
147 | * Copies a NUL-terminated string from userspace to kernel space. | ||
148 | * | ||
149 | * On success, returns the length of the string (not including the trailing | ||
150 | * NUL). | ||
151 | * | ||
152 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
153 | * copied). | ||
154 | * | ||
155 | * If @count is smaller than the length of the string, copies @count bytes | ||
156 | * and returns @count. | ||
157 | */ | ||
158 | #define strncpy_from_user(dest,src,count) \ | ||
159 | ({ \ | ||
160 | unsigned long __sfu_src = (unsigned long)(src); \ | ||
161 | int __sfu_count = (int)(count); \ | ||
162 | long __sfu_res = -EFAULT; \ | ||
163 | \ | ||
164 | if (__access_ok(__sfu_src, __sfu_count)) \ | ||
165 | __sfu_res = __strncpy_from_user((unsigned long)(dest), \ | ||
166 | __sfu_src, __sfu_count); \ | ||
167 | \ | ||
168 | __sfu_res; \ | ||
169 | }) | ||
170 | |||
171 | static inline unsigned long | 147 | static inline unsigned long |
172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 148 | copy_from_user(void *to, const void __user *from, unsigned long n) |
173 | { | 149 | { |
@@ -192,43 +168,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
192 | return __copy_size; | 168 | return __copy_size; |
193 | } | 169 | } |
194 | 170 | ||
195 | /** | ||
196 | * strnlen_user: - Get the size of a string in user space. | ||
197 | * @s: The string to measure. | ||
198 | * @n: The maximum valid length | ||
199 | * | ||
200 | * Context: User context only. This function may sleep. | ||
201 | * | ||
202 | * Get the size of a NUL-terminated string in user space. | ||
203 | * | ||
204 | * Returns the size of the string INCLUDING the terminating NUL. | ||
205 | * On exception, returns 0. | ||
206 | * If the string is too long, returns a value greater than @n. | ||
207 | */ | ||
208 | static inline long strnlen_user(const char __user *s, long n) | ||
209 | { | ||
210 | if (!__addr_ok(s)) | ||
211 | return 0; | ||
212 | else | ||
213 | return __strnlen_user(s, n); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * strlen_user: - Get the size of a string in user space. | ||
218 | * @str: The string to measure. | ||
219 | * | ||
220 | * Context: User context only. This function may sleep. | ||
221 | * | ||
222 | * Get the size of a NUL-terminated string in user space. | ||
223 | * | ||
224 | * Returns the size of the string INCLUDING the terminating NUL. | ||
225 | * On exception, returns 0. | ||
226 | * | ||
227 | * If there is a limit on the length of a valid string, you may wish to | ||
228 | * consider using strnlen_user() instead. | ||
229 | */ | ||
230 | #define strlen_user(str) strnlen_user(str, ~0UL >> 1) | ||
231 | |||
232 | /* | 171 | /* |
233 | * The exception table consists of pairs of addresses: the first is the | 172 | * The exception table consists of pairs of addresses: the first is the |
234 | * address of an instruction that is allowed to fault, and the second is | 173 | * address of an instruction that is allowed to fault, and the second is |
diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index ae0d24f6653f..c0de7ee35ab7 100644 --- a/arch/sh/include/asm/uaccess_32.h +++ b/arch/sh/include/asm/uaccess_32.h | |||
@@ -170,79 +170,4 @@ __asm__ __volatile__( \ | |||
170 | 170 | ||
171 | extern void __put_user_unknown(void); | 171 | extern void __put_user_unknown(void); |
172 | 172 | ||
173 | static inline int | ||
174 | __strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count) | ||
175 | { | ||
176 | __kernel_size_t res; | ||
177 | unsigned long __dummy, _d, _s, _c; | ||
178 | |||
179 | __asm__ __volatile__( | ||
180 | "9:\n" | ||
181 | "mov.b @%2+, %1\n\t" | ||
182 | "cmp/eq #0, %1\n\t" | ||
183 | "bt/s 2f\n" | ||
184 | "1:\n" | ||
185 | "mov.b %1, @%3\n\t" | ||
186 | "dt %4\n\t" | ||
187 | "bf/s 9b\n\t" | ||
188 | " add #1, %3\n\t" | ||
189 | "2:\n\t" | ||
190 | "sub %4, %0\n" | ||
191 | "3:\n" | ||
192 | ".section .fixup,\"ax\"\n" | ||
193 | "4:\n\t" | ||
194 | "mov.l 5f, %1\n\t" | ||
195 | "jmp @%1\n\t" | ||
196 | " mov %9, %0\n\t" | ||
197 | ".balign 4\n" | ||
198 | "5: .long 3b\n" | ||
199 | ".previous\n" | ||
200 | ".section __ex_table,\"a\"\n" | ||
201 | " .balign 4\n" | ||
202 | " .long 9b,4b\n" | ||
203 | ".previous" | ||
204 | : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c) | ||
205 | : "0" (__count), "2" (__src), "3" (__dest), "4" (__count), | ||
206 | "i" (-EFAULT) | ||
207 | : "memory", "t"); | ||
208 | |||
209 | return res; | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Return the size of a string (including the ending 0 even when we have | ||
214 | * exceeded the maximum string length). | ||
215 | */ | ||
216 | static inline long __strnlen_user(const char __user *__s, long __n) | ||
217 | { | ||
218 | unsigned long res; | ||
219 | unsigned long __dummy; | ||
220 | |||
221 | __asm__ __volatile__( | ||
222 | "1:\t" | ||
223 | "mov.b @(%0,%3), %1\n\t" | ||
224 | "cmp/eq %4, %0\n\t" | ||
225 | "bt/s 2f\n\t" | ||
226 | " add #1, %0\n\t" | ||
227 | "tst %1, %1\n\t" | ||
228 | "bf 1b\n\t" | ||
229 | "2:\n" | ||
230 | ".section .fixup,\"ax\"\n" | ||
231 | "3:\n\t" | ||
232 | "mov.l 4f, %1\n\t" | ||
233 | "jmp @%1\n\t" | ||
234 | " mov #0, %0\n" | ||
235 | ".balign 4\n" | ||
236 | "4: .long 2b\n" | ||
237 | ".previous\n" | ||
238 | ".section __ex_table,\"a\"\n" | ||
239 | " .balign 4\n" | ||
240 | " .long 1b,3b\n" | ||
241 | ".previous" | ||
242 | : "=z" (res), "=&r" (__dummy) | ||
243 | : "0" (0), "r" (__s), "r" (__n) | ||
244 | : "t"); | ||
245 | return res; | ||
246 | } | ||
247 | |||
248 | #endif /* __ASM_SH_UACCESS_32_H */ | 173 | #endif /* __ASM_SH_UACCESS_32_H */ |
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index 56fd20b8cdcc..2e07e0f40c6a 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h | |||
@@ -84,8 +84,4 @@ extern long __put_user_asm_l(void *, long); | |||
84 | extern long __put_user_asm_q(void *, long); | 84 | extern long __put_user_asm_q(void *, long); |
85 | extern void __put_user_unknown(void); | 85 | extern void __put_user_unknown(void); |
86 | 86 | ||
87 | extern long __strnlen_user(const char *__s, long __n); | ||
88 | extern int __strncpy_from_user(unsigned long __dest, | ||
89 | unsigned long __user __src, int __count); | ||
90 | |||
91 | #endif /* __ASM_SH_UACCESS_64_H */ | 87 | #endif /* __ASM_SH_UACCESS_64_H */ |
diff --git a/arch/sh/include/asm/ucontext.h b/arch/sh/include/asm/ucontext.h deleted file mode 100644 index 9bc07b9f30fb..000000000000 --- a/arch/sh/include/asm/ucontext.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ucontext.h> | ||
diff --git a/arch/sh/include/asm/word-at-a-time.h b/arch/sh/include/asm/word-at-a-time.h new file mode 100644 index 000000000000..6e38953ff7fd --- /dev/null +++ b/arch/sh/include/asm/word-at-a-time.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __ASM_SH_WORD_AT_A_TIME_H | ||
2 | #define __ASM_SH_WORD_AT_A_TIME_H | ||
3 | |||
4 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
5 | # include <asm-generic/word-at-a-time.h> | ||
6 | #else | ||
7 | /* | ||
8 | * Little-endian version cribbed from x86. | ||
9 | */ | ||
10 | struct word_at_a_time { | ||
11 | const unsigned long one_bits, high_bits; | ||
12 | }; | ||
13 | |||
14 | #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) } | ||
15 | |||
16 | /* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | ||
17 | static inline long count_masked_bytes(long mask) | ||
18 | { | ||
19 | /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | ||
20 | long a = (0x0ff0001+mask) >> 23; | ||
21 | /* Fix the 1 for 00 case */ | ||
22 | return a & mask; | ||
23 | } | ||
24 | |||
25 | /* Return nonzero if it has a zero */ | ||
26 | static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c) | ||
27 | { | ||
28 | unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits; | ||
29 | *bits = mask; | ||
30 | return mask; | ||
31 | } | ||
32 | |||
33 | static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c) | ||
34 | { | ||
35 | return bits; | ||
36 | } | ||
37 | |||
38 | static inline unsigned long create_zero_mask(unsigned long bits) | ||
39 | { | ||
40 | bits = (bits - 1) & ~bits; | ||
41 | return bits >> 7; | ||
42 | } | ||
43 | |||
44 | /* The mask we created is directly usable as a bytemask */ | ||
45 | #define zero_bytemask(mask) (mask) | ||
46 | |||
47 | static inline unsigned long find_zero(unsigned long mask) | ||
48 | { | ||
49 | return count_masked_bytes(mask); | ||
50 | } | ||
51 | #endif | ||
52 | |||
53 | #endif | ||
diff --git a/arch/sh/include/asm/xor.h b/arch/sh/include/asm/xor.h deleted file mode 100644 index c82eb12a5b18..000000000000 --- a/arch/sh/include/asm/xor.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/xor.h> | ||
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S index ff1f0e6e9bec..b7cf6a547f11 100644 --- a/arch/sh/kernel/cpu/sh5/entry.S +++ b/arch/sh/kernel/cpu/sh5/entry.S | |||
@@ -1569,86 +1569,6 @@ ___clear_user_exit: | |||
1569 | #endif /* CONFIG_MMU */ | 1569 | #endif /* CONFIG_MMU */ |
1570 | 1570 | ||
1571 | /* | 1571 | /* |
1572 | * int __strncpy_from_user(unsigned long __dest, unsigned long __src, | ||
1573 | * int __count) | ||
1574 | * | ||
1575 | * Inputs: | ||
1576 | * (r2) target address | ||
1577 | * (r3) source address | ||
1578 | * (r4) maximum size in bytes | ||
1579 | * | ||
1580 | * Ouputs: | ||
1581 | * (*r2) copied data | ||
1582 | * (r2) -EFAULT (in case of faulting) | ||
1583 | * copied data (otherwise) | ||
1584 | */ | ||
1585 | .global __strncpy_from_user | ||
1586 | __strncpy_from_user: | ||
1587 | pta ___strncpy_from_user1, tr0 | ||
1588 | pta ___strncpy_from_user_done, tr1 | ||
1589 | or r4, ZERO, r5 /* r5 = original count */ | ||
1590 | beq/u r4, r63, tr1 /* early exit if r4==0 */ | ||
1591 | movi -(EFAULT), r6 /* r6 = reply, no real fixup */ | ||
1592 | or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */ | ||
1593 | |||
1594 | ___strncpy_from_user1: | ||
1595 | ld.b r3, 0, r7 /* Fault address: only in reading */ | ||
1596 | st.b r2, 0, r7 | ||
1597 | addi r2, 1, r2 | ||
1598 | addi r3, 1, r3 | ||
1599 | beq/u ZERO, r7, tr1 | ||
1600 | addi r4, -1, r4 /* return real number of copied bytes */ | ||
1601 | bne/l ZERO, r4, tr0 | ||
1602 | |||
1603 | ___strncpy_from_user_done: | ||
1604 | sub r5, r4, r6 /* If done, return copied */ | ||
1605 | |||
1606 | ___strncpy_from_user_exit: | ||
1607 | or r6, ZERO, r2 | ||
1608 | ptabs LINK, tr0 | ||
1609 | blink tr0, ZERO | ||
1610 | |||
1611 | /* | ||
1612 | * extern long __strnlen_user(const char *__s, long __n) | ||
1613 | * | ||
1614 | * Inputs: | ||
1615 | * (r2) source address | ||
1616 | * (r3) source size in bytes | ||
1617 | * | ||
1618 | * Ouputs: | ||
1619 | * (r2) -EFAULT (in case of faulting) | ||
1620 | * string length (otherwise) | ||
1621 | */ | ||
1622 | .global __strnlen_user | ||
1623 | __strnlen_user: | ||
1624 | pta ___strnlen_user_set_reply, tr0 | ||
1625 | pta ___strnlen_user1, tr1 | ||
1626 | or ZERO, ZERO, r5 /* r5 = counter */ | ||
1627 | movi -(EFAULT), r6 /* r6 = reply, no real fixup */ | ||
1628 | or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */ | ||
1629 | beq r3, ZERO, tr0 | ||
1630 | |||
1631 | ___strnlen_user1: | ||
1632 | ldx.b r2, r5, r7 /* Fault address: only in reading */ | ||
1633 | addi r3, -1, r3 /* No real fixup */ | ||
1634 | addi r5, 1, r5 | ||
1635 | beq r3, ZERO, tr0 | ||
1636 | bne r7, ZERO, tr1 | ||
1637 | ! The line below used to be active. This meant led to a junk byte lying between each pair | ||
1638 | ! of entries in the argv & envp structures in memory. Whilst the program saw the right data | ||
1639 | ! via the argv and envp arguments to main, it meant the 'flat' representation visible through | ||
1640 | ! /proc/$pid/cmdline was corrupt, causing trouble with ps, for example. | ||
1641 | ! addi r5, 1, r5 /* Include '\0' */ | ||
1642 | |||
1643 | ___strnlen_user_set_reply: | ||
1644 | or r5, ZERO, r6 /* If done, return counter */ | ||
1645 | |||
1646 | ___strnlen_user_exit: | ||
1647 | or r6, ZERO, r2 | ||
1648 | ptabs LINK, tr0 | ||
1649 | blink tr0, ZERO | ||
1650 | |||
1651 | /* | ||
1652 | * extern long __get_user_asm_?(void *val, long addr) | 1572 | * extern long __get_user_asm_?(void *val, long addr) |
1653 | * | 1573 | * |
1654 | * Inputs: | 1574 | * Inputs: |
@@ -1982,8 +1902,6 @@ asm_uaccess_start: | |||
1982 | .long ___copy_user2, ___copy_user_exit | 1902 | .long ___copy_user2, ___copy_user_exit |
1983 | .long ___clear_user1, ___clear_user_exit | 1903 | .long ___clear_user1, ___clear_user_exit |
1984 | #endif | 1904 | #endif |
1985 | .long ___strncpy_from_user1, ___strncpy_from_user_exit | ||
1986 | .long ___strnlen_user1, ___strnlen_user_exit | ||
1987 | .long ___get_user_asm_b1, ___get_user_asm_b_exit | 1905 | .long ___get_user_asm_b1, ___get_user_asm_b_exit |
1988 | .long ___get_user_asm_w1, ___get_user_asm_w_exit | 1906 | .long ___get_user_asm_w1, ___get_user_asm_w_exit |
1989 | .long ___get_user_asm_l1, ___get_user_asm_l_exit | 1907 | .long ___get_user_asm_l1, ___get_user_asm_l_exit |
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c index 45afa5c51f67..26a0774f5272 100644 --- a/arch/sh/kernel/sh_ksyms_64.c +++ b/arch/sh/kernel/sh_ksyms_64.c | |||
@@ -32,8 +32,6 @@ EXPORT_SYMBOL(__get_user_asm_b); | |||
32 | EXPORT_SYMBOL(__get_user_asm_w); | 32 | EXPORT_SYMBOL(__get_user_asm_w); |
33 | EXPORT_SYMBOL(__get_user_asm_l); | 33 | EXPORT_SYMBOL(__get_user_asm_l); |
34 | EXPORT_SYMBOL(__get_user_asm_q); | 34 | EXPORT_SYMBOL(__get_user_asm_q); |
35 | EXPORT_SYMBOL(__strnlen_user); | ||
36 | EXPORT_SYMBOL(__strncpy_from_user); | ||
37 | EXPORT_SYMBOL(__clear_user); | 35 | EXPORT_SYMBOL(__clear_user); |
38 | EXPORT_SYMBOL(copy_page); | 36 | EXPORT_SYMBOL(copy_page); |
39 | EXPORT_SYMBOL(__copy_user); | 37 | EXPORT_SYMBOL(__copy_user); |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index cb4172c8af7d..d6b7b6154f87 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <asm/syscalls.h> | 32 | #include <asm/syscalls.h> |
33 | #include <asm/fpu.h> | 33 | #include <asm/fpu.h> |
34 | 34 | ||
35 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
36 | |||
37 | struct fdpic_func_descriptor { | 35 | struct fdpic_func_descriptor { |
38 | unsigned long text; | 36 | unsigned long text; |
39 | unsigned long GOT; | 37 | unsigned long GOT; |
@@ -226,7 +224,6 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, | |||
226 | sizeof(frame->extramask)))) | 224 | sizeof(frame->extramask)))) |
227 | goto badframe; | 225 | goto badframe; |
228 | 226 | ||
229 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
230 | set_current_blocked(&set); | 227 | set_current_blocked(&set); |
231 | 228 | ||
232 | if (restore_sigcontext(regs, &frame->sc, &r0)) | 229 | if (restore_sigcontext(regs, &frame->sc, &r0)) |
@@ -256,7 +253,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, | |||
256 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 253 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
257 | goto badframe; | 254 | goto badframe; |
258 | 255 | ||
259 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
260 | set_current_blocked(&set); | 256 | set_current_blocked(&set); |
261 | 257 | ||
262 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) | 258 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) |
@@ -522,10 +518,11 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
522 | /* | 518 | /* |
523 | * OK, we're invoking a handler | 519 | * OK, we're invoking a handler |
524 | */ | 520 | */ |
525 | static int | 521 | static void |
526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 522 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
527 | sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0) | 523 | struct pt_regs *regs, unsigned int save_r0) |
528 | { | 524 | { |
525 | sigset_t *oldset = sigmask_to_save(); | ||
529 | int ret; | 526 | int ret; |
530 | 527 | ||
531 | /* Set up the stack frame */ | 528 | /* Set up the stack frame */ |
@@ -534,10 +531,10 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
534 | else | 531 | else |
535 | ret = setup_frame(sig, ka, oldset, regs); | 532 | ret = setup_frame(sig, ka, oldset, regs); |
536 | 533 | ||
537 | if (ret == 0) | 534 | if (ret) |
538 | block_sigmask(ka, sig); | 535 | return; |
539 | 536 | signal_delivered(sig, info, ka, regs, | |
540 | return ret; | 537 | test_thread_flag(TIF_SINGLESTEP)); |
541 | } | 538 | } |
542 | 539 | ||
543 | /* | 540 | /* |
@@ -554,7 +551,6 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
554 | siginfo_t info; | 551 | siginfo_t info; |
555 | int signr; | 552 | int signr; |
556 | struct k_sigaction ka; | 553 | struct k_sigaction ka; |
557 | sigset_t *oldset; | ||
558 | 554 | ||
559 | /* | 555 | /* |
560 | * We want the common case to go fast, which | 556 | * We want the common case to go fast, which |
@@ -565,30 +561,12 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
565 | if (!user_mode(regs)) | 561 | if (!user_mode(regs)) |
566 | return; | 562 | return; |
567 | 563 | ||
568 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
569 | oldset = ¤t->saved_sigmask; | ||
570 | else | ||
571 | oldset = ¤t->blocked; | ||
572 | |||
573 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 564 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
574 | if (signr > 0) { | 565 | if (signr > 0) { |
575 | handle_syscall_restart(save_r0, regs, &ka.sa); | 566 | handle_syscall_restart(save_r0, regs, &ka.sa); |
576 | 567 | ||
577 | /* Whee! Actually deliver the signal. */ | 568 | /* Whee! Actually deliver the signal. */ |
578 | if (handle_signal(signr, &ka, &info, oldset, | 569 | handle_signal(signr, &ka, &info, regs, save_r0); |
579 | regs, save_r0) == 0) { | ||
580 | /* | ||
581 | * A signal was successfully delivered; the saved | ||
582 | * sigmask will have been stored in the signal frame, | ||
583 | * and will be restored by sigreturn, so we can simply | ||
584 | * clear the TS_RESTORE_SIGMASK flag | ||
585 | */ | ||
586 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
587 | |||
588 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
589 | test_thread_flag(TIF_SINGLESTEP)); | ||
590 | } | ||
591 | |||
592 | return; | 570 | return; |
593 | } | 571 | } |
594 | 572 | ||
@@ -610,10 +588,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
610 | * If there's no signal to deliver, we just put the saved sigmask | 588 | * If there's no signal to deliver, we just put the saved sigmask |
611 | * back. | 589 | * back. |
612 | */ | 590 | */ |
613 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 591 | restore_saved_sigmask(); |
614 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
615 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
616 | } | ||
617 | } | 592 | } |
618 | 593 | ||
619 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, | 594 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, |
@@ -626,7 +601,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, | |||
626 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 601 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
627 | clear_thread_flag(TIF_NOTIFY_RESUME); | 602 | clear_thread_flag(TIF_NOTIFY_RESUME); |
628 | tracehook_notify_resume(regs); | 603 | tracehook_notify_resume(regs); |
629 | if (current->replacement_session_keyring) | ||
630 | key_replace_session_keyring(); | ||
631 | } | 604 | } |
632 | } | 605 | } |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index b589a354c069..6b5b3dfe886b 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -41,11 +41,9 @@ | |||
41 | 41 | ||
42 | #define DEBUG_SIG 0 | 42 | #define DEBUG_SIG 0 |
43 | 43 | ||
44 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 44 | static void |
45 | |||
46 | static int | ||
47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 45 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
48 | sigset_t *oldset, struct pt_regs * regs); | 46 | struct pt_regs * regs); |
49 | 47 | ||
50 | static inline void | 48 | static inline void |
51 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | 49 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) |
@@ -88,7 +86,6 @@ static void do_signal(struct pt_regs *regs) | |||
88 | siginfo_t info; | 86 | siginfo_t info; |
89 | int signr; | 87 | int signr; |
90 | struct k_sigaction ka; | 88 | struct k_sigaction ka; |
91 | sigset_t *oldset; | ||
92 | 89 | ||
93 | /* | 90 | /* |
94 | * We want the common case to go fast, which | 91 | * We want the common case to go fast, which |
@@ -99,28 +96,13 @@ static void do_signal(struct pt_regs *regs) | |||
99 | if (!user_mode(regs)) | 96 | if (!user_mode(regs)) |
100 | return; | 97 | return; |
101 | 98 | ||
102 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
103 | oldset = ¤t->saved_sigmask; | ||
104 | else | ||
105 | oldset = ¤t->blocked; | ||
106 | |||
107 | signr = get_signal_to_deliver(&info, &ka, regs, 0); | 99 | signr = get_signal_to_deliver(&info, &ka, regs, 0); |
108 | if (signr > 0) { | 100 | if (signr > 0) { |
109 | handle_syscall_restart(regs, &ka.sa); | 101 | handle_syscall_restart(regs, &ka.sa); |
110 | 102 | ||
111 | /* Whee! Actually deliver the signal. */ | 103 | /* Whee! Actually deliver the signal. */ |
112 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 104 | handle_signal(signr, &info, &ka, regs); |
113 | /* | 105 | return; |
114 | * If a signal was successfully delivered, the | ||
115 | * saved sigmask is in its frame, and we can | ||
116 | * clear the TS_RESTORE_SIGMASK flag. | ||
117 | */ | ||
118 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
119 | |||
120 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
121 | test_thread_flag(TIF_SINGLESTEP)); | ||
122 | return; | ||
123 | } | ||
124 | } | 106 | } |
125 | 107 | ||
126 | /* Did we come from a system call? */ | 108 | /* Did we come from a system call? */ |
@@ -143,12 +125,7 @@ static void do_signal(struct pt_regs *regs) | |||
143 | } | 125 | } |
144 | 126 | ||
145 | /* No signal to deliver -- put the saved sigmask back */ | 127 | /* No signal to deliver -- put the saved sigmask back */ |
146 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 128 | restore_saved_sigmask(); |
147 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
148 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
149 | } | ||
150 | |||
151 | return; | ||
152 | } | 129 | } |
153 | 130 | ||
154 | /* | 131 | /* |
@@ -351,7 +328,6 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3, | |||
351 | sizeof(frame->extramask)))) | 328 | sizeof(frame->extramask)))) |
352 | goto badframe; | 329 | goto badframe; |
353 | 330 | ||
354 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
355 | set_current_blocked(&set); | 331 | set_current_blocked(&set); |
356 | 332 | ||
357 | if (restore_sigcontext(regs, &frame->sc, &ret)) | 333 | if (restore_sigcontext(regs, &frame->sc, &ret)) |
@@ -384,7 +360,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3, | |||
384 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 360 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
385 | goto badframe; | 361 | goto badframe; |
386 | 362 | ||
387 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
388 | set_current_blocked(&set); | 363 | set_current_blocked(&set); |
389 | 364 | ||
390 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret)) | 365 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret)) |
@@ -659,10 +634,11 @@ give_sigsegv: | |||
659 | /* | 634 | /* |
660 | * OK, we're invoking a handler | 635 | * OK, we're invoking a handler |
661 | */ | 636 | */ |
662 | static int | 637 | static void |
663 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 638 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
664 | sigset_t *oldset, struct pt_regs * regs) | 639 | struct pt_regs * regs) |
665 | { | 640 | { |
641 | sigset_t *oldset = sigmask_to_save(); | ||
666 | int ret; | 642 | int ret; |
667 | 643 | ||
668 | /* Set up the stack frame */ | 644 | /* Set up the stack frame */ |
@@ -671,10 +647,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
671 | else | 647 | else |
672 | ret = setup_frame(sig, ka, oldset, regs); | 648 | ret = setup_frame(sig, ka, oldset, regs); |
673 | 649 | ||
674 | if (ret == 0) | 650 | if (ret) |
675 | block_sigmask(ka, sig); | 651 | return; |
676 | 652 | ||
677 | return ret; | 653 | signal_delivered(sig, info, ka, regs, |
654 | test_thread_flag(TIF_SINGLESTEP)); | ||
678 | } | 655 | } |
679 | 656 | ||
680 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 657 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |
@@ -685,7 +662,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info | |||
685 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 662 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
686 | clear_thread_flag(TIF_NOTIFY_RESUME); | 663 | clear_thread_flag(TIF_NOTIFY_RESUME); |
687 | tracehook_notify_resume(regs); | 664 | tracehook_notify_resume(regs); |
688 | if (current->replacement_session_keyring) | ||
689 | key_replace_session_keyring(); | ||
690 | } | 665 | } |
691 | } | 666 | } |
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index b86e9ca79455..2062aa88af41 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -123,7 +123,6 @@ void native_play_dead(void) | |||
123 | int __cpu_disable(void) | 123 | int __cpu_disable(void) |
124 | { | 124 | { |
125 | unsigned int cpu = smp_processor_id(); | 125 | unsigned int cpu = smp_processor_id(); |
126 | struct task_struct *p; | ||
127 | int ret; | 126 | int ret; |
128 | 127 | ||
129 | ret = mp_ops->cpu_disable(cpu); | 128 | ret = mp_ops->cpu_disable(cpu); |
@@ -153,11 +152,7 @@ int __cpu_disable(void) | |||
153 | flush_cache_all(); | 152 | flush_cache_all(); |
154 | local_flush_tlb_all(); | 153 | local_flush_tlb_all(); |
155 | 154 | ||
156 | read_lock(&tasklist_lock); | 155 | clear_tasks_mm_cpumask(cpu); |
157 | for_each_process(p) | ||
158 | if (p->mm) | ||
159 | cpumask_clear_cpu(cpu, mm_cpumask(p->mm)); | ||
160 | read_unlock(&tasklist_lock); | ||
161 | 156 | ||
162 | return 0; | 157 | return 0; |
163 | } | 158 | } |