aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
commit9977d9b379cb77e0f67bd6f4563618106e58e11d (patch)
tree0191accfddf578edb52c69c933d64521e3dce297 /arch/sparc/include/asm
parentcf4af01221579a4e895f43dbfc47598fbfc5a731 (diff)
parent541880d9a2c7871f6370071d55aa6662d329c51e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull big execve/kernel_thread/fork unification series from Al Viro: "All architectures are converted to new model. Quite a bit of that stuff is actually shared with architecture trees; in such cases it's literally shared branch pulled by both, not a cherry-pick. A lot of ugliness and black magic is gone (-3KLoC total in this one): - kernel_thread()/kernel_execve()/sys_execve() redesign. We don't do syscalls from kernel anymore for either kernel_thread() or kernel_execve(): kernel_thread() is essentially clone(2) with callback run before we return to userland, the callbacks either never return or do successful do_execve() before returning. kernel_execve() is a wrapper for do_execve() - it doesn't need to do transition to user mode anymore. As a result kernel_thread() and kernel_execve() are arch-independent now - they live in kernel/fork.c and fs/exec.c resp. sys_execve() is also in fs/exec.c and it's completely architecture-independent. - daemonize() is gone, along with its parts in fs/*.c - struct pt_regs * is no longer passed to do_fork/copy_process/ copy_thread/do_execve/search_binary_handler/->load_binary/do_coredump. - sys_fork()/sys_vfork()/sys_clone() unified; some architectures still need wrappers (ones with callee-saved registers not saved in pt_regs on syscall entry), but the main part of those suckers is in kernel/fork.c now." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (113 commits) do_coredump(): get rid of pt_regs argument print_fatal_signal(): get rid of pt_regs argument ptrace_signal(): get rid of unused arguments get rid of ptrace_signal_deliver() arguments new helper: signal_pt_regs() unify default ptrace_signal_deliver flagday: kill pt_regs argument of do_fork() death to idle_regs() don't pass regs to copy_process() flagday: don't pass regs to copy_thread() bfin: switch to generic vfork, get rid of pointless wrappers xtensa: switch to generic clone() openrisc: switch to use of generic fork and clone unicore32: switch to generic clone(2) score: switch to generic fork/vfork/clone c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone() take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h mn10300: switch to generic fork/vfork/clone h8300: switch to generic fork/vfork/clone tile: switch to generic clone() ... Conflicts: arch/microblaze/include/asm/Kbuild
Diffstat (limited to 'arch/sparc/include/asm')
-rw-r--r--arch/sparc/include/asm/processor_32.h1
-rw-r--r--arch/sparc/include/asm/processor_64.h11
-rw-r--r--arch/sparc/include/asm/ptrace.h10
-rw-r--r--arch/sparc/include/asm/signal.h2
-rw-r--r--arch/sparc/include/asm/switch_to_64.h2
-rw-r--r--arch/sparc/include/asm/syscalls.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h25
-rw-r--r--arch/sparc/include/asm/uaccess_64.h4
-rw-r--r--arch/sparc/include/asm/unistd.h1
9 files changed, 32 insertions, 26 deletions
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index f74ac9ee33a8..c1e01914fd98 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -106,7 +106,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
106 106
107/* Free all resources held by a thread. */ 107/* Free all resources held by a thread. */
108#define release_thread(tsk) do { } while(0) 108#define release_thread(tsk) do { } while(0)
109extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
110 109
111extern unsigned long get_wchan(struct task_struct *); 110extern unsigned long get_wchan(struct task_struct *);
112 111
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 721e25f0e2ea..cce72ce4c334 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -94,6 +94,7 @@ struct thread_struct {
94#ifndef __ASSEMBLY__ 94#ifndef __ASSEMBLY__
95 95
96#include <linux/types.h> 96#include <linux/types.h>
97#include <asm/fpumacro.h>
97 98
98/* Return saved PC of a blocked thread. */ 99/* Return saved PC of a blocked thread. */
99struct task_struct; 100struct task_struct;
@@ -143,6 +144,10 @@ do { \
143 : \ 144 : \
144 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \ 145 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \
145 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ 146 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
147 fprs_write(0); \
148 current_thread_info()->xfsr[0] = 0; \
149 current_thread_info()->fpsaved[0] = 0; \
150 regs->tstate &= ~TSTATE_PEF; \
146} while (0) 151} while (0)
147 152
148#define start_thread32(regs, pc, sp) \ 153#define start_thread32(regs, pc, sp) \
@@ -183,13 +188,15 @@ do { \
183 : \ 188 : \
184 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \ 189 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \
185 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ 190 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
191 fprs_write(0); \
192 current_thread_info()->xfsr[0] = 0; \
193 current_thread_info()->fpsaved[0] = 0; \
194 regs->tstate &= ~TSTATE_PEF; \
186} while (0) 195} while (0)
187 196
188/* Free all resources held by a thread. */ 197/* Free all resources held by a thread. */
189#define release_thread(tsk) do { } while (0) 198#define release_thread(tsk) do { } while (0)
190 199
191extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
192
193extern unsigned long get_wchan(struct task_struct *task); 200extern unsigned long get_wchan(struct task_struct *task);
194 201
195#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) 202#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index da43bdc62294..bdfafd7af46f 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -32,6 +32,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
32#define arch_ptrace_stop(exit_code, info) \ 32#define arch_ptrace_stop(exit_code, info) \
33 synchronize_user_stack() 33 synchronize_user_stack()
34 34
35#define current_pt_regs() \
36 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
37
35struct global_reg_snapshot { 38struct global_reg_snapshot {
36 unsigned long tstate; 39 unsigned long tstate;
37 unsigned long tpc; 40 unsigned long tpc;
@@ -55,9 +58,7 @@ union global_cpu_snapshot {
55 58
56extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS]; 59extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
57 60
58#define force_successful_syscall_return() \ 61#define force_successful_syscall_return() set_thread_noerror(1)
59do { current_thread_info()->syscall_noerror = 1; \
60} while (0)
61#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) 62#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
62#define instruction_pointer(regs) ((regs)->tpc) 63#define instruction_pointer(regs) ((regs)->tpc)
63#define instruction_pointer_set(regs, val) ((regs)->tpc = (val)) 64#define instruction_pointer_set(regs, val) ((regs)->tpc = (val))
@@ -100,6 +101,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
100#define arch_ptrace_stop(exit_code, info) \ 101#define arch_ptrace_stop(exit_code, info) \
101 synchronize_user_stack() 102 synchronize_user_stack()
102 103
104#define current_pt_regs() \
105 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
106
103#define user_mode(regs) (!((regs)->psr & PSR_PS)) 107#define user_mode(regs) (!((regs)->psr & PSR_PS))
104#define instruction_pointer(regs) ((regs)->pc) 108#define instruction_pointer(regs) ((regs)->pc)
105#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) 109#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
index d243c2ae02d2..77b85850d543 100644
--- a/arch/sparc/include/asm/signal.h
+++ b/arch/sparc/include/asm/signal.h
@@ -26,7 +26,5 @@ struct k_sigaction {
26 void __user *ka_restorer; 26 void __user *ka_restorer;
27}; 27};
28 28
29#define ptrace_signal_deliver(regs, cookie) do { } while (0)
30
31#endif /* !(__ASSEMBLY__) */ 29#endif /* !(__ASSEMBLY__) */
32#endif /* !(__SPARC_SIGNAL_H) */ 30#endif /* !(__SPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h
index 7923c4a2be38..cad36f56fa03 100644
--- a/arch/sparc/include/asm/switch_to_64.h
+++ b/arch/sparc/include/asm/switch_to_64.h
@@ -23,7 +23,7 @@ do { flush_tlb_pending(); \
23 /* If you are tempted to conditionalize the following */ \ 23 /* If you are tempted to conditionalize the following */ \
24 /* so that ASI is only written if it changes, think again. */ \ 24 /* so that ASI is only written if it changes, think again. */ \
25 __asm__ __volatile__("wr %%g0, %0, %%asi" \ 25 __asm__ __volatile__("wr %%g0, %0, %%asi" \
26 : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ 26 : : "r" (task_thread_info(next)->current_ds));\
27 trap_block[current_thread_info()->cpu].thread = \ 27 trap_block[current_thread_info()->cpu].thread = \
28 task_thread_info(next); \ 28 task_thread_info(next); \
29 __asm__ __volatile__( \ 29 __asm__ __volatile__( \
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h
index 45a43f637a14..bf8972adea17 100644
--- a/arch/sparc/include/asm/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
@@ -8,6 +8,4 @@ extern asmlinkage long sparc_do_fork(unsigned long clone_flags,
8 struct pt_regs *regs, 8 struct pt_regs *regs,
9 unsigned long stack_size); 9 unsigned long stack_size);
10 10
11extern asmlinkage int sparc_execve(struct pt_regs *regs);
12
13#endif /* _SPARC64_SYSCALLS_H */ 11#endif /* _SPARC64_SYSCALLS_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index a3fe4dcc0aa6..269bd92313df 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -14,12 +14,12 @@
14#define TI_FLAG_FAULT_CODE_SHIFT 56 14#define TI_FLAG_FAULT_CODE_SHIFT 56
15#define TI_FLAG_BYTE_WSTATE 1 15#define TI_FLAG_BYTE_WSTATE 1
16#define TI_FLAG_WSTATE_SHIFT 48 16#define TI_FLAG_WSTATE_SHIFT 48
17#define TI_FLAG_BYTE_CWP 2 17#define TI_FLAG_BYTE_NOERROR 2
18#define TI_FLAG_CWP_SHIFT 40 18#define TI_FLAG_BYTE_NOERROR_SHIFT 40
19#define TI_FLAG_BYTE_CURRENT_DS 3 19#define TI_FLAG_BYTE_FPDEPTH 3
20#define TI_FLAG_CURRENT_DS_SHIFT 32 20#define TI_FLAG_FPDEPTH_SHIFT 32
21#define TI_FLAG_BYTE_FPDEPTH 4 21#define TI_FLAG_BYTE_CWP 4
22#define TI_FLAG_FPDEPTH_SHIFT 24 22#define TI_FLAG_CWP_SHIFT 24
23#define TI_FLAG_BYTE_WSAVED 5 23#define TI_FLAG_BYTE_WSAVED 5
24#define TI_FLAG_WSAVED_SHIFT 16 24#define TI_FLAG_WSAVED_SHIFT 16
25 25
@@ -47,7 +47,7 @@ struct thread_info {
47 struct exec_domain *exec_domain; 47 struct exec_domain *exec_domain;
48 int preempt_count; /* 0 => preemptable, <0 => BUG */ 48 int preempt_count; /* 0 => preemptable, <0 => BUG */
49 __u8 new_child; 49 __u8 new_child;
50 __u8 syscall_noerror; 50 __u8 current_ds;
51 __u16 cpu; 51 __u16 cpu;
52 52
53 unsigned long *utraps; 53 unsigned long *utraps;
@@ -74,9 +74,9 @@ struct thread_info {
74#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE) 74#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)
75#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE) 75#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE)
76#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP) 76#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP)
77#define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS)
78#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) 77#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)
79#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) 78#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED)
79#define TI_SYS_NOERROR (TI_FLAGS + TI_FLAG_BYTE_NOERROR)
80#define TI_FPSAVED 0x00000010 80#define TI_FPSAVED 0x00000010
81#define TI_KSP 0x00000018 81#define TI_KSP 0x00000018
82#define TI_FAULT_ADDR 0x00000020 82#define TI_FAULT_ADDR 0x00000020
@@ -84,7 +84,7 @@ struct thread_info {
84#define TI_EXEC_DOMAIN 0x00000030 84#define TI_EXEC_DOMAIN 0x00000030
85#define TI_PRE_COUNT 0x00000038 85#define TI_PRE_COUNT 0x00000038
86#define TI_NEW_CHILD 0x0000003c 86#define TI_NEW_CHILD 0x0000003c
87#define TI_SYS_NOERROR 0x0000003d 87#define TI_CURRENT_DS 0x0000003d
88#define TI_CPU 0x0000003e 88#define TI_CPU 0x0000003e
89#define TI_UTRAPS 0x00000040 89#define TI_UTRAPS 0x00000040
90#define TI_REG_WINDOW 0x00000048 90#define TI_REG_WINDOW 0x00000048
@@ -121,7 +121,7 @@ struct thread_info {
121#define INIT_THREAD_INFO(tsk) \ 121#define INIT_THREAD_INFO(tsk) \
122{ \ 122{ \
123 .task = &tsk, \ 123 .task = &tsk, \
124 .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \ 124 .current_ds = ASI_P, \
125 .exec_domain = &default_exec_domain, \ 125 .exec_domain = &default_exec_domain, \
126 .preempt_count = INIT_PREEMPT_COUNT, \ 126 .preempt_count = INIT_PREEMPT_COUNT, \
127 .restart_block = { \ 127 .restart_block = { \
@@ -153,13 +153,12 @@ register struct thread_info *current_thread_info_reg asm("g6");
153#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val)) 153#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val))
154#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP]) 154#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP])
155#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val)) 155#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val))
156#define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS]) 156#define get_thread_noerror() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR])
157#define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val)) 157#define set_thread_noerror(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR] = (val))
158#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH]) 158#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH])
159#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val)) 159#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val))
160#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED]) 160#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED])
161#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val)) 161#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val))
162
163#endif /* !(__ASSEMBLY__) */ 162#endif /* !(__ASSEMBLY__) */
164 163
165/* 164/*
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 73083e1d38d9..e562d3caee57 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -38,14 +38,14 @@
38#define VERIFY_READ 0 38#define VERIFY_READ 0
39#define VERIFY_WRITE 1 39#define VERIFY_WRITE 1
40 40
41#define get_fs() ((mm_segment_t) { get_thread_current_ds() }) 41#define get_fs() ((mm_segment_t){(current_thread_info()->current_ds)})
42#define get_ds() (KERNEL_DS) 42#define get_ds() (KERNEL_DS)
43 43
44#define segment_eq(a,b) ((a).seg == (b).seg) 44#define segment_eq(a,b) ((a).seg == (b).seg)
45 45
46#define set_fs(val) \ 46#define set_fs(val) \
47do { \ 47do { \
48 set_thread_current_ds((val).seg); \ 48 current_thread_info()->current_ds =(val).seg; \
49 __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \ 49 __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \
50} while(0) 50} while(0)
51 51
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 0ecea6ed943e..c3e5d8b64171 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -46,6 +46,7 @@
46#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 46#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
47#define __ARCH_WANT_COMPAT_SYS_SENDFILE 47#define __ARCH_WANT_COMPAT_SYS_SENDFILE
48#endif 48#endif
49#define __ARCH_WANT_SYS_EXECVE
49 50
50/* 51/*
51 * "Conditional" syscalls 52 * "Conditional" syscalls