diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:49:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:49:08 -0400 |
commit | 8213a2f3eeafdecf06dd718cb4130372263f6067 (patch) | |
tree | 0d02e3201dac64d1429f8552ee1163d4a1ef1646 | |
parent | 40924754f2cabd5d9af4bcd4dcecc362b5e0baa1 (diff) | |
parent | 12f79be93d94698778ff2b3f921073fc5f6780d6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull pile 2 of execve and kernel_thread unification work from Al Viro:
"Stuff in there: kernel_thread/kernel_execve/sys_execve conversions for
several more architectures plus assorted signal fixes and cleanups.
There'll be more (in particular, real fixes for the alpha
do_notify_resume() irq mess)..."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (43 commits)
alpha: don't open-code trace_report_syscall_{enter,exit}
Uninclude linux/freezer.h
m32r: trim masks
avr32: trim masks
tile: don't bother with SIGTRAP in setup_frame
microblaze: don't bother with SIGTRAP in setup_rt_frame()
mn10300: don't bother with SIGTRAP in setup_frame()
frv: no need to raise SIGTRAP in setup_frame()
x86: get rid of duplicate code in case of CONFIG_VM86
unicore32: remove pointless test
h8300: trim _TIF_WORK_MASK
parisc: decide whether to go to slow path (tracesys) based on thread flags
parisc: don't bother looping in do_signal()
parisc: fix double restarts
bury the rest of TIF_IRET
sanitize tsk_is_polling()
bury _TIF_RESTORE_SIGMASK
unicore32: unobfuscate _TIF_WORK_MASK
mips: NOTIFY_RESUME is not needed in TIF masks
mips: merge the identical "return from syscall" per-ABI code
...
Conflicts:
arch/arm/include/asm/thread_info.h
99 files changed, 344 insertions, 882 deletions
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h index 28335bd40e40..4554ecbff7c6 100644 --- a/arch/alpha/include/asm/thread_info.h +++ b/arch/alpha/include/asm/thread_info.h | |||
@@ -84,7 +84,6 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
84 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 84 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
85 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 85 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
86 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 86 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
87 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
88 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 87 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
89 | 88 | ||
90 | /* Work to do on interrupt/exception return. */ | 89 | /* Work to do on interrupt/exception return. */ |
@@ -117,5 +116,7 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
117 | (int __user *)(value)); \ | 116 | (int __user *)(value)); \ |
118 | }) | 117 | }) |
119 | 118 | ||
119 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
120 | |||
120 | #endif /* __KERNEL__ */ | 121 | #endif /* __KERNEL__ */ |
121 | #endif /* _ALPHA_THREAD_INFO_H */ | 122 | #endif /* _ALPHA_THREAD_INFO_H */ |
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 7e43e1156d10..2a359c9ee3cd 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -418,11 +418,10 @@ $work_notifysig: | |||
418 | strace: | 418 | strace: |
419 | /* set up signal stack, call syscall_trace */ | 419 | /* set up signal stack, call syscall_trace */ |
420 | bsr $1, do_switch_stack | 420 | bsr $1, do_switch_stack |
421 | jsr $26, syscall_trace | 421 | jsr $26, syscall_trace_enter /* returns the syscall number */ |
422 | bsr $1, undo_switch_stack | 422 | bsr $1, undo_switch_stack |
423 | 423 | ||
424 | /* get the system call number and the arguments back.. */ | 424 | /* get the arguments back.. */ |
425 | ldq $0, 0($sp) | ||
426 | ldq $16, SP_OFF+24($sp) | 425 | ldq $16, SP_OFF+24($sp) |
427 | ldq $17, SP_OFF+32($sp) | 426 | ldq $17, SP_OFF+32($sp) |
428 | ldq $18, SP_OFF+40($sp) | 427 | ldq $18, SP_OFF+40($sp) |
@@ -449,7 +448,7 @@ $strace_success: | |||
449 | stq $0, 0($sp) /* save return value */ | 448 | stq $0, 0($sp) /* save return value */ |
450 | 449 | ||
451 | bsr $1, do_switch_stack | 450 | bsr $1, do_switch_stack |
452 | jsr $26, syscall_trace | 451 | jsr $26, syscall_trace_leave |
453 | bsr $1, undo_switch_stack | 452 | bsr $1, undo_switch_stack |
454 | br $31, ret_from_sys_call | 453 | br $31, ret_from_sys_call |
455 | 454 | ||
@@ -467,7 +466,7 @@ $strace_error: | |||
467 | bsr $1, do_switch_stack | 466 | bsr $1, do_switch_stack |
468 | mov $19, $9 /* save old syscall number */ | 467 | mov $19, $9 /* save old syscall number */ |
469 | mov $20, $10 /* save old a3 */ | 468 | mov $20, $10 /* save old a3 */ |
470 | jsr $26, syscall_trace | 469 | jsr $26, syscall_trace_leave |
471 | mov $9, $19 | 470 | mov $9, $19 |
472 | mov $10, $20 | 471 | mov $10, $20 |
473 | bsr $1, undo_switch_stack | 472 | bsr $1, undo_switch_stack |
@@ -698,7 +697,7 @@ sys_sigreturn: | |||
698 | lda $sp, -SWITCH_STACK_SIZE($sp) | 697 | lda $sp, -SWITCH_STACK_SIZE($sp) |
699 | jsr $26, do_sigreturn | 698 | jsr $26, do_sigreturn |
700 | bne $9, 1f | 699 | bne $9, 1f |
701 | jsr $26, syscall_trace | 700 | jsr $26, syscall_trace_leave |
702 | 1: br $1, undo_switch_stack | 701 | 1: br $1, undo_switch_stack |
703 | br ret_from_sys_call | 702 | br ret_from_sys_call |
704 | .end sys_sigreturn | 703 | .end sys_sigreturn |
@@ -715,7 +714,7 @@ sys_rt_sigreturn: | |||
715 | lda $sp, -SWITCH_STACK_SIZE($sp) | 714 | lda $sp, -SWITCH_STACK_SIZE($sp) |
716 | jsr $26, do_rt_sigreturn | 715 | jsr $26, do_rt_sigreturn |
717 | bne $9, 1f | 716 | bne $9, 1f |
718 | jsr $26, syscall_trace | 717 | jsr $26, syscall_trace_leave |
719 | 1: br $1, undo_switch_stack | 718 | 1: br $1, undo_switch_stack |
720 | br ret_from_sys_call | 719 | br ret_from_sys_call |
721 | .end sys_rt_sigreturn | 720 | .end sys_rt_sigreturn |
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index 54616f496aed..2a4a80ff4a20 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/user.h> | 13 | #include <linux/user.h> |
14 | #include <linux/security.h> | 14 | #include <linux/security.h> |
15 | #include <linux/signal.h> | 15 | #include <linux/signal.h> |
16 | #include <linux/tracehook.h> | ||
16 | 17 | ||
17 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
18 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
@@ -312,25 +313,18 @@ long arch_ptrace(struct task_struct *child, long request, | |||
312 | return ret; | 313 | return ret; |
313 | } | 314 | } |
314 | 315 | ||
316 | asmlinkage unsigned long syscall_trace_enter(void) | ||
317 | { | ||
318 | unsigned long ret = 0; | ||
319 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | ||
320 | tracehook_report_syscall_entry(current_pt_regs())) | ||
321 | ret = -1UL; | ||
322 | return ret ?: current_pt_regs()->r0; | ||
323 | } | ||
324 | |||
315 | asmlinkage void | 325 | asmlinkage void |
316 | syscall_trace(void) | 326 | syscall_trace_leave(void) |
317 | { | 327 | { |
318 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 328 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
319 | return; | 329 | tracehook_report_syscall_exit(current_pt_regs(), 0); |
320 | if (!(current->ptrace & PT_PTRACED)) | ||
321 | return; | ||
322 | /* The 0x80 provides a way for the tracing parent to distinguish | ||
323 | between a syscall stop and SIGTRAP delivery */ | ||
324 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | ||
325 | ? 0x80 : 0)); | ||
326 | |||
327 | /* | ||
328 | * This isn't the same as continuing with a signal, but it will do | ||
329 | * for normal use. strace only continues with a signal if the | ||
330 | * stopping signal is not SIGTRAP. -brl | ||
331 | */ | ||
332 | if (current->exit_code) { | ||
333 | send_sig(current->exit_code, current, 1); | ||
334 | current->exit_code = 0; | ||
335 | } | ||
336 | } | 330 | } |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index f71cdab18b87..8477b4c1d39f 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -151,7 +151,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, | |||
151 | #define TIF_SYSCALL_TRACE 8 | 151 | #define TIF_SYSCALL_TRACE 8 |
152 | #define TIF_SYSCALL_AUDIT 9 | 152 | #define TIF_SYSCALL_AUDIT 9 |
153 | #define TIF_SYSCALL_TRACEPOINT 10 | 153 | #define TIF_SYSCALL_TRACEPOINT 10 |
154 | #define TIF_POLLING_NRFLAG 16 | ||
155 | #define TIF_USING_IWMMXT 17 | 154 | #define TIF_USING_IWMMXT 17 |
156 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 155 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
157 | #define TIF_RESTORE_SIGMASK 20 | 156 | #define TIF_RESTORE_SIGMASK 20 |
@@ -164,7 +163,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, | |||
164 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 163 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
165 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | 164 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
166 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) | 165 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) |
167 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
168 | #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) | 166 | #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) |
169 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | 167 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
170 | 168 | ||
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index f27789e4e38a..56f72d257ebd 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/signal.h> | 11 | #include <linux/signal.h> |
12 | #include <linux/personality.h> | 12 | #include <linux/personality.h> |
13 | #include <linux/freezer.h> | ||
14 | #include <linux/uaccess.h> | 13 | #include <linux/uaccess.h> |
15 | #include <linux/tracehook.h> | 14 | #include <linux/tracehook.h> |
16 | 15 | ||
diff --git a/arch/avr32/include/asm/thread_info.h b/arch/avr32/include/asm/thread_info.h index e5deda4691db..6dc62e1f94c7 100644 --- a/arch/avr32/include/asm/thread_info.h +++ b/arch/avr32/include/asm/thread_info.h | |||
@@ -77,8 +77,6 @@ static inline struct thread_info *current_thread_info(void) | |||
77 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 77 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
78 | #define TIF_SIGPENDING 1 /* signal pending */ | 78 | #define TIF_SIGPENDING 1 /* signal pending */ |
79 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 79 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
80 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
81 | TIF_NEED_RESCHED */ | ||
82 | #define TIF_BREAKPOINT 4 /* enter monitor mode on return */ | 80 | #define TIF_BREAKPOINT 4 /* enter monitor mode on return */ |
83 | #define TIF_SINGLE_STEP 5 /* single step in progress */ | 81 | #define TIF_SINGLE_STEP 5 /* single step in progress */ |
84 | #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ | 82 | #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ |
@@ -91,10 +89,9 @@ static inline struct thread_info *current_thread_info(void) | |||
91 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 89 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
92 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 90 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
93 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 91 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
94 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 92 | #define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT) |
95 | #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) | 93 | #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) |
96 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | 94 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) |
97 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
98 | #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) | 95 | #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) |
99 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 96 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
100 | 97 | ||
@@ -102,17 +99,14 @@ static inline struct thread_info *current_thread_info(void) | |||
102 | 99 | ||
103 | /* work to do on interrupt/exception return */ | 100 | /* work to do on interrupt/exception return */ |
104 | #define _TIF_WORK_MASK \ | 101 | #define _TIF_WORK_MASK \ |
105 | ((1 << TIF_SIGPENDING) \ | 102 | (_TIF_SIGPENDING \ |
106 | | _TIF_NOTIFY_RESUME \ | 103 | | _TIF_NOTIFY_RESUME \ |
107 | | (1 << TIF_NEED_RESCHED) \ | 104 | | _TIF_NEED_RESCHED \ |
108 | | (1 << TIF_POLLING_NRFLAG) \ | 105 | | _TIF_BREAKPOINT) |
109 | | (1 << TIF_BREAKPOINT) \ | ||
110 | | (1 << TIF_RESTORE_SIGMASK)) | ||
111 | 106 | ||
112 | /* work to do on any return to userspace */ | 107 | /* work to do on any return to userspace */ |
113 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE) | \ | 108 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE) |
114 | _TIF_NOTIFY_RESUME) | ||
115 | /* work to do on return from debug mode */ | 109 | /* work to do on return from debug mode */ |
116 | #define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT)) | 110 | #define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~_TIF_BREAKPOINT) |
117 | 111 | ||
118 | #endif /* __ASM_AVR32_THREAD_INFO_H */ | 112 | #endif /* __ASM_AVR32_THREAD_INFO_H */ |
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index d552a854dacc..5e01c3a40ced 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
17 | #include <linux/unistd.h> | 17 | #include <linux/unistd.h> |
18 | #include <linux/freezer.h> | ||
19 | #include <linux/tracehook.h> | 18 | #include <linux/tracehook.h> |
20 | 19 | ||
21 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h index 53ad10005ae3..3894005337ba 100644 --- a/arch/blackfin/include/asm/thread_info.h +++ b/arch/blackfin/include/asm/thread_info.h | |||
@@ -96,8 +96,6 @@ static inline struct thread_info *current_thread_info(void) | |||
96 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 96 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
97 | #define TIF_SIGPENDING 1 /* signal pending */ | 97 | #define TIF_SIGPENDING 1 /* signal pending */ |
98 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 98 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
99 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
100 | TIF_NEED_RESCHED */ | ||
101 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ | 99 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ |
102 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | 100 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
103 | #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ | 101 | #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ |
@@ -108,8 +106,6 @@ static inline struct thread_info *current_thread_info(void) | |||
108 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 106 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
109 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 107 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
110 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 108 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
111 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
112 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
113 | #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) | 109 | #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) |
114 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 110 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
115 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 111 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 6682b73a8523..6ed20a1a4af9 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/tty.h> | 10 | #include <linux/tty.h> |
11 | #include <linux/personality.h> | 11 | #include <linux/personality.h> |
12 | #include <linux/binfmts.h> | 12 | #include <linux/binfmts.h> |
13 | #include <linux/freezer.h> | ||
14 | #include <linux/uaccess.h> | 13 | #include <linux/uaccess.h> |
15 | #include <linux/tracehook.h> | 14 | #include <linux/tracehook.h> |
16 | 15 | ||
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig index 983c859e40b7..45268b50c0c8 100644 --- a/arch/c6x/Kconfig +++ b/arch/c6x/Kconfig | |||
@@ -17,6 +17,7 @@ config C6X | |||
17 | select OF | 17 | select OF |
18 | select OF_EARLY_FLATTREE | 18 | select OF_EARLY_FLATTREE |
19 | select GENERIC_CLOCKEVENTS | 19 | select GENERIC_CLOCKEVENTS |
20 | select GENERIC_KERNEL_THREAD | ||
20 | 21 | ||
21 | config MMU | 22 | config MMU |
22 | def_bool n | 23 | def_bool n |
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h index c50af7ef1c96..b9eb3da7f278 100644 --- a/arch/c6x/include/asm/processor.h +++ b/arch/c6x/include/asm/processor.h | |||
@@ -92,8 +92,6 @@ static inline void release_thread(struct task_struct *dead_task) | |||
92 | { | 92 | { |
93 | } | 93 | } |
94 | 94 | ||
95 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
96 | |||
97 | #define copy_segments(tsk, mm) do { } while (0) | 95 | #define copy_segments(tsk, mm) do { } while (0) |
98 | #define release_segments(mm) do { } while (0) | 96 | #define release_segments(mm) do { } while (0) |
99 | 97 | ||
diff --git a/arch/c6x/include/asm/syscalls.h b/arch/c6x/include/asm/syscalls.h index aed53da703c9..e7b8991dc07c 100644 --- a/arch/c6x/include/asm/syscalls.h +++ b/arch/c6x/include/asm/syscalls.h | |||
@@ -44,11 +44,6 @@ extern int sys_cache_sync(unsigned long s, unsigned long e); | |||
44 | struct pt_regs; | 44 | struct pt_regs; |
45 | 45 | ||
46 | extern asmlinkage long sys_c6x_clone(struct pt_regs *regs); | 46 | extern asmlinkage long sys_c6x_clone(struct pt_regs *regs); |
47 | extern asmlinkage long sys_c6x_execve(const char __user *name, | ||
48 | const char __user *const __user *argv, | ||
49 | const char __user *const __user *envp, | ||
50 | struct pt_regs *regs); | ||
51 | |||
52 | 47 | ||
53 | #include <asm-generic/syscalls.h> | 48 | #include <asm-generic/syscalls.h> |
54 | 49 | ||
diff --git a/arch/c6x/include/asm/thread_info.h b/arch/c6x/include/asm/thread_info.h index 1710bcbb8d09..4c8dc562bd90 100644 --- a/arch/c6x/include/asm/thread_info.h +++ b/arch/c6x/include/asm/thread_info.h | |||
@@ -97,7 +97,6 @@ struct thread_info *current_thread_info(void) | |||
97 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 97 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
98 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | 98 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ |
99 | 99 | ||
100 | #define TIF_POLLING_NRFLAG 16 /* true if polling TIF_NEED_RESCHED */ | ||
101 | #define TIF_MEMDIE 17 /* OOM killer killed process */ | 100 | #define TIF_MEMDIE 17 /* OOM killer killed process */ |
102 | 101 | ||
103 | #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ | 102 | #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ |
diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h index ed2259043eec..4ff747d12dad 100644 --- a/arch/c6x/include/asm/unistd.h +++ b/arch/c6x/include/asm/unistd.h | |||
@@ -14,6 +14,9 @@ | |||
14 | * more details. | 14 | * more details. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define __ARCH_WANT_KERNEL_EXECVE | ||
18 | #define __ARCH_WANT_SYS_EXECVE | ||
19 | |||
17 | /* Use the standard ABI for syscalls. */ | 20 | /* Use the standard ABI for syscalls. */ |
18 | #include <asm-generic/unistd.h> | 21 | #include <asm-generic/unistd.h> |
19 | 22 | ||
diff --git a/arch/c6x/kernel/asm-offsets.c b/arch/c6x/kernel/asm-offsets.c index 759ad6d207b6..60f1e437745d 100644 --- a/arch/c6x/kernel/asm-offsets.c +++ b/arch/c6x/kernel/asm-offsets.c | |||
@@ -116,7 +116,6 @@ void foo(void) | |||
116 | DEFINE(_TIF_NOTIFY_RESUME, (1<<TIF_NOTIFY_RESUME)); | 116 | DEFINE(_TIF_NOTIFY_RESUME, (1<<TIF_NOTIFY_RESUME)); |
117 | DEFINE(_TIF_SIGPENDING, (1<<TIF_SIGPENDING)); | 117 | DEFINE(_TIF_SIGPENDING, (1<<TIF_SIGPENDING)); |
118 | DEFINE(_TIF_NEED_RESCHED, (1<<TIF_NEED_RESCHED)); | 118 | DEFINE(_TIF_NEED_RESCHED, (1<<TIF_NEED_RESCHED)); |
119 | DEFINE(_TIF_POLLING_NRFLAG, (1<<TIF_POLLING_NRFLAG)); | ||
120 | 119 | ||
121 | DEFINE(_TIF_ALLWORK_MASK, TIF_ALLWORK_MASK); | 120 | DEFINE(_TIF_ALLWORK_MASK, TIF_ALLWORK_MASK); |
122 | DEFINE(_TIF_WORK_MASK, TIF_WORK_MASK); | 121 | DEFINE(_TIF_WORK_MASK, TIF_WORK_MASK); |
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S index 30b37e5f4a61..5449c36018fe 100644 --- a/arch/c6x/kernel/entry.S +++ b/arch/c6x/kernel/entry.S | |||
@@ -400,6 +400,32 @@ ret_from_fork_2: | |||
400 | STW .D2T2 B0,*+SP(REGS_A4+8) | 400 | STW .D2T2 B0,*+SP(REGS_A4+8) |
401 | ENDPROC(ret_from_fork) | 401 | ENDPROC(ret_from_fork) |
402 | 402 | ||
403 | ENTRY(ret_from_kernel_thread) | ||
404 | #ifdef CONFIG_C6X_BIG_KERNEL | ||
405 | MVKL .S1 schedule_tail,A0 | ||
406 | MVKH .S1 schedule_tail,A0 | ||
407 | B .S2X A0 | ||
408 | #else | ||
409 | B .S2 schedule_tail | ||
410 | #endif | ||
411 | LDW .D2T2 *+SP(REGS_A0+8),B10 /* get fn */ | ||
412 | ADDKPC .S2 0f,B3,3 | ||
413 | 0: | ||
414 | B .S2 B10 /* call fn */ | ||
415 | LDW .D2T1 *+SP(REGS_A1+8),A4 /* get arg */ | ||
416 | MVKL .S2 sys_exit,B11 | ||
417 | MVKH .S2 sys_exit,B11 | ||
418 | ADDKPC .S2 0f,B3,1 | ||
419 | 0: | ||
420 | BNOP .S2 B11,5 /* jump to sys_exit */ | ||
421 | ENDPROC(ret_from_kernel_thread) | ||
422 | |||
423 | ENTRY(ret_from_kernel_execve) | ||
424 | GET_THREAD_INFO A12 | ||
425 | BNOP .S2 syscall_exit,4 | ||
426 | ADD .D2X A4,-8,SP | ||
427 | ENDPROC(ret_from_kernel_execve) | ||
428 | |||
403 | ;; | 429 | ;; |
404 | ;; These are the interrupt handlers, responsible for calling __do_IRQ() | 430 | ;; These are the interrupt handlers, responsible for calling __do_IRQ() |
405 | ;; int6 is used for syscalls (see _system_call entry) | 431 | ;; int6 is used for syscalls (see _system_call entry) |
@@ -593,13 +619,6 @@ ENTRY(sys_sigaltstack) | |||
593 | NOP 4 | 619 | NOP 4 |
594 | ENDPROC(sys_sigaltstack) | 620 | ENDPROC(sys_sigaltstack) |
595 | 621 | ||
596 | ;; kernel_execve | ||
597 | ENTRY(kernel_execve) | ||
598 | MVK .S2 __NR_execve,B0 | ||
599 | SWE | ||
600 | BNOP .S2 B3,5 | ||
601 | ENDPROC(kernel_execve) | ||
602 | |||
603 | ;; | 622 | ;; |
604 | ;; Special system calls | 623 | ;; Special system calls |
605 | ;; return address is in B3 | 624 | ;; return address is in B3 |
@@ -628,29 +647,6 @@ ENTRY(sys_rt_sigreturn) | |||
628 | #endif | 647 | #endif |
629 | ENDPROC(sys_rt_sigreturn) | 648 | ENDPROC(sys_rt_sigreturn) |
630 | 649 | ||
631 | ENTRY(sys_execve) | ||
632 | ADDAW .D2 SP,2,B6 ; put regs addr in 4th parameter | ||
633 | ; & adjust regs stack addr | ||
634 | LDW .D2T2 *+SP(REGS_B4+8),B4 | ||
635 | |||
636 | ;; c6x_execve(char *name, char **argv, | ||
637 | ;; char **envp, struct pt_regs *regs) | ||
638 | #ifdef CONFIG_C6X_BIG_KERNEL | ||
639 | || MVKL .S1 sys_c6x_execve,A0 | ||
640 | MVKH .S1 sys_c6x_execve,A0 | ||
641 | B .S2X A0 | ||
642 | #else | ||
643 | || B .S2 sys_c6x_execve | ||
644 | #endif | ||
645 | STW .D2T2 B3,*SP--[2] | ||
646 | ADDKPC .S2 ret_from_c6x_execve,B3,3 | ||
647 | |||
648 | ret_from_c6x_execve: | ||
649 | LDW .D2T2 *++SP[2],B3 | ||
650 | NOP 4 | ||
651 | BNOP .S2 B3,5 | ||
652 | ENDPROC(sys_execve) | ||
653 | |||
654 | ENTRY(sys_pread_c6x) | 650 | ENTRY(sys_pread_c6x) |
655 | MV .D2X A8,B7 | 651 | MV .D2X A8,B7 |
656 | #ifdef CONFIG_C6X_BIG_KERNEL | 652 | #ifdef CONFIG_C6X_BIG_KERNEL |
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c index 45e924a636a0..2770d9a9a84e 100644 --- a/arch/c6x/kernel/process.c +++ b/arch/c6x/kernel/process.c | |||
@@ -25,6 +25,7 @@ void (*c6x_restart)(void); | |||
25 | void (*c6x_halt)(void); | 25 | void (*c6x_halt)(void); |
26 | 26 | ||
27 | extern asmlinkage void ret_from_fork(void); | 27 | extern asmlinkage void ret_from_fork(void); |
28 | extern asmlinkage void ret_from_kernel_thread(void); | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * power off function, if any | 31 | * power off function, if any |
@@ -103,37 +104,6 @@ void machine_power_off(void) | |||
103 | halt_loop(); | 104 | halt_loop(); |
104 | } | 105 | } |
105 | 106 | ||
106 | static void kernel_thread_helper(int dummy, void *arg, int (*fn)(void *)) | ||
107 | { | ||
108 | do_exit(fn(arg)); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * Create a kernel thread | ||
113 | */ | ||
114 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | ||
115 | { | ||
116 | struct pt_regs regs; | ||
117 | |||
118 | /* | ||
119 | * copy_thread sets a4 to zero (child return from fork) | ||
120 | * so we can't just set things up to directly return to | ||
121 | * fn. | ||
122 | */ | ||
123 | memset(®s, 0, sizeof(regs)); | ||
124 | regs.b4 = (unsigned long) arg; | ||
125 | regs.a6 = (unsigned long) fn; | ||
126 | regs.pc = (unsigned long) kernel_thread_helper; | ||
127 | local_save_flags(regs.csr); | ||
128 | regs.csr |= 1; | ||
129 | regs.tsr = 5; /* Set GEE and GIE in TSR */ | ||
130 | |||
131 | /* Ok, create the new process.. */ | ||
132 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, -1, ®s, | ||
133 | 0, NULL, NULL); | ||
134 | } | ||
135 | EXPORT_SYMBOL(kernel_thread); | ||
136 | |||
137 | void flush_thread(void) | 107 | void flush_thread(void) |
138 | { | 108 | { |
139 | } | 109 | } |
@@ -191,22 +161,24 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
191 | 161 | ||
192 | childregs = task_pt_regs(p); | 162 | childregs = task_pt_regs(p); |
193 | 163 | ||
194 | *childregs = *regs; | 164 | if (!regs) { |
195 | childregs->a4 = 0; | ||
196 | |||
197 | if (usp == -1) | ||
198 | /* case of __kernel_thread: we return to supervisor space */ | 165 | /* case of __kernel_thread: we return to supervisor space */ |
166 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
199 | childregs->sp = (unsigned long)(childregs + 1); | 167 | childregs->sp = (unsigned long)(childregs + 1); |
200 | else | 168 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
169 | childregs->a0 = usp; /* function */ | ||
170 | childregs->a1 = ustk_size; /* argument */ | ||
171 | } else { | ||
201 | /* Otherwise use the given stack */ | 172 | /* Otherwise use the given stack */ |
173 | *childregs = *regs; | ||
202 | childregs->sp = usp; | 174 | childregs->sp = usp; |
175 | p->thread.pc = (unsigned long) ret_from_fork; | ||
176 | } | ||
203 | 177 | ||
204 | /* Set usp/ksp */ | 178 | /* Set usp/ksp */ |
205 | p->thread.usp = childregs->sp; | 179 | p->thread.usp = childregs->sp; |
206 | /* switch_to uses stack to save/restore 14 callee-saved regs */ | ||
207 | thread_saved_ksp(p) = (unsigned long)childregs - 8; | 180 | thread_saved_ksp(p) = (unsigned long)childregs - 8; |
208 | p->thread.pc = (unsigned int) ret_from_fork; | 181 | p->thread.wchan = p->thread.pc; |
209 | p->thread.wchan = (unsigned long) ret_from_fork; | ||
210 | #ifdef __DSBT__ | 182 | #ifdef __DSBT__ |
211 | { | 183 | { |
212 | unsigned long dp; | 184 | unsigned long dp; |
@@ -221,28 +193,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
221 | return 0; | 193 | return 0; |
222 | } | 194 | } |
223 | 195 | ||
224 | /* | ||
225 | * c6x_execve() executes a new program. | ||
226 | */ | ||
227 | SYSCALL_DEFINE4(c6x_execve, const char __user *, name, | ||
228 | const char __user *const __user *, argv, | ||
229 | const char __user *const __user *, envp, | ||
230 | struct pt_regs *, regs) | ||
231 | { | ||
232 | int error; | ||
233 | char *filename; | ||
234 | |||
235 | filename = getname(name); | ||
236 | error = PTR_ERR(filename); | ||
237 | if (IS_ERR(filename)) | ||
238 | goto out; | ||
239 | |||
240 | error = do_execve(filename, argv, envp, regs); | ||
241 | putname(filename); | ||
242 | out: | ||
243 | return error; | ||
244 | } | ||
245 | |||
246 | unsigned long get_wchan(struct task_struct *p) | 196 | unsigned long get_wchan(struct task_struct *p) |
247 | { | 197 | { |
248 | return p->thread.wchan; | 198 | return p->thread.wchan; |
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h index 5b1c448df5c0..07c8c40c52b3 100644 --- a/arch/cris/include/asm/thread_info.h +++ b/arch/cris/include/asm/thread_info.h | |||
@@ -78,15 +78,12 @@ struct thread_info { | |||
78 | #define TIF_SIGPENDING 2 /* signal pending */ | 78 | #define TIF_SIGPENDING 2 /* signal pending */ |
79 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 79 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
80 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | 80 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
81 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
82 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ | 81 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ |
83 | 82 | ||
84 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 83 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
85 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 84 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
86 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 85 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
87 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 86 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
88 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
89 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
90 | 87 | ||
91 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 88 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
92 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | 89 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 9d262645f667..b7412504f08a 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -12,6 +12,7 @@ config FRV | |||
12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select ARCH_WANT_IPC_PARSE_VERSION | 14 | select ARCH_WANT_IPC_PARSE_VERSION |
15 | select GENERIC_KERNEL_THREAD | ||
15 | 16 | ||
16 | config ZONE_DMA | 17 | config ZONE_DMA |
17 | bool | 18 | bool |
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h index dccb9d162318..a34f309e5801 100644 --- a/arch/frv/include/asm/processor.h +++ b/arch/frv/include/asm/processor.h | |||
@@ -92,14 +92,12 @@ extern struct task_struct *__kernel_current_task; | |||
92 | 92 | ||
93 | /* | 93 | /* |
94 | * do necessary setup to start up a newly executed thread. | 94 | * do necessary setup to start up a newly executed thread. |
95 | * - need to discard the frame stacked by init() invoking the execve syscall | ||
96 | */ | 95 | */ |
97 | #define start_thread(_regs, _pc, _usp) \ | 96 | #define start_thread(_regs, _pc, _usp) \ |
98 | do { \ | 97 | do { \ |
99 | __frame = __kernel_frame0_ptr; \ | 98 | _regs->pc = (_pc); \ |
100 | __frame->pc = (_pc); \ | 99 | _regs->psr &= ~PSR_S; \ |
101 | __frame->psr &= ~PSR_S; \ | 100 | _regs->sp = (_usp); \ |
102 | __frame->sp = (_usp); \ | ||
103 | } while(0) | 101 | } while(0) |
104 | 102 | ||
105 | /* Free all resources held by a thread. */ | 103 | /* Free all resources held by a thread. */ |
@@ -107,7 +105,6 @@ static inline void release_thread(struct task_struct *dead_task) | |||
107 | { | 105 | { |
108 | } | 106 | } |
109 | 107 | ||
110 | extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
111 | extern asmlinkage void save_user_regs(struct user_context *target); | 108 | extern asmlinkage void save_user_regs(struct user_context *target); |
112 | extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); | 109 | extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); |
113 | 110 | ||
diff --git a/arch/frv/include/asm/ptrace.h b/arch/frv/include/asm/ptrace.h index ef6635ca4ecb..bd534b2d0258 100644 --- a/arch/frv/include/asm/ptrace.h +++ b/arch/frv/include/asm/ptrace.h | |||
@@ -76,6 +76,7 @@ register struct pt_regs *__frame asm("gr28"); | |||
76 | #define user_mode(regs) (!((regs)->psr & PSR_S)) | 76 | #define user_mode(regs) (!((regs)->psr & PSR_S)) |
77 | #define instruction_pointer(regs) ((regs)->pc) | 77 | #define instruction_pointer(regs) ((regs)->pc) |
78 | #define user_stack_pointer(regs) ((regs)->sp) | 78 | #define user_stack_pointer(regs) ((regs)->sp) |
79 | #define current_pt_regs() (__frame) | ||
79 | 80 | ||
80 | extern unsigned long user_stack(const struct pt_regs *); | 81 | extern unsigned long user_stack(const struct pt_regs *); |
81 | #define profile_pc(regs) ((regs)->pc) | 82 | #define profile_pc(regs) ((regs)->pc) |
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index 0ff03a33c81e..bebd7eadc772 100644 --- a/arch/frv/include/asm/thread_info.h +++ b/arch/frv/include/asm/thread_info.h | |||
@@ -94,7 +94,6 @@ register struct thread_info *__current_thread_info asm("gr15"); | |||
94 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 94 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
95 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ | 95 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ |
96 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | 96 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
97 | #define TIF_POLLING_NRFLAG 6 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
98 | #define TIF_MEMDIE 7 /* is terminating due to OOM killer */ | 97 | #define TIF_MEMDIE 7 /* is terminating due to OOM killer */ |
99 | 98 | ||
100 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 99 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
@@ -102,8 +101,6 @@ register struct thread_info *__current_thread_info asm("gr15"); | |||
102 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 101 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
103 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 102 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
104 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 103 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
105 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
106 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
107 | 104 | ||
108 | /* work to do on interrupt/exception return */ | 105 | /* work to do on interrupt/exception return */ |
109 | #define _TIF_WORK_MASK \ | 106 | #define _TIF_WORK_MASK \ |
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h index 67f23a311db6..b6b07e55e473 100644 --- a/arch/frv/include/asm/unistd.h +++ b/arch/frv/include/asm/unistd.h | |||
@@ -372,6 +372,8 @@ | |||
372 | #define __ARCH_WANT_SYS_SIGPROCMASK | 372 | #define __ARCH_WANT_SYS_SIGPROCMASK |
373 | #define __ARCH_WANT_SYS_RT_SIGACTION | 373 | #define __ARCH_WANT_SYS_RT_SIGACTION |
374 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 374 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
375 | #define __ARCH_WANT_SYS_EXECVE | ||
376 | #define __ARCH_WANT_KERNEL_EXECVE | ||
375 | 377 | ||
376 | /* | 378 | /* |
377 | * "Conditional" syscalls | 379 | * "Conditional" syscalls |
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile index ad4087b69968..3cbb3294b9f9 100644 --- a/arch/frv/kernel/Makefile +++ b/arch/frv/kernel/Makefile | |||
@@ -7,8 +7,8 @@ heads-$(CONFIG_MMU) := head-mmu-fr451.o | |||
7 | 7 | ||
8 | extra-y:= head.o vmlinux.lds | 8 | extra-y:= head.o vmlinux.lds |
9 | 9 | ||
10 | obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ | 10 | obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o \ |
11 | kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ | 11 | process.o traps.o ptrace.o signal.o dma.o \ |
12 | sys_frv.o time.o setup.o frv_ksyms.o \ | 12 | sys_frv.o time.o setup.o frv_ksyms.o \ |
13 | debug-stub.o irq.o sleep.o uaccess.o | 13 | debug-stub.o irq.o sleep.o uaccess.o |
14 | 14 | ||
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index 7d5e000fd32e..002732960315 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S | |||
@@ -863,6 +863,19 @@ ret_from_fork: | |||
863 | setlos.p #0,gr8 | 863 | setlos.p #0,gr8 |
864 | bra __syscall_exit | 864 | bra __syscall_exit |
865 | 865 | ||
866 | .globl ret_from_kernel_thread | ||
867 | ret_from_kernel_thread: | ||
868 | lddi.p @(gr28,#REG_GR(8)),gr20 | ||
869 | call schedule_tail | ||
870 | or.p gr20,gr20,gr8 | ||
871 | calll @(gr21,gr0) | ||
872 | bra sys_exit | ||
873 | |||
874 | .globl ret_from_kernel_execve | ||
875 | ret_from_kernel_execve: | ||
876 | ori gr28,0,sp | ||
877 | bra __syscall_exit | ||
878 | |||
866 | ################################################################################################### | 879 | ################################################################################################### |
867 | # | 880 | # |
868 | # Return to user mode is not as complex as all this looks, | 881 | # Return to user mode is not as complex as all this looks, |
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c index a89803b58b9a..86c516d96dcd 100644 --- a/arch/frv/kernel/frv_ksyms.c +++ b/arch/frv/kernel/frv_ksyms.c | |||
@@ -30,7 +30,6 @@ EXPORT_SYMBOL(ip_fast_csum); | |||
30 | EXPORT_SYMBOL(local_irq_count); | 30 | EXPORT_SYMBOL(local_irq_count); |
31 | EXPORT_SYMBOL(local_bh_count); | 31 | EXPORT_SYMBOL(local_bh_count); |
32 | #endif | 32 | #endif |
33 | EXPORT_SYMBOL(kernel_thread); | ||
34 | 33 | ||
35 | EXPORT_SYMBOL(__res_bus_clock_speed_HZ); | 34 | EXPORT_SYMBOL(__res_bus_clock_speed_HZ); |
36 | EXPORT_SYMBOL(__page_offset); | 35 | EXPORT_SYMBOL(__page_offset); |
diff --git a/arch/frv/kernel/kernel_execve.S b/arch/frv/kernel/kernel_execve.S deleted file mode 100644 index 9b074a16a052..000000000000 --- a/arch/frv/kernel/kernel_execve.S +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* in-kernel program execution | ||
2 | * | ||
3 | * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <asm/unistd.h> | ||
14 | |||
15 | ############################################################################### | ||
16 | # | ||
17 | # Do a system call from kernel instead of calling sys_execve so we end up with | ||
18 | # proper pt_regs. | ||
19 | # | ||
20 | # int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
21 | # | ||
22 | # On entry: GR8/GR9/GR10: arguments to function | ||
23 | # On return: GR8: syscall return. | ||
24 | # | ||
25 | ############################################################################### | ||
26 | .globl kernel_execve | ||
27 | .type kernel_execve,@function | ||
28 | kernel_execve: | ||
29 | setlos __NR_execve,gr7 | ||
30 | tira gr0,#0 | ||
31 | bralr | ||
32 | |||
33 | .size kernel_execve,.-kernel_execve | ||
diff --git a/arch/frv/kernel/kernel_thread.S b/arch/frv/kernel/kernel_thread.S deleted file mode 100644 index f0e52943f923..000000000000 --- a/arch/frv/kernel/kernel_thread.S +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* kernel_thread.S: kernel thread creation | ||
2 | * | ||
3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <linux/kern_levels.h> | ||
14 | #include <asm/unistd.h> | ||
15 | |||
16 | #define CLONE_VM 0x00000100 /* set if VM shared between processes */ | ||
17 | |||
18 | .section .rodata | ||
19 | kernel_thread_emsg: | ||
20 | .asciz KERN_ERR "failed to create kernel thread: error=%d\n" | ||
21 | |||
22 | .text | ||
23 | .balign 4 | ||
24 | |||
25 | ############################################################################### | ||
26 | # | ||
27 | # Create a kernel thread | ||
28 | # | ||
29 | # int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | ||
30 | # | ||
31 | ############################################################################### | ||
32 | .globl kernel_thread | ||
33 | .type kernel_thread,@function | ||
34 | kernel_thread: | ||
35 | or.p gr8,gr0,gr4 | ||
36 | or gr9,gr0,gr5 | ||
37 | |||
38 | # start by forking the current process, but with shared VM | ||
39 | setlos.p #__NR_clone,gr7 ; syscall number | ||
40 | ori gr10,#CLONE_VM,gr8 ; first syscall arg [clone_flags] | ||
41 | sethi.p #0xe4e4,gr9 ; second syscall arg [newsp] | ||
42 | setlo #0xe4e4,gr9 | ||
43 | setlos.p #0,gr10 ; third syscall arg [parent_tidptr] | ||
44 | setlos #0,gr11 ; fourth syscall arg [child_tidptr] | ||
45 | tira gr0,#0 | ||
46 | setlos.p #4095,gr7 | ||
47 | andcc gr8,gr8,gr0,icc0 | ||
48 | addcc.p gr8,gr7,gr0,icc1 | ||
49 | bnelr icc0,#2 | ||
50 | bc icc1,#0,kernel_thread_error | ||
51 | |||
52 | # now invoke the work function | ||
53 | or gr5,gr0,gr8 | ||
54 | calll @(gr4,gr0) | ||
55 | |||
56 | # and finally exit the thread | ||
57 | setlos #__NR_exit,gr7 ; syscall number | ||
58 | tira gr0,#0 | ||
59 | |||
60 | kernel_thread_error: | ||
61 | subi sp,#8,sp | ||
62 | movsg lr,gr4 | ||
63 | sti gr8,@(sp,#0) | ||
64 | sti.p gr4,@(sp,#4) | ||
65 | |||
66 | or gr8,gr0,gr9 | ||
67 | sethi.p %hi(kernel_thread_emsg),gr8 | ||
68 | setlo %lo(kernel_thread_emsg),gr8 | ||
69 | |||
70 | call printk | ||
71 | |||
72 | ldi @(sp,#4),gr4 | ||
73 | ldi @(sp,#0),gr8 | ||
74 | subi sp,#8,sp | ||
75 | jmpl @(gr4,gr0) | ||
76 | |||
77 | .size kernel_thread,.-kernel_thread | ||
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 2eb7fa5bf9d8..655d90d20bb0 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "local.h" | 38 | #include "local.h" |
39 | 39 | ||
40 | asmlinkage void ret_from_fork(void); | 40 | asmlinkage void ret_from_fork(void); |
41 | asmlinkage void ret_from_kernel_thread(void); | ||
41 | 42 | ||
42 | #include <asm/pgalloc.h> | 43 | #include <asm/pgalloc.h> |
43 | 44 | ||
@@ -172,32 +173,13 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
172 | * set up the kernel stack and exception frames for a new process | 173 | * set up the kernel stack and exception frames for a new process |
173 | */ | 174 | */ |
174 | int copy_thread(unsigned long clone_flags, | 175 | int copy_thread(unsigned long clone_flags, |
175 | unsigned long usp, unsigned long topstk, | 176 | unsigned long usp, unsigned long arg, |
176 | struct task_struct *p, struct pt_regs *regs) | 177 | struct task_struct *p, struct pt_regs *regs) |
177 | { | 178 | { |
178 | struct pt_regs *childregs0, *childregs, *regs0; | 179 | struct pt_regs *childregs; |
179 | 180 | ||
180 | regs0 = __kernel_frame0_ptr; | 181 | childregs = (struct pt_regs *) |
181 | childregs0 = (struct pt_regs *) | ||
182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); | 182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); |
183 | childregs = childregs0; | ||
184 | |||
185 | /* set up the userspace frame (the only place that the USP is stored) */ | ||
186 | *childregs0 = *regs0; | ||
187 | |||
188 | childregs0->gr8 = 0; | ||
189 | childregs0->sp = usp; | ||
190 | childregs0->next_frame = NULL; | ||
191 | |||
192 | /* set up the return kernel frame if called from kernel_thread() */ | ||
193 | if (regs != regs0) { | ||
194 | childregs--; | ||
195 | *childregs = *regs; | ||
196 | childregs->sp = (unsigned long) childregs0; | ||
197 | childregs->next_frame = childregs0; | ||
198 | childregs->gr15 = (unsigned long) task_thread_info(p); | ||
199 | childregs->gr29 = (unsigned long) p; | ||
200 | } | ||
201 | 183 | ||
202 | p->set_child_tid = p->clear_child_tid = NULL; | 184 | p->set_child_tid = p->clear_child_tid = NULL; |
203 | 185 | ||
@@ -206,8 +188,25 @@ int copy_thread(unsigned long clone_flags, | |||
206 | p->thread.sp = (unsigned long) childregs; | 188 | p->thread.sp = (unsigned long) childregs; |
207 | p->thread.fp = 0; | 189 | p->thread.fp = 0; |
208 | p->thread.lr = 0; | 190 | p->thread.lr = 0; |
209 | p->thread.pc = (unsigned long) ret_from_fork; | 191 | p->thread.frame0 = childregs; |
210 | p->thread.frame0 = childregs0; | 192 | |
193 | if (unlikely(!regs)) { | ||
194 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
195 | childregs->gr9 = usp; /* function */ | ||
196 | childregs->gr8 = arg; | ||
197 | chilregs->psr = PSR_S; | ||
198 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | ||
199 | save_user_regs(p->thread.user); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | /* set up the userspace frame (the only place that the USP is stored) */ | ||
204 | *childregs = *regs; | ||
205 | |||
206 | childregs->sp = usp; | ||
207 | childregs->next_frame = NULL; | ||
208 | |||
209 | p->thread.pc = (unsigned long) ret_from_fork; | ||
211 | 210 | ||
212 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ | 211 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ |
213 | if (clone_flags & CLONE_SETTLS) | 212 | if (clone_flags & CLONE_SETTLS) |
@@ -218,25 +217,6 @@ int copy_thread(unsigned long clone_flags, | |||
218 | return 0; | 217 | return 0; |
219 | } /* end copy_thread() */ | 218 | } /* end copy_thread() */ |
220 | 219 | ||
221 | /* | ||
222 | * sys_execve() executes a new program. | ||
223 | */ | ||
224 | asmlinkage int sys_execve(const char __user *name, | ||
225 | const char __user *const __user *argv, | ||
226 | const char __user *const __user *envp) | ||
227 | { | ||
228 | int error; | ||
229 | char * filename; | ||
230 | |||
231 | filename = getname(name); | ||
232 | error = PTR_ERR(filename); | ||
233 | if (IS_ERR(filename)) | ||
234 | return error; | ||
235 | error = do_execve(filename, argv, envp, __frame); | ||
236 | putname(filename); | ||
237 | return error; | ||
238 | } | ||
239 | |||
240 | unsigned long get_wchan(struct task_struct *p) | 220 | unsigned long get_wchan(struct task_struct *p) |
241 | { | 221 | { |
242 | struct pt_regs *regs0; | 222 | struct pt_regs *regs0; |
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 864c2f0d497b..535810a3217a 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
21 | #include <linux/unistd.h> | 21 | #include <linux/unistd.h> |
22 | #include <linux/personality.h> | 22 | #include <linux/personality.h> |
23 | #include <linux/freezer.h> | ||
24 | #include <linux/tracehook.h> | 23 | #include <linux/tracehook.h> |
25 | #include <asm/ucontext.h> | 24 | #include <asm/ucontext.h> |
26 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
@@ -298,10 +297,6 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) | |||
298 | __frame->lr = (unsigned long) &frame->retcode; | 297 | __frame->lr = (unsigned long) &frame->retcode; |
299 | __frame->gr8 = sig; | 298 | __frame->gr8 = sig; |
300 | 299 | ||
301 | /* the tracer may want to single-step inside the handler */ | ||
302 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
303 | ptrace_notify(SIGTRAP); | ||
304 | |||
305 | #if DEBUG_SIG | 300 | #if DEBUG_SIG |
306 | printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", | 301 | printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", |
307 | sig, current->comm, current->pid, frame, __frame->pc, | 302 | sig, current->comm, current->pid, frame, __frame->pc, |
@@ -400,10 +395,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
400 | __frame->gr8 = sig; | 395 | __frame->gr8 = sig; |
401 | __frame->gr9 = (unsigned long) &frame->info; | 396 | __frame->gr9 = (unsigned long) &frame->info; |
402 | 397 | ||
403 | /* the tracer may want to single-step inside the handler */ | ||
404 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
405 | ptrace_notify(SIGTRAP); | ||
406 | |||
407 | #if DEBUG_SIG | 398 | #if DEBUG_SIG |
408 | printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", | 399 | printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", |
409 | sig, current->comm, current->pid, frame, __frame->pc, | 400 | sig, current->comm, current->pid, frame, __frame->pc, |
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h index 9c126e0c09aa..ec2f7777c65a 100644 --- a/arch/h8300/include/asm/thread_info.h +++ b/arch/h8300/include/asm/thread_info.h | |||
@@ -85,8 +85,6 @@ static inline struct thread_info *current_thread_info(void) | |||
85 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 85 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
86 | #define TIF_SIGPENDING 1 /* signal pending */ | 86 | #define TIF_SIGPENDING 1 /* signal pending */ |
87 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 87 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
88 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
89 | TIF_NEED_RESCHED */ | ||
90 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ | 88 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ |
91 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | 89 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
92 | #define TIF_NOTIFY_RESUME 6 /* callback before returning to user */ | 90 | #define TIF_NOTIFY_RESUME 6 /* callback before returning to user */ |
@@ -95,11 +93,10 @@ static inline struct thread_info *current_thread_info(void) | |||
95 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 93 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
96 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 94 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
97 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 95 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
98 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
99 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
100 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 96 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
101 | 97 | ||
102 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 98 | #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ |
99 | _TIF_NOTIFY_RESUME) | ||
103 | 100 | ||
104 | #endif /* __KERNEL__ */ | 101 | #endif /* __KERNEL__ */ |
105 | 102 | ||
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index 5adaadaf9218..0e81b96c642f 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/personality.h> | 38 | #include <linux/personality.h> |
39 | #include <linux/tty.h> | 39 | #include <linux/tty.h> |
40 | #include <linux/binfmts.h> | 40 | #include <linux/binfmts.h> |
41 | #include <linux/freezer.h> | ||
42 | #include <linux/tracehook.h> | 41 | #include <linux/tracehook.h> |
43 | 42 | ||
44 | #include <asm/setup.h> | 43 | #include <asm/setup.h> |
diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h index 4f936a7ee847..e4a0aad69cbb 100644 --- a/arch/hexagon/include/asm/thread_info.h +++ b/arch/hexagon/include/asm/thread_info.h | |||
@@ -120,10 +120,8 @@ register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG); | |||
120 | #define TIF_SIGPENDING 2 /* signal pending */ | 120 | #define TIF_SIGPENDING 2 /* signal pending */ |
121 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 121 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
122 | #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */ | 122 | #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */ |
123 | #define TIF_IRET 5 /* return with iret */ | ||
124 | #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */ | 123 | #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */ |
125 | /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 124 | /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
126 | #define TIF_POLLING_NRFLAG 16 | ||
127 | #define TIF_MEMDIE 17 /* OOM killer killed process */ | 125 | #define TIF_MEMDIE 17 /* OOM killer killed process */ |
128 | 126 | ||
129 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 127 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
@@ -131,9 +129,6 @@ register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG); | |||
131 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 129 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
132 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 130 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
133 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 131 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
134 | #define _TIF_IRET (1 << TIF_IRET) | ||
135 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
136 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
137 | 132 | ||
138 | /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */ | 133 | /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */ |
139 | #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE) | 134 | #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE) |
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c index 304b0808d072..1ea16bec7b91 100644 --- a/arch/hexagon/kernel/signal.c +++ b/arch/hexagon/kernel/signal.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <linux/linkage.h> | 21 | #include <linux/linkage.h> |
22 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
23 | #include <linux/freezer.h> | ||
24 | #include <linux/tracehook.h> | 23 | #include <linux/tracehook.h> |
25 | #include <asm/registers.h> | 24 | #include <asm/registers.h> |
26 | #include <asm/thread_info.h> | 25 | #include <asm/thread_info.h> |
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h index f7ee85378311..ff2ae4136584 100644 --- a/arch/ia64/include/asm/thread_info.h +++ b/arch/ia64/include/asm/thread_info.h | |||
@@ -106,7 +106,6 @@ struct thread_info { | |||
106 | #define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ | 106 | #define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ |
107 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ | 107 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ |
108 | #define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ | 108 | #define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ |
109 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
110 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ | 109 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ |
111 | #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ | 110 | #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ |
112 | #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ | 111 | #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ |
@@ -119,7 +118,6 @@ struct thread_info { | |||
119 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 118 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
120 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 119 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
121 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 120 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
122 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
123 | #define _TIF_MCA_INIT (1 << TIF_MCA_INIT) | 121 | #define _TIF_MCA_INIT (1 << TIF_MCA_INIT) |
124 | #define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) | 122 | #define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) |
125 | #define _TIF_RESTORE_RSE (1 << TIF_RESTORE_RSE) | 123 | #define _TIF_RESTORE_RSE (1 << TIF_RESTORE_RSE) |
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 37dd79511cbe..680b73786be8 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -438,14 +438,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
438 | long errno = scr->pt.r8; | 438 | long errno = scr->pt.r8; |
439 | 439 | ||
440 | /* | 440 | /* |
441 | * In the ia64_leave_kernel code path, we want the common case to go fast, which | ||
442 | * is why we may in certain cases get here from kernel mode. Just return without | ||
443 | * doing anything if so. | ||
444 | */ | ||
445 | if (!user_mode(&scr->pt)) | ||
446 | return; | ||
447 | |||
448 | /* | ||
449 | * This only loops in the rare cases of handle_signal() failing, in which case we | 441 | * This only loops in the rare cases of handle_signal() failing, in which case we |
450 | * need to push through a forced SIGSEGV. | 442 | * need to push through a forced SIGSEGV. |
451 | */ | 443 | */ |
diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h index c083f6073ef4..c074f4c2e858 100644 --- a/arch/m32r/include/asm/thread_info.h +++ b/arch/m32r/include/asm/thread_info.h | |||
@@ -119,25 +119,20 @@ static inline unsigned int get_thread_fault_code(void) | |||
119 | #define TIF_SIGPENDING 1 /* signal pending */ | 119 | #define TIF_SIGPENDING 1 /* signal pending */ |
120 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 120 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
121 | #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ | 121 | #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ |
122 | #define TIF_IRET 4 /* return with iret */ | ||
123 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ | 122 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ |
124 | #define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */ | 123 | #define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */ |
125 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 124 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ |
126 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
127 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 125 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
128 | 126 | ||
129 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 127 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
130 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 128 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
131 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 129 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
132 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 130 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
133 | #define _TIF_IRET (1<<TIF_IRET) | ||
134 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 131 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
135 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
136 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 132 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
137 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
138 | 133 | ||
139 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 134 | #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) |
140 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | 135 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE) |
141 | 136 | ||
142 | /* | 137 | /* |
143 | * Thread-synchronous status. | 138 | * Thread-synchronous status. |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index d0f60b97bbc5..6e3c26a1607c 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/unistd.h> | 20 | #include <linux/unistd.h> |
21 | #include <linux/stddef.h> | 21 | #include <linux/stddef.h> |
22 | #include <linux/personality.h> | 22 | #include <linux/personality.h> |
23 | #include <linux/freezer.h> | ||
24 | #include <linux/tracehook.h> | 23 | #include <linux/tracehook.h> |
25 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
26 | #include <asm/ucontext.h> | 25 | #include <asm/ucontext.h> |
@@ -366,6 +365,4 @@ void do_notify_resume(struct pt_regs *regs, __u32 thread_info_flags) | |||
366 | clear_thread_flag(TIF_NOTIFY_RESUME); | 365 | clear_thread_flag(TIF_NOTIFY_RESUME); |
367 | tracehook_notify_resume(regs); | 366 | tracehook_notify_resume(regs); |
368 | } | 367 | } |
369 | |||
370 | clear_thread_flag(TIF_IRET); | ||
371 | } | 368 | } |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index dae1e7e16a37..76fd6e2f71da 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -15,6 +15,7 @@ config M68K | |||
15 | select FPU if MMU | 15 | select FPU if MMU |
16 | select ARCH_WANT_IPC_PARSE_VERSION | 16 | select ARCH_WANT_IPC_PARSE_VERSION |
17 | select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE | 17 | select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE |
18 | select GENERIC_KERNEL_THREAD | ||
18 | 19 | ||
19 | config RWSEM_GENERIC_SPINLOCK | 20 | config RWSEM_GENERIC_SPINLOCK |
20 | bool | 21 | bool |
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h index f17c42aff7ff..ae700f49e51d 100644 --- a/arch/m68k/include/asm/processor.h +++ b/arch/m68k/include/asm/processor.h | |||
@@ -100,6 +100,16 @@ struct thread_struct { | |||
100 | .fs = __KERNEL_DS, \ | 100 | .fs = __KERNEL_DS, \ |
101 | } | 101 | } |
102 | 102 | ||
103 | /* | ||
104 | * ColdFire stack format sbould be 0x4 for an aligned usp (will always be | ||
105 | * true on thread creation). We need to set this explicitly. | ||
106 | */ | ||
107 | #ifdef CONFIG_COLDFIRE | ||
108 | #define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0) | ||
109 | #else | ||
110 | #define setframeformat(_regs) do { } while (0) | ||
111 | #endif | ||
112 | |||
103 | #ifdef CONFIG_MMU | 113 | #ifdef CONFIG_MMU |
104 | /* | 114 | /* |
105 | * Do necessary setup to start up a newly executed thread. | 115 | * Do necessary setup to start up a newly executed thread. |
@@ -109,6 +119,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, | |||
109 | { | 119 | { |
110 | regs->pc = pc; | 120 | regs->pc = pc; |
111 | regs->sr &= ~0x2000; | 121 | regs->sr &= ~0x2000; |
122 | setframeformat(regs); | ||
112 | wrusp(usp); | 123 | wrusp(usp); |
113 | } | 124 | } |
114 | 125 | ||
@@ -116,21 +127,11 @@ extern int handle_kernel_fault(struct pt_regs *regs); | |||
116 | 127 | ||
117 | #else | 128 | #else |
118 | 129 | ||
119 | /* | ||
120 | * Coldfire stacks need to be re-aligned on trap exit, conventional | ||
121 | * 68k can handle this case cleanly. | ||
122 | */ | ||
123 | #ifdef CONFIG_COLDFIRE | ||
124 | #define reformat(_regs) do { (_regs)->format = 0x4; } while(0) | ||
125 | #else | ||
126 | #define reformat(_regs) do { } while (0) | ||
127 | #endif | ||
128 | |||
129 | #define start_thread(_regs, _pc, _usp) \ | 130 | #define start_thread(_regs, _pc, _usp) \ |
130 | do { \ | 131 | do { \ |
131 | (_regs)->pc = (_pc); \ | 132 | (_regs)->pc = (_pc); \ |
132 | ((struct switch_stack *)(_regs))[-1].a6 = 0; \ | 133 | ((struct switch_stack *)(_regs))[-1].a6 = 0; \ |
133 | reformat(_regs); \ | 134 | setframeformat(_regs); \ |
134 | if (current->mm) \ | 135 | if (current->mm) \ |
135 | (_regs)->d5 = current->mm->start_data; \ | 136 | (_regs)->d5 = current->mm->start_data; \ |
136 | (_regs)->sr &= ~0x2000; \ | 137 | (_regs)->sr &= ~0x2000; \ |
@@ -153,8 +154,6 @@ static inline void release_thread(struct task_struct *dead_task) | |||
153 | { | 154 | { |
154 | } | 155 | } |
155 | 156 | ||
156 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
157 | |||
158 | /* | 157 | /* |
159 | * Free current thread data structures etc.. | 158 | * Free current thread data structures etc.. |
160 | */ | 159 | */ |
diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h index 65322b17b6cf..5e08b597f012 100644 --- a/arch/m68k/include/asm/ptrace.h +++ b/arch/m68k/include/asm/ptrace.h | |||
@@ -85,6 +85,8 @@ struct switch_stack { | |||
85 | #define user_mode(regs) (!((regs)->sr & PS_S)) | 85 | #define user_mode(regs) (!((regs)->sr & PS_S)) |
86 | #define instruction_pointer(regs) ((regs)->pc) | 86 | #define instruction_pointer(regs) ((regs)->pc) |
87 | #define profile_pc(regs) instruction_pointer(regs) | 87 | #define profile_pc(regs) instruction_pointer(regs) |
88 | #define current_pt_regs() \ | ||
89 | (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1 | ||
88 | 90 | ||
89 | #define arch_has_single_step() (1) | 91 | #define arch_has_single_step() (1) |
90 | 92 | ||
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 045cfd6a9e31..c702ad716791 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -382,6 +382,8 @@ | |||
382 | #define __ARCH_WANT_SYS_SIGPROCMASK | 382 | #define __ARCH_WANT_SYS_SIGPROCMASK |
383 | #define __ARCH_WANT_SYS_RT_SIGACTION | 383 | #define __ARCH_WANT_SYS_RT_SIGACTION |
384 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 384 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
385 | #define __ARCH_WANT_SYS_EXECVE | ||
386 | #define __ARCH_WANT_KERNEL_EXECVE | ||
385 | 387 | ||
386 | /* | 388 | /* |
387 | * "Conditional" syscalls | 389 | * "Conditional" syscalls |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 165ee9f9d5c9..946cb0187751 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -111,6 +111,22 @@ ENTRY(ret_from_fork) | |||
111 | addql #4,%sp | 111 | addql #4,%sp |
112 | jra ret_from_exception | 112 | jra ret_from_exception |
113 | 113 | ||
114 | ENTRY(ret_from_kernel_thread) | ||
115 | | a3 contains the kernel thread payload, d7 - its argument | ||
116 | movel %d1,%sp@- | ||
117 | jsr schedule_tail | ||
118 | GET_CURRENT(%d0) | ||
119 | movel %d7,(%sp) | ||
120 | jsr %a3@ | ||
121 | addql #4,%sp | ||
122 | movel %d0,(%sp) | ||
123 | jra sys_exit | ||
124 | |||
125 | ENTRY(ret_from_kernel_execve) | ||
126 | movel 4(%sp), %sp | ||
127 | GET_CURRENT(%d0) | ||
128 | jra ret_from_exception | ||
129 | |||
114 | #if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU) | 130 | #if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU) |
115 | 131 | ||
116 | #ifdef TRAP_DBG_INTERRUPT | 132 | #ifdef TRAP_DBG_INTERRUPT |
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index ac2892e49c7c..c51bb172e14d 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | 36 | ||
37 | asmlinkage void ret_from_fork(void); | 37 | asmlinkage void ret_from_fork(void); |
38 | asmlinkage void ret_from_kernel_thread(void); | ||
38 | 39 | ||
39 | 40 | ||
40 | /* | 41 | /* |
@@ -123,51 +124,6 @@ void show_regs(struct pt_regs * regs) | |||
123 | printk("USP: %08lx\n", rdusp()); | 124 | printk("USP: %08lx\n", rdusp()); |
124 | } | 125 | } |
125 | 126 | ||
126 | /* | ||
127 | * Create a kernel thread | ||
128 | */ | ||
129 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | ||
130 | { | ||
131 | int pid; | ||
132 | mm_segment_t fs; | ||
133 | |||
134 | fs = get_fs(); | ||
135 | set_fs (KERNEL_DS); | ||
136 | |||
137 | { | ||
138 | register long retval __asm__ ("d0"); | ||
139 | register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED; | ||
140 | |||
141 | retval = __NR_clone; | ||
142 | __asm__ __volatile__ | ||
143 | ("clrl %%d2\n\t" | ||
144 | "trap #0\n\t" /* Linux/m68k system call */ | ||
145 | "tstl %0\n\t" /* child or parent */ | ||
146 | "jne 1f\n\t" /* parent - jump */ | ||
147 | #ifdef CONFIG_MMU | ||
148 | "lea %%sp@(%c7),%6\n\t" /* reload current */ | ||
149 | "movel %6@,%6\n\t" | ||
150 | #endif | ||
151 | "movel %3,%%sp@-\n\t" /* push argument */ | ||
152 | "jsr %4@\n\t" /* call fn */ | ||
153 | "movel %0,%%d1\n\t" /* pass exit value */ | ||
154 | "movel %2,%%d0\n\t" /* exit */ | ||
155 | "trap #0\n" | ||
156 | "1:" | ||
157 | : "+d" (retval) | ||
158 | : "i" (__NR_clone), "i" (__NR_exit), | ||
159 | "r" (arg), "a" (fn), "d" (clone_arg), "r" (current), | ||
160 | "i" (-THREAD_SIZE) | ||
161 | : "d2"); | ||
162 | |||
163 | pid = retval; | ||
164 | } | ||
165 | |||
166 | set_fs (fs); | ||
167 | return pid; | ||
168 | } | ||
169 | EXPORT_SYMBOL(kernel_thread); | ||
170 | |||
171 | void flush_thread(void) | 127 | void flush_thread(void) |
172 | { | 128 | { |
173 | current->thread.fs = __USER_DS; | 129 | current->thread.fs = __USER_DS; |
@@ -219,30 +175,18 @@ asmlinkage int m68k_clone(struct pt_regs *regs) | |||
219 | } | 175 | } |
220 | 176 | ||
221 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 177 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
222 | unsigned long unused, | 178 | unsigned long arg, |
223 | struct task_struct * p, struct pt_regs * regs) | 179 | struct task_struct * p, struct pt_regs * regs) |
224 | { | 180 | { |
225 | struct pt_regs * childregs; | 181 | struct pt_regs * childregs; |
226 | struct switch_stack * childstack, *stack; | 182 | struct switch_stack *childstack; |
227 | unsigned long *retp; | ||
228 | 183 | ||
229 | childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; | 184 | childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; |
230 | |||
231 | *childregs = *regs; | ||
232 | childregs->d0 = 0; | ||
233 | |||
234 | retp = ((unsigned long *) regs); | ||
235 | stack = ((struct switch_stack *) retp) - 1; | ||
236 | |||
237 | childstack = ((struct switch_stack *) childregs) - 1; | 185 | childstack = ((struct switch_stack *) childregs) - 1; |
238 | *childstack = *stack; | ||
239 | childstack->retpc = (unsigned long)ret_from_fork; | ||
240 | 186 | ||
241 | p->thread.usp = usp; | 187 | p->thread.usp = usp; |
242 | p->thread.ksp = (unsigned long)childstack; | 188 | p->thread.ksp = (unsigned long)childstack; |
243 | 189 | p->thread.esp0 = (unsigned long)childregs; | |
244 | if (clone_flags & CLONE_SETTLS) | ||
245 | task_thread_info(p)->tp_value = regs->d5; | ||
246 | 190 | ||
247 | /* | 191 | /* |
248 | * Must save the current SFC/DFC value, NOT the value when | 192 | * Must save the current SFC/DFC value, NOT the value when |
@@ -250,6 +194,26 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
250 | */ | 194 | */ |
251 | p->thread.fs = get_fs().seg; | 195 | p->thread.fs = get_fs().seg; |
252 | 196 | ||
197 | if (unlikely(!regs)) { | ||
198 | /* kernel thread */ | ||
199 | memset(childstack, 0, | ||
200 | sizeof(struct switch_stack) + sizeof(struct pt_regs)); | ||
201 | childregs->sr = PS_S; | ||
202 | childstack->a3 = usp; /* function */ | ||
203 | childstack->d7 = arg; | ||
204 | childstack->retpc = (unsigned long)ret_from_kernel_thread; | ||
205 | p->thread.usp = 0; | ||
206 | return 0; | ||
207 | } | ||
208 | *childregs = *regs; | ||
209 | childregs->d0 = 0; | ||
210 | |||
211 | *childstack = ((struct switch_stack *) regs)[-1]; | ||
212 | childstack->retpc = (unsigned long)ret_from_fork; | ||
213 | |||
214 | if (clone_flags & CLONE_SETTLS) | ||
215 | task_thread_info(p)->tp_value = regs->d5; | ||
216 | |||
253 | #ifdef CONFIG_FPU | 217 | #ifdef CONFIG_FPU |
254 | if (!FPU_IS_EMU) { | 218 | if (!FPU_IS_EMU) { |
255 | /* Copy the current fpu state */ | 219 | /* Copy the current fpu state */ |
@@ -337,26 +301,6 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) | |||
337 | EXPORT_SYMBOL(dump_fpu); | 301 | EXPORT_SYMBOL(dump_fpu); |
338 | #endif /* CONFIG_FPU */ | 302 | #endif /* CONFIG_FPU */ |
339 | 303 | ||
340 | /* | ||
341 | * sys_execve() executes a new program. | ||
342 | */ | ||
343 | asmlinkage int sys_execve(const char __user *name, | ||
344 | const char __user *const __user *argv, | ||
345 | const char __user *const __user *envp) | ||
346 | { | ||
347 | int error; | ||
348 | char * filename; | ||
349 | struct pt_regs *regs = (struct pt_regs *) &name; | ||
350 | |||
351 | filename = getname(name); | ||
352 | error = PTR_ERR(filename); | ||
353 | if (IS_ERR(filename)) | ||
354 | return error; | ||
355 | error = do_execve(filename, argv, envp, regs); | ||
356 | putname(filename); | ||
357 | return error; | ||
358 | } | ||
359 | |||
360 | unsigned long get_wchan(struct task_struct *p) | 304 | unsigned long get_wchan(struct task_struct *p) |
361 | { | 305 | { |
362 | unsigned long fp, pc; | 306 | unsigned long fp, pc; |
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 9a5932ec3689..3a480b3df0d6 100644 --- a/arch/m68k/kernel/sys_m68k.c +++ b/arch/m68k/kernel/sys_m68k.c | |||
@@ -549,23 +549,6 @@ asmlinkage int sys_getpagesize(void) | |||
549 | return PAGE_SIZE; | 549 | return PAGE_SIZE; |
550 | } | 550 | } |
551 | 551 | ||
552 | /* | ||
553 | * Do a system call from kernel instead of calling sys_execve so we | ||
554 | * end up with proper pt_regs. | ||
555 | */ | ||
556 | int kernel_execve(const char *filename, | ||
557 | const char *const argv[], | ||
558 | const char *const envp[]) | ||
559 | { | ||
560 | register long __res asm ("%d0") = __NR_execve; | ||
561 | register long __a asm ("%d1") = (long)(filename); | ||
562 | register long __b asm ("%d2") = (long)(argv); | ||
563 | register long __c asm ("%d3") = (long)(envp); | ||
564 | asm volatile ("trap #0" : "+d" (__res) | ||
565 | : "d" (__a), "d" (__b), "d" (__c)); | ||
566 | return __res; | ||
567 | } | ||
568 | |||
569 | asmlinkage unsigned long sys_get_thread_area(void) | 552 | asmlinkage unsigned long sys_get_thread_area(void) |
570 | { | 553 | { |
571 | return current_thread_info()->tp_value; | 554 | return current_thread_info()->tp_value; |
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h index 6c610234ffab..008f30433d22 100644 --- a/arch/microblaze/include/asm/thread_info.h +++ b/arch/microblaze/include/asm/thread_info.h | |||
@@ -121,7 +121,6 @@ static inline struct thread_info *current_thread_info(void) | |||
121 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 121 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
122 | /* restore singlestep on return to user mode */ | 122 | /* restore singlestep on return to user mode */ |
123 | #define TIF_SINGLESTEP 4 | 123 | #define TIF_SINGLESTEP 4 |
124 | #define TIF_IRET 5 /* return with iret */ | ||
125 | #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ | 124 | #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ |
126 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ | 125 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ |
127 | #define TIF_SECCOMP 10 /* secure computing */ | 126 | #define TIF_SECCOMP 10 /* secure computing */ |
@@ -134,7 +133,6 @@ static inline struct thread_info *current_thread_info(void) | |||
134 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 133 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
135 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 134 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
136 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 135 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
137 | #define _TIF_IRET (1 << TIF_IRET) | ||
138 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 136 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
139 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | 137 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
140 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | 138 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
@@ -184,6 +182,7 @@ static inline bool test_and_clear_restore_sigmask(void) | |||
184 | ti->status &= ~TS_RESTORE_SIGMASK; | 182 | ti->status &= ~TS_RESTORE_SIGMASK; |
185 | return true; | 183 | return true; |
186 | } | 184 | } |
185 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
187 | #endif | 186 | #endif |
188 | 187 | ||
189 | #endif /* __KERNEL__ */ | 188 | #endif /* __KERNEL__ */ |
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index c1220dbf87cd..3847e5b9c601 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -254,10 +254,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
254 | 254 | ||
255 | set_fs(USER_DS); | 255 | set_fs(USER_DS); |
256 | 256 | ||
257 | /* the tracer may want to single-step inside the handler */ | ||
258 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
259 | ptrace_notify(SIGTRAP); | ||
260 | |||
261 | #ifdef DEBUG_SIG | 257 | #ifdef DEBUG_SIG |
262 | printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n", | 258 | printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n", |
263 | current->comm, current->pid, frame, regs->pc); | 259 | current->comm, current->pid, frame, regs->pc); |
@@ -315,7 +311,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
315 | if (ret) | 311 | if (ret) |
316 | return; | 312 | return; |
317 | 313 | ||
318 | signal_delivered(sig, info, ka, regs, 0); | 314 | signal_delivered(sig, info, ka, regs, |
315 | test_thread_flag(TIF_SINGLESTEP)); | ||
319 | } | 316 | } |
320 | 317 | ||
321 | /* | 318 | /* |
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index 946e010f2018..8debe9e91754 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
@@ -103,7 +103,6 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
103 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ | 103 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ |
104 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | 104 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
105 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 105 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ |
106 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
107 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 106 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
108 | #define TIF_FIXADE 20 /* Fix address errors in software */ | 107 | #define TIF_FIXADE 20 /* Fix address errors in software */ |
109 | #define TIF_LOGADE 21 /* Log address errors to syslog */ | 108 | #define TIF_LOGADE 21 /* Log address errors to syslog */ |
@@ -125,9 +124,7 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
125 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 124 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
126 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 125 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
127 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 126 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
128 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
129 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 127 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
130 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
131 | #define _TIF_FIXADE (1<<TIF_FIXADE) | 128 | #define _TIF_FIXADE (1<<TIF_FIXADE) |
132 | #define _TIF_LOGADE (1<<TIF_LOGADE) | 129 | #define _TIF_LOGADE (1<<TIF_LOGADE) |
133 | #define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS) | 130 | #define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS) |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 5cfb086b3903..ddbdc33471a8 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -8,6 +8,7 @@ config MN10300 | |||
8 | select HAVE_ARCH_KGDB | 8 | select HAVE_ARCH_KGDB |
9 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER | 9 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER |
10 | select GENERIC_CLOCKEVENTS | 10 | select GENERIC_CLOCKEVENTS |
11 | select GENERIC_KERNEL_THREAD | ||
11 | 12 | ||
12 | config AM33_2 | 13 | config AM33_2 |
13 | def_bool n | 14 | def_bool n |
diff --git a/arch/mn10300/include/asm/frame.inc b/arch/mn10300/include/asm/frame.inc index 2ee58e3eb6b3..1c3eb4fda958 100644 --- a/arch/mn10300/include/asm/frame.inc +++ b/arch/mn10300/include/asm/frame.inc | |||
@@ -61,7 +61,7 @@ | |||
61 | ############################################################################### | 61 | ############################################################################### |
62 | .macro RESTORE_ALL | 62 | .macro RESTORE_ALL |
63 | # peel back the stack to the calling frame | 63 | # peel back the stack to the calling frame |
64 | # - this permits execve() to discard extra frames due to kernel syscalls | 64 | # - we need that when returning from interrupts to kernel mode |
65 | GET_THREAD_INFO a0 | 65 | GET_THREAD_INFO a0 |
66 | mov (TI_frame,a0),fp | 66 | mov (TI_frame,a0),fp |
67 | mov fp,sp | 67 | mov fp,sp |
diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h index 247928c9f549..8b80b19d0c8a 100644 --- a/arch/mn10300/include/asm/processor.h +++ b/arch/mn10300/include/asm/processor.h | |||
@@ -119,20 +119,13 @@ struct thread_struct { | |||
119 | 119 | ||
120 | /* | 120 | /* |
121 | * do necessary setup to start up a newly executed thread | 121 | * do necessary setup to start up a newly executed thread |
122 | * - need to discard the frame stacked by the kernel thread invoking the execve | ||
123 | * syscall (see RESTORE_ALL macro) | ||
124 | */ | 122 | */ |
125 | static inline void start_thread(struct pt_regs *regs, | 123 | static inline void start_thread(struct pt_regs *regs, |
126 | unsigned long new_pc, unsigned long new_sp) | 124 | unsigned long new_pc, unsigned long new_sp) |
127 | { | 125 | { |
128 | struct thread_info *ti = current_thread_info(); | 126 | regs->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; |
129 | struct pt_regs *frame0; | 127 | regs->pc = new_pc; |
130 | 128 | regs->sp = new_sp; | |
131 | frame0 = thread_info_to_uregs(ti); | ||
132 | frame0->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; | ||
133 | frame0->pc = new_pc; | ||
134 | frame0->sp = new_sp; | ||
135 | ti->frame = frame0; | ||
136 | } | 129 | } |
137 | 130 | ||
138 | 131 | ||
@@ -140,11 +133,6 @@ static inline void start_thread(struct pt_regs *regs, | |||
140 | extern void release_thread(struct task_struct *); | 133 | extern void release_thread(struct task_struct *); |
141 | 134 | ||
142 | /* | 135 | /* |
143 | * create a kernel thread without removing it from tasklists | ||
144 | */ | ||
145 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
146 | |||
147 | /* | ||
148 | * Return saved PC of a blocked thread. | 136 | * Return saved PC of a blocked thread. |
149 | */ | 137 | */ |
150 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | 138 | extern unsigned long thread_saved_pc(struct task_struct *tsk); |
diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h index 44251b974f1d..08ac856c053e 100644 --- a/arch/mn10300/include/asm/ptrace.h +++ b/arch/mn10300/include/asm/ptrace.h | |||
@@ -86,6 +86,7 @@ struct pt_regs { | |||
86 | #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) | 86 | #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) |
87 | #define instruction_pointer(regs) ((regs)->pc) | 87 | #define instruction_pointer(regs) ((regs)->pc) |
88 | #define user_stack_pointer(regs) ((regs)->sp) | 88 | #define user_stack_pointer(regs) ((regs)->sp) |
89 | #define current_pt_regs() current_frame() | ||
89 | 90 | ||
90 | #define arch_has_single_step() (1) | 91 | #define arch_has_single_step() (1) |
91 | 92 | ||
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h index ac519bbd42ff..f90062b0622d 100644 --- a/arch/mn10300/include/asm/thread_info.h +++ b/arch/mn10300/include/asm/thread_info.h | |||
@@ -160,12 +160,13 @@ void arch_release_thread_info(struct thread_info *ti); | |||
160 | #define _TIF_SIGPENDING +(1 << TIF_SIGPENDING) | 160 | #define _TIF_SIGPENDING +(1 << TIF_SIGPENDING) |
161 | #define _TIF_NEED_RESCHED +(1 << TIF_NEED_RESCHED) | 161 | #define _TIF_NEED_RESCHED +(1 << TIF_NEED_RESCHED) |
162 | #define _TIF_SINGLESTEP +(1 << TIF_SINGLESTEP) | 162 | #define _TIF_SINGLESTEP +(1 << TIF_SINGLESTEP) |
163 | #define _TIF_RESTORE_SIGMASK +(1 << TIF_RESTORE_SIGMASK) | ||
164 | #define _TIF_POLLING_NRFLAG +(1 << TIF_POLLING_NRFLAG) | 163 | #define _TIF_POLLING_NRFLAG +(1 << TIF_POLLING_NRFLAG) |
165 | 164 | ||
166 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 165 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
167 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | 166 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ |
168 | 167 | ||
168 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
169 | |||
169 | #endif /* __KERNEL__ */ | 170 | #endif /* __KERNEL__ */ |
170 | 171 | ||
171 | #endif /* _ASM_THREAD_INFO_H */ | 172 | #endif /* _ASM_THREAD_INFO_H */ |
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 866eb14749d7..044c770adbb6 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h | |||
@@ -382,6 +382,8 @@ | |||
382 | #define __ARCH_WANT_SYS_SIGPROCMASK | 382 | #define __ARCH_WANT_SYS_SIGPROCMASK |
383 | #define __ARCH_WANT_SYS_RT_SIGACTION | 383 | #define __ARCH_WANT_SYS_RT_SIGACTION |
384 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 384 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
385 | #define __ARCH_WANT_SYS_EXECVE | ||
386 | #define __ARCH_WANT_KERNEL_EXECVE | ||
385 | 387 | ||
386 | /* | 388 | /* |
387 | * "Conditional" syscalls | 389 | * "Conditional" syscalls |
diff --git a/arch/mn10300/kernel/Makefile b/arch/mn10300/kernel/Makefile index d06749173d63..561029f7fa44 100644 --- a/arch/mn10300/kernel/Makefile +++ b/arch/mn10300/kernel/Makefile | |||
@@ -7,8 +7,8 @@ fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o | |||
7 | fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o | 7 | fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o |
8 | 8 | ||
9 | obj-y := process.o signal.o entry.o traps.o irq.o \ | 9 | obj-y := process.o signal.o entry.o traps.o irq.o \ |
10 | ptrace.o setup.o time.o sys_mn10300.o io.o kthread.o \ | 10 | ptrace.o setup.o time.o sys_mn10300.o io.o \ |
11 | switch_to.o mn10300_ksyms.o kernel_execve.o $(fpu-obj-y) \ | 11 | switch_to.o mn10300_ksyms.o $(fpu-obj-y) \ |
12 | csrc-mn10300.o cevt-mn10300.o | 12 | csrc-mn10300.o cevt-mn10300.o |
13 | 13 | ||
14 | obj-$(CONFIG_SMP) += smp.o smp-low.o | 14 | obj-$(CONFIG_SMP) += smp.o smp-low.o |
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S index 8e11f9f48999..0c631d34c8d7 100644 --- a/arch/mn10300/kernel/entry.S +++ b/arch/mn10300/kernel/entry.S | |||
@@ -55,6 +55,20 @@ ENTRY(ret_from_fork) | |||
55 | mov d0,(REG_D0,fp) | 55 | mov d0,(REG_D0,fp) |
56 | jmp syscall_exit | 56 | jmp syscall_exit |
57 | 57 | ||
58 | ENTRY(ret_from_kernel_thread) | ||
59 | call schedule_tail[],0 | ||
60 | mov (REG_D0,fp),d0 | ||
61 | mov (REG_A0,fp),a0 | ||
62 | calls (a0) | ||
63 | jmp sys_exit | ||
64 | |||
65 | ENTRY(ret_from_kernel_execve) | ||
66 | add -12,d0 /* pt_regs -> frame */ | ||
67 | mov d0,sp | ||
68 | GET_THREAD_INFO a2 | ||
69 | clr d0 | ||
70 | jmp syscall_exit | ||
71 | |||
58 | ############################################################################### | 72 | ############################################################################### |
59 | # | 73 | # |
60 | # system call handler | 74 | # system call handler |
@@ -94,6 +108,10 @@ restore_all: | |||
94 | ############################################################################### | 108 | ############################################################################### |
95 | ALIGN | 109 | ALIGN |
96 | syscall_exit_work: | 110 | syscall_exit_work: |
111 | mov (REG_EPSW,fp),d0 | ||
112 | and EPSW_nSL,d0 | ||
113 | beq resume_kernel # returning to supervisor mode | ||
114 | |||
97 | btst _TIF_SYSCALL_TRACE,d2 | 115 | btst _TIF_SYSCALL_TRACE,d2 |
98 | beq work_pending | 116 | beq work_pending |
99 | LOCAL_IRQ_ENABLE # could let syscall_trace_exit() call | 117 | LOCAL_IRQ_ENABLE # could let syscall_trace_exit() call |
diff --git a/arch/mn10300/kernel/internal.h b/arch/mn10300/kernel/internal.h index 2df440105a80..561785581f6c 100644 --- a/arch/mn10300/kernel/internal.h +++ b/arch/mn10300/kernel/internal.h | |||
@@ -15,14 +15,10 @@ struct clocksource; | |||
15 | struct clock_event_device; | 15 | struct clock_event_device; |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * kthread.S | ||
19 | */ | ||
20 | extern int kernel_thread_helper(int); | ||
21 | |||
22 | /* | ||
23 | * entry.S | 18 | * entry.S |
24 | */ | 19 | */ |
25 | extern void ret_from_fork(struct task_struct *) __attribute__((noreturn)); | 20 | extern void ret_from_fork(struct task_struct *) __attribute__((noreturn)); |
21 | extern void ret_from_kernel_thread(struct task_struct *) __attribute__((noreturn)); | ||
26 | 22 | ||
27 | /* | 23 | /* |
28 | * smp-low.S | 24 | * smp-low.S |
diff --git a/arch/mn10300/kernel/kernel_execve.S b/arch/mn10300/kernel/kernel_execve.S deleted file mode 100644 index 86039f105268..000000000000 --- a/arch/mn10300/kernel/kernel_execve.S +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* MN10300 In-kernel program execution | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/linkage.h> | ||
12 | #include <asm/unistd.h> | ||
13 | |||
14 | ############################################################################### | ||
15 | # | ||
16 | # Do a system call from kernel instead of calling sys_execve so we end up with | ||
17 | # proper pt_regs. | ||
18 | # | ||
19 | # int kernel_execve(const char *filename, char *const argv[], | ||
20 | # char *const envp[]) | ||
21 | # | ||
22 | # On entry: D0/D1/8(SP): arguments to function | ||
23 | # On return: D0: syscall return. | ||
24 | # | ||
25 | ############################################################################### | ||
26 | .globl kernel_execve | ||
27 | .type kernel_execve,@function | ||
28 | kernel_execve: | ||
29 | mov a3,a1 | ||
30 | mov d0,a0 | ||
31 | mov (12,sp),a3 | ||
32 | mov +__NR_execve,d0 | ||
33 | syscall 0 | ||
34 | mov a1,a3 | ||
35 | rets | ||
36 | |||
37 | .size kernel_execve,.-kernel_execve | ||
diff --git a/arch/mn10300/kernel/kthread.S b/arch/mn10300/kernel/kthread.S deleted file mode 100644 index b5ae467ac5ec..000000000000 --- a/arch/mn10300/kernel/kthread.S +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* MN10300 Kernel thread trampoline function | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by Mark Salter (msalter@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | .text | ||
12 | |||
13 | ############################################################################### | ||
14 | # | ||
15 | # kernel_thread_helper - trampoline for kernel_thread() | ||
16 | # | ||
17 | # On entry: | ||
18 | # A2 = address of function to call | ||
19 | # D2 = function argument | ||
20 | # | ||
21 | ############################################################################### | ||
22 | .globl kernel_thread_helper | ||
23 | .type kernel_thread_helper,@function | ||
24 | kernel_thread_helper: | ||
25 | mov do_exit,d1 | ||
26 | mov d1,(sp) | ||
27 | mov d1,mdr | ||
28 | mov d2,d0 | ||
29 | jmp (a2) | ||
30 | |||
31 | .size kernel_thread_helper,.-kernel_thread_helper | ||
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index e9cceba193b6..d0c671b6d9ff 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -165,27 +165,6 @@ void show_regs(struct pt_regs *regs) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * create a kernel thread | ||
169 | */ | ||
170 | int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
171 | { | ||
172 | struct pt_regs regs; | ||
173 | |||
174 | memset(®s, 0, sizeof(regs)); | ||
175 | |||
176 | regs.a2 = (unsigned long) fn; | ||
177 | regs.d2 = (unsigned long) arg; | ||
178 | regs.pc = (unsigned long) kernel_thread_helper; | ||
179 | local_save_flags(regs.epsw); | ||
180 | regs.epsw |= EPSW_IE | EPSW_IM_7; | ||
181 | |||
182 | /* Ok, create the new process.. */ | ||
183 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, | ||
184 | NULL, NULL); | ||
185 | } | ||
186 | EXPORT_SYMBOL(kernel_thread); | ||
187 | |||
188 | /* | ||
189 | * free current thread data structures etc.. | 168 | * free current thread data structures etc.. |
190 | */ | 169 | */ |
191 | void exit_thread(void) | 170 | void exit_thread(void) |
@@ -230,50 +209,42 @@ int copy_thread(unsigned long clone_flags, | |||
230 | struct task_struct *p, struct pt_regs *kregs) | 209 | struct task_struct *p, struct pt_regs *kregs) |
231 | { | 210 | { |
232 | struct thread_info *ti = task_thread_info(p); | 211 | struct thread_info *ti = task_thread_info(p); |
233 | struct pt_regs *c_uregs, *c_kregs, *uregs; | 212 | struct pt_regs *c_regs; |
234 | unsigned long c_ksp; | 213 | unsigned long c_ksp; |
235 | 214 | ||
236 | uregs = current->thread.uregs; | ||
237 | |||
238 | c_ksp = (unsigned long) task_stack_page(p) + THREAD_SIZE; | 215 | c_ksp = (unsigned long) task_stack_page(p) + THREAD_SIZE; |
239 | 216 | ||
240 | /* allocate the userspace exception frame and set it up */ | 217 | /* allocate the userspace exception frame and set it up */ |
241 | c_ksp -= sizeof(struct pt_regs); | 218 | c_ksp -= sizeof(struct pt_regs); |
242 | c_uregs = (struct pt_regs *) c_ksp; | 219 | c_regs = (struct pt_regs *) c_ksp; |
220 | c_ksp -= 12; /* allocate function call ABI slack */ | ||
243 | 221 | ||
244 | p->thread.uregs = c_uregs; | 222 | /* set up things up so the scheduler can start the new task */ |
245 | *c_uregs = *uregs; | 223 | p->thread.uregs = c_regs; |
246 | c_uregs->sp = c_usp; | 224 | ti->frame = c_regs; |
247 | c_uregs->epsw &= ~EPSW_FE; /* my FPU */ | 225 | p->thread.a3 = (unsigned long) c_regs; |
226 | p->thread.sp = c_ksp; | ||
227 | p->thread.wchan = p->thread.pc; | ||
228 | p->thread.usp = c_usp; | ||
248 | 229 | ||
249 | c_ksp -= 12; /* allocate function call ABI slack */ | 230 | if (unlikely(!kregs)) { |
231 | memset(c_regs, 0, sizeof(struct pt_regs)); | ||
232 | c_regs->a0 = c_usp; /* function */ | ||
233 | c_regs->d0 = ustk_size; /* argument */ | ||
234 | local_save_flags(c_regs->epsw); | ||
235 | c_regs->epsw |= EPSW_IE | EPSW_IM_7; | ||
236 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | ||
237 | return 0; | ||
238 | } | ||
239 | *c_regs = *kregs; | ||
240 | c_regs->sp = c_usp; | ||
241 | c_regs->epsw &= ~EPSW_FE; /* my FPU */ | ||
250 | 242 | ||
251 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ | 243 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ |
252 | if (clone_flags & CLONE_SETTLS) | 244 | if (clone_flags & CLONE_SETTLS) |
253 | c_uregs->e2 = current_frame()->d3; | 245 | c_regs->e2 = current_frame()->d3; |
254 | |||
255 | /* set up the return kernel frame if called from kernel_thread() */ | ||
256 | c_kregs = c_uregs; | ||
257 | if (kregs != uregs) { | ||
258 | c_ksp -= sizeof(struct pt_regs); | ||
259 | c_kregs = (struct pt_regs *) c_ksp; | ||
260 | *c_kregs = *kregs; | ||
261 | c_kregs->sp = c_usp; | ||
262 | c_kregs->next = c_uregs; | ||
263 | #ifdef CONFIG_MN10300_CURRENT_IN_E2 | ||
264 | c_kregs->e2 = (unsigned long) p; /* current */ | ||
265 | #endif | ||
266 | |||
267 | c_ksp -= 12; /* allocate function call ABI slack */ | ||
268 | } | ||
269 | 246 | ||
270 | /* set up things up so the scheduler can start the new task */ | ||
271 | ti->frame = c_kregs; | ||
272 | p->thread.a3 = (unsigned long) c_kregs; | ||
273 | p->thread.sp = c_ksp; | ||
274 | p->thread.pc = (unsigned long) ret_from_fork; | 247 | p->thread.pc = (unsigned long) ret_from_fork; |
275 | p->thread.wchan = (unsigned long) ret_from_fork; | ||
276 | p->thread.usp = c_usp; | ||
277 | 248 | ||
278 | return 0; | 249 | return 0; |
279 | } | 250 | } |
@@ -302,22 +273,6 @@ asmlinkage long sys_vfork(void) | |||
302 | current_frame(), 0, NULL, NULL); | 273 | current_frame(), 0, NULL, NULL); |
303 | } | 274 | } |
304 | 275 | ||
305 | asmlinkage long sys_execve(const char __user *name, | ||
306 | const char __user *const __user *argv, | ||
307 | const char __user *const __user *envp) | ||
308 | { | ||
309 | char *filename; | ||
310 | int error; | ||
311 | |||
312 | filename = getname(name); | ||
313 | error = PTR_ERR(filename); | ||
314 | if (IS_ERR(filename)) | ||
315 | return error; | ||
316 | error = do_execve(filename, argv, envp, current_frame()); | ||
317 | putname(filename); | ||
318 | return error; | ||
319 | } | ||
320 | |||
321 | unsigned long get_wchan(struct task_struct *p) | 276 | unsigned long get_wchan(struct task_struct *p) |
322 | { | 277 | { |
323 | return p->thread.wchan; | 278 | return p->thread.wchan; |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 4d584ae29ae1..f570b3085ef9 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -317,10 +317,6 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
317 | regs->d0 = sig; | 317 | regs->d0 = sig; |
318 | regs->d1 = (unsigned long) &frame->sc; | 318 | regs->d1 = (unsigned long) &frame->sc; |
319 | 319 | ||
320 | /* the tracer may want to single-step inside the handler */ | ||
321 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
322 | ptrace_notify(SIGTRAP); | ||
323 | |||
324 | #if DEBUG_SIG | 320 | #if DEBUG_SIG |
325 | printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", | 321 | printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", |
326 | sig, current->comm, current->pid, frame, regs->pc, | 322 | sig, current->comm, current->pid, frame, regs->pc, |
@@ -398,10 +394,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
398 | regs->d0 = sig; | 394 | regs->d0 = sig; |
399 | regs->d1 = (long) &frame->info; | 395 | regs->d1 = (long) &frame->info; |
400 | 396 | ||
401 | /* the tracer may want to single-step inside the handler */ | ||
402 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
403 | ptrace_notify(SIGTRAP); | ||
404 | |||
405 | #if DEBUG_SIG | 397 | #if DEBUG_SIG |
406 | printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", | 398 | printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", |
407 | sig, current->comm, current->pid, frame, regs->pc, | 399 | sig, current->comm, current->pid, frame, regs->pc, |
@@ -475,11 +467,6 @@ static void do_signal(struct pt_regs *regs) | |||
475 | siginfo_t info; | 467 | siginfo_t info; |
476 | int signr; | 468 | int signr; |
477 | 469 | ||
478 | /* we want the common case to go fast, which is why we may in certain | ||
479 | * cases get here from kernel mode */ | ||
480 | if (!user_mode(regs)) | ||
481 | return; | ||
482 | |||
483 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 470 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
484 | if (signr > 0) { | 471 | if (signr > 0) { |
485 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 472 | if (handle_signal(signr, &info, &ka, regs) == 0) { |
diff --git a/arch/openrisc/include/asm/thread_info.h b/arch/openrisc/include/asm/thread_info.h index 07a8bc080ef2..07f3212422ad 100644 --- a/arch/openrisc/include/asm/thread_info.h +++ b/arch/openrisc/include/asm/thread_info.h | |||
@@ -121,7 +121,6 @@ register struct thread_info *current_thread_info_reg asm("r10"); | |||
121 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 121 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
122 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 122 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
123 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 123 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
124 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
125 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 124 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
126 | 125 | ||
127 | 126 | ||
@@ -129,6 +128,8 @@ register struct thread_info *current_thread_info_reg asm("r10"); | |||
129 | /* For OpenRISC, this is anything in the LSW other than syscall trace */ | 128 | /* For OpenRISC, this is anything in the LSW other than syscall trace */ |
130 | #define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) | 129 | #define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) |
131 | 130 | ||
131 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
132 | |||
132 | #endif /* __KERNEL__ */ | 133 | #endif /* __KERNEL__ */ |
133 | 134 | ||
134 | #endif /* _ASM_THREAD_INFO_H */ | 135 | #endif /* _ASM_THREAD_INFO_H */ |
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S index 38a1c1b8d4e8..011468857e98 100644 --- a/arch/parisc/hpux/gate.S +++ b/arch/parisc/hpux/gate.S | |||
@@ -71,7 +71,7 @@ ENTRY(hpux_gateway_page) | |||
71 | STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */ | 71 | STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */ |
72 | STREG %r27, TASK_PT_GR27(%r1) /* user dp */ | 72 | STREG %r27, TASK_PT_GR27(%r1) /* user dp */ |
73 | STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */ | 73 | STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */ |
74 | STREG %r28, TASK_PT_ORIG_R28(%r1) /* return value 0 (saved for signals) */ | 74 | STREG %r0, TASK_PT_ORIG_R28(%r1) /* don't prohibit restarts */ |
75 | STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */ | 75 | STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */ |
76 | STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */ | 76 | STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */ |
77 | 77 | ||
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 22b4726dee49..d1fb79a36f3d 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -68,13 +68,16 @@ struct thread_info { | |||
68 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 68 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
69 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 69 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
70 | #define _TIF_32BIT (1 << TIF_32BIT) | 70 | #define _TIF_32BIT (1 << TIF_32BIT) |
71 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
72 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 71 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
73 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 72 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
74 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) | 73 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
75 | 74 | ||
76 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ | 75 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ |
77 | _TIF_NEED_RESCHED) | 76 | _TIF_NEED_RESCHED) |
77 | #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ | ||
78 | _TIF_BLOCKSTEP) | ||
79 | |||
80 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
78 | 81 | ||
79 | #endif /* __KERNEL__ */ | 82 | #endif /* __KERNEL__ */ |
80 | 83 | ||
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 594459bde14e..537996955998 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -113,6 +113,8 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) | |||
113 | (usp - sigframe_size); | 113 | (usp - sigframe_size); |
114 | DBG(2,"sys_rt_sigreturn: frame is %p\n", frame); | 114 | DBG(2,"sys_rt_sigreturn: frame is %p\n", frame); |
115 | 115 | ||
116 | regs->orig_r28 = 1; /* no restarts for sigreturn */ | ||
117 | |||
116 | #ifdef CONFIG_64BIT | 118 | #ifdef CONFIG_64BIT |
117 | compat_frame = (struct compat_rt_sigframe __user *)frame; | 119 | compat_frame = (struct compat_rt_sigframe __user *)frame; |
118 | 120 | ||
@@ -437,7 +439,7 @@ give_sigsegv: | |||
437 | * OK, we're invoking a handler. | 439 | * OK, we're invoking a handler. |
438 | */ | 440 | */ |
439 | 441 | ||
440 | static long | 442 | static void |
441 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 443 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
442 | struct pt_regs *regs, int in_syscall) | 444 | struct pt_regs *regs, int in_syscall) |
443 | { | 445 | { |
@@ -447,7 +449,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
447 | 449 | ||
448 | /* Set up the stack frame */ | 450 | /* Set up the stack frame */ |
449 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) | 451 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) |
450 | return 0; | 452 | return; |
451 | 453 | ||
452 | signal_delivered(sig, info, ka, regs, | 454 | signal_delivered(sig, info, ka, regs, |
453 | test_thread_flag(TIF_SINGLESTEP) || | 455 | test_thread_flag(TIF_SINGLESTEP) || |
@@ -455,13 +457,14 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
455 | 457 | ||
456 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | 458 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", |
457 | regs->gr[28]); | 459 | regs->gr[28]); |
458 | |||
459 | return 1; | ||
460 | } | 460 | } |
461 | 461 | ||
462 | static inline void | 462 | static inline void |
463 | syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) | 463 | syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) |
464 | { | 464 | { |
465 | if (regs->orig_r28) | ||
466 | return; | ||
467 | regs->orig_r28 = 1; /* no more restarts */ | ||
465 | /* Check the return code */ | 468 | /* Check the return code */ |
466 | switch (regs->gr[28]) { | 469 | switch (regs->gr[28]) { |
467 | case -ERESTART_RESTARTBLOCK: | 470 | case -ERESTART_RESTARTBLOCK: |
@@ -482,8 +485,6 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) | |||
482 | * we have to do is fiddle the return pointer. | 485 | * we have to do is fiddle the return pointer. |
483 | */ | 486 | */ |
484 | regs->gr[31] -= 8; /* delayed branching */ | 487 | regs->gr[31] -= 8; /* delayed branching */ |
485 | /* Preserve original r28. */ | ||
486 | regs->gr[28] = regs->orig_r28; | ||
487 | break; | 488 | break; |
488 | } | 489 | } |
489 | } | 490 | } |
@@ -491,6 +492,9 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) | |||
491 | static inline void | 492 | static inline void |
492 | insert_restart_trampoline(struct pt_regs *regs) | 493 | insert_restart_trampoline(struct pt_regs *regs) |
493 | { | 494 | { |
495 | if (regs->orig_r28) | ||
496 | return; | ||
497 | regs->orig_r28 = 1; /* no more restarts */ | ||
494 | switch(regs->gr[28]) { | 498 | switch(regs->gr[28]) { |
495 | case -ERESTART_RESTARTBLOCK: { | 499 | case -ERESTART_RESTARTBLOCK: { |
496 | /* Restart the system call - no handlers present */ | 500 | /* Restart the system call - no handlers present */ |
@@ -525,9 +529,6 @@ insert_restart_trampoline(struct pt_regs *regs) | |||
525 | flush_user_icache_range(regs->gr[30], regs->gr[30] + 4); | 529 | flush_user_icache_range(regs->gr[30], regs->gr[30] + 4); |
526 | 530 | ||
527 | regs->gr[31] = regs->gr[30] + 8; | 531 | regs->gr[31] = regs->gr[30] + 8; |
528 | /* Preserve original r28. */ | ||
529 | regs->gr[28] = regs->orig_r28; | ||
530 | |||
531 | return; | 532 | return; |
532 | } | 533 | } |
533 | case -ERESTARTNOHAND: | 534 | case -ERESTARTNOHAND: |
@@ -539,9 +540,6 @@ insert_restart_trampoline(struct pt_regs *regs) | |||
539 | * slot of the branch external instruction. | 540 | * slot of the branch external instruction. |
540 | */ | 541 | */ |
541 | regs->gr[31] -= 8; | 542 | regs->gr[31] -= 8; |
542 | /* Preserve original r28. */ | ||
543 | regs->gr[28] = regs->orig_r28; | ||
544 | |||
545 | return; | 543 | return; |
546 | } | 544 | } |
547 | default: | 545 | default: |
@@ -570,30 +568,17 @@ do_signal(struct pt_regs *regs, long in_syscall) | |||
570 | DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", | 568 | DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", |
571 | regs, regs->sr[7], in_syscall); | 569 | regs, regs->sr[7], in_syscall); |
572 | 570 | ||
573 | /* Everyone else checks to see if they are in kernel mode at | 571 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
574 | this point and exits if that's the case. I'm not sure why | 572 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); |
575 | we would be called in that case, but for some reason we | ||
576 | are. */ | ||
577 | |||
578 | /* May need to force signal if handle_signal failed to deliver */ | ||
579 | while (1) { | ||
580 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | ||
581 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); | ||
582 | 573 | ||
583 | if (signr <= 0) | 574 | if (signr > 0) { |
584 | break; | ||
585 | |||
586 | /* Restart a system call if necessary. */ | 575 | /* Restart a system call if necessary. */ |
587 | if (in_syscall) | 576 | if (in_syscall) |
588 | syscall_restart(regs, &ka); | 577 | syscall_restart(regs, &ka); |
589 | 578 | ||
590 | /* Whee! Actually deliver the signal. If the | 579 | handle_signal(signr, &info, &ka, regs, in_syscall); |
591 | delivery failed, we need to continue to iterate in | 580 | return; |
592 | this loop so we can deliver the SIGSEGV... */ | ||
593 | if (handle_signal(signr, &info, &ka, regs, in_syscall)) | ||
594 | return; | ||
595 | } | 581 | } |
596 | /* end of while(1) looping forever if we can't force a signal */ | ||
597 | 582 | ||
598 | /* Did we come from a system call? */ | 583 | /* Did we come from a system call? */ |
599 | if (in_syscall) | 584 | if (in_syscall) |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index 82a52b2fb13f..86742df0b194 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -156,7 +156,7 @@ linux_gateway_entry: | |||
156 | STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */ | 156 | STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */ |
157 | STREG %r27, TASK_PT_GR27(%r1) /* user dp */ | 157 | STREG %r27, TASK_PT_GR27(%r1) /* user dp */ |
158 | STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */ | 158 | STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */ |
159 | STREG %r28, TASK_PT_ORIG_R28(%r1) /* return value 0 (saved for signals) */ | 159 | STREG %r0, TASK_PT_ORIG_R28(%r1) /* don't prohibit restarts */ |
160 | STREG %r29, TASK_PT_GR29(%r1) /* return value 1 */ | 160 | STREG %r29, TASK_PT_GR29(%r1) /* return value 1 */ |
161 | STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */ | 161 | STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */ |
162 | 162 | ||
@@ -180,9 +180,10 @@ linux_gateway_entry: | |||
180 | 180 | ||
181 | /* Are we being ptraced? */ | 181 | /* Are we being ptraced? */ |
182 | mfctl %cr30, %r1 | 182 | mfctl %cr30, %r1 |
183 | LDREG TI_TASK(%r1),%r1 | 183 | LDREG TI_FLAGS(%r1),%r1 |
184 | ldw TASK_PTRACE(%r1), %r1 | 184 | ldi _TIF_SYSCALL_TRACE_MASK, %r19 |
185 | bb,<,n %r1,31,.Ltracesys | 185 | and,COND(=) %r1, %r19, %r0 |
186 | b,n .Ltracesys | ||
186 | 187 | ||
187 | /* Note! We cannot use the syscall table that is mapped | 188 | /* Note! We cannot use the syscall table that is mapped |
188 | nearby since the gateway page is mapped execute-only. */ | 189 | nearby since the gateway page is mapped execute-only. */ |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index df7edb887a04..78d6588b6e86 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -141,6 +141,7 @@ config PPC | |||
141 | select GENERIC_CLOCKEVENTS | 141 | select GENERIC_CLOCKEVENTS |
142 | select GENERIC_STRNCPY_FROM_USER | 142 | select GENERIC_STRNCPY_FROM_USER |
143 | select GENERIC_STRNLEN_USER | 143 | select GENERIC_STRNLEN_USER |
144 | select GENERIC_KERNEL_THREAD | ||
144 | 145 | ||
145 | config EARLY_PRINTK | 146 | config EARLY_PRINTK |
146 | bool | 147 | bool |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 9dc5cd1fde1a..8734b3855272 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -74,9 +74,6 @@ struct task_struct; | |||
74 | void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); | 74 | void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); |
75 | void release_thread(struct task_struct *); | 75 | void release_thread(struct task_struct *); |
76 | 76 | ||
77 | /* Create a new kernel thread. */ | ||
78 | extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
79 | |||
80 | /* Lazy FPU handling on uni-processor */ | 77 | /* Lazy FPU handling on uni-processor */ |
81 | extern struct task_struct *last_task_used_math; | 78 | extern struct task_struct *last_task_used_math; |
82 | extern struct task_struct *last_task_used_altivec; | 79 | extern struct task_struct *last_task_used_altivec; |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 9c21ed42aba6..f76b88c367d1 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -125,6 +125,8 @@ extern unsigned long ptrace_get_reg(struct task_struct *task, int regno); | |||
125 | extern int ptrace_put_reg(struct task_struct *task, int regno, | 125 | extern int ptrace_put_reg(struct task_struct *task, int regno, |
126 | unsigned long data); | 126 | unsigned long data); |
127 | 127 | ||
128 | #define current_pt_regs() \ | ||
129 | ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1) | ||
128 | /* | 130 | /* |
129 | * We use the least-significant bit of the trap field to indicate | 131 | * We use the least-significant bit of the trap field to indicate |
130 | * whether we have saved the full set of registers, or only a | 132 | * whether we have saved the full set of registers, or only a |
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h index 4084e567d28e..329db4ec12ca 100644 --- a/arch/powerpc/include/asm/syscalls.h +++ b/arch/powerpc/include/asm/syscalls.h | |||
@@ -17,9 +17,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, | |||
17 | asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, | 17 | asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, |
18 | unsigned long prot, unsigned long flags, | 18 | unsigned long prot, unsigned long flags, |
19 | unsigned long fd, unsigned long pgoff); | 19 | unsigned long fd, unsigned long pgoff); |
20 | asmlinkage int sys_execve(unsigned long a0, unsigned long a1, | ||
21 | unsigned long a2, unsigned long a3, unsigned long a4, | ||
22 | unsigned long a5, struct pt_regs *regs); | ||
23 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp, | 20 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp, |
24 | int __user *parent_tidp, void __user *child_threadptr, | 21 | int __user *parent_tidp, void __user *child_threadptr, |
25 | int __user *child_tidp, int p6, struct pt_regs *regs); | 22 | int __user *child_tidp, int p6, struct pt_regs *regs); |
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index 8ceea14d6fe4..406b7b9a1341 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
@@ -182,6 +182,8 @@ static inline bool test_thread_local_flags(unsigned int flags) | |||
182 | #define is_32bit_task() (1) | 182 | #define is_32bit_task() (1) |
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
186 | |||
185 | #endif /* !__ASSEMBLY__ */ | 187 | #endif /* !__ASSEMBLY__ */ |
186 | 188 | ||
187 | #endif /* __KERNEL__ */ | 189 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index c683fa350add..2533752af30f 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -421,6 +421,8 @@ | |||
421 | #define __ARCH_WANT_SYS_NEWFSTATAT | 421 | #define __ARCH_WANT_SYS_NEWFSTATAT |
422 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE | 422 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE |
423 | #endif | 423 | #endif |
424 | #define __ARCH_WANT_SYS_EXECVE | ||
425 | #define __ARCH_WANT_KERNEL_EXECVE | ||
424 | 426 | ||
425 | /* | 427 | /* |
426 | * "Conditional" syscalls | 428 | * "Conditional" syscalls |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index af37528da49f..9499385676e7 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -435,6 +435,22 @@ ret_from_fork: | |||
435 | li r3,0 | 435 | li r3,0 |
436 | b ret_from_syscall | 436 | b ret_from_syscall |
437 | 437 | ||
438 | .globl ret_from_kernel_thread | ||
439 | ret_from_kernel_thread: | ||
440 | REST_NVGPRS(r1) | ||
441 | bl schedule_tail | ||
442 | mtlr r14 | ||
443 | mr r3,r15 | ||
444 | PPC440EP_ERR42 | ||
445 | blrl | ||
446 | li r3,0 | ||
447 | b do_exit # no return | ||
448 | |||
449 | .globl __ret_from_kernel_execve | ||
450 | __ret_from_kernel_execve: | ||
451 | addi r1,r3,-STACK_FRAME_OVERHEAD | ||
452 | b ret_from_syscall | ||
453 | |||
438 | /* Traced system call support */ | 454 | /* Traced system call support */ |
439 | syscall_dotrace: | 455 | syscall_dotrace: |
440 | SAVE_NVGPRS(r1) | 456 | SAVE_NVGPRS(r1) |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 0e931aaffca2..56e0ff0878b5 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -370,6 +370,22 @@ _GLOBAL(ret_from_fork) | |||
370 | li r3,0 | 370 | li r3,0 |
371 | b syscall_exit | 371 | b syscall_exit |
372 | 372 | ||
373 | _GLOBAL(ret_from_kernel_thread) | ||
374 | bl .schedule_tail | ||
375 | REST_NVGPRS(r1) | ||
376 | REST_GPR(2,r1) | ||
377 | mtlr r14 | ||
378 | mr r3,r15 | ||
379 | blrl | ||
380 | li r3,0 | ||
381 | b .do_exit # no return | ||
382 | |||
383 | _GLOBAL(__ret_from_kernel_execve) | ||
384 | addi r1,r3,-STACK_FRAME_OVERHEAD | ||
385 | li r10,1 | ||
386 | std r10,SOFTE(r1) | ||
387 | b syscall_exit | ||
388 | |||
373 | .section ".toc","aw" | 389 | .section ".toc","aw" |
374 | DSCR_DEFAULT: | 390 | DSCR_DEFAULT: |
375 | .tc dscr_default[TC],dscr_default | 391 | .tc dscr_default[TC],dscr_default |
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index ba16874fe294..7ce26d45777e 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -54,13 +54,6 @@ _GLOBAL(add_reloc_offset) | |||
54 | .align 3 | 54 | .align 3 |
55 | 2: PPC_LONG 1b | 55 | 2: PPC_LONG 1b |
56 | 56 | ||
57 | _GLOBAL(kernel_execve) | ||
58 | li r0,__NR_execve | ||
59 | sc | ||
60 | bnslr | ||
61 | neg r3,r3 | ||
62 | blr | ||
63 | |||
64 | _GLOBAL(setjmp) | 57 | _GLOBAL(setjmp) |
65 | mflr r0 | 58 | mflr r0 |
66 | PPC_STL r0,0(r3) | 59 | PPC_STL r0,0(r3) |
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index 407e293aad2f..19e096bd0e73 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S | |||
@@ -663,39 +663,6 @@ _GLOBAL(abs) | |||
663 | sub r3,r3,r4 | 663 | sub r3,r3,r4 |
664 | blr | 664 | blr |
665 | 665 | ||
666 | /* | ||
667 | * Create a kernel thread | ||
668 | * kernel_thread(fn, arg, flags) | ||
669 | */ | ||
670 | _GLOBAL(kernel_thread) | ||
671 | stwu r1,-16(r1) | ||
672 | stw r30,8(r1) | ||
673 | stw r31,12(r1) | ||
674 | mr r30,r3 /* function */ | ||
675 | mr r31,r4 /* argument */ | ||
676 | ori r3,r5,CLONE_VM /* flags */ | ||
677 | oris r3,r3,CLONE_UNTRACED>>16 | ||
678 | li r4,0 /* new sp (unused) */ | ||
679 | li r0,__NR_clone | ||
680 | sc | ||
681 | bns+ 1f /* did system call indicate error? */ | ||
682 | neg r3,r3 /* if so, make return code negative */ | ||
683 | 1: cmpwi 0,r3,0 /* parent or child? */ | ||
684 | bne 2f /* return if parent */ | ||
685 | li r0,0 /* make top-level stack frame */ | ||
686 | stwu r0,-16(r1) | ||
687 | mtlr r30 /* fn addr in lr */ | ||
688 | mr r3,r31 /* load arg and call fn */ | ||
689 | PPC440EP_ERR42 | ||
690 | blrl | ||
691 | li r0,__NR_exit /* exit if function returns */ | ||
692 | li r3,0 | ||
693 | sc | ||
694 | 2: lwz r30,8(r1) | ||
695 | lwz r31,12(r1) | ||
696 | addi r1,r1,16 | ||
697 | blr | ||
698 | |||
699 | #ifdef CONFIG_SMP | 666 | #ifdef CONFIG_SMP |
700 | _GLOBAL(start_secondary_resume) | 667 | _GLOBAL(start_secondary_resume) |
701 | /* Reset stack */ | 668 | /* Reset stack */ |
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index 565b78625a32..5cfa8008693b 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S | |||
@@ -407,40 +407,6 @@ _GLOBAL(scom970_write) | |||
407 | 407 | ||
408 | 408 | ||
409 | /* | 409 | /* |
410 | * Create a kernel thread | ||
411 | * kernel_thread(fn, arg, flags) | ||
412 | */ | ||
413 | _GLOBAL(kernel_thread) | ||
414 | std r29,-24(r1) | ||
415 | std r30,-16(r1) | ||
416 | stdu r1,-STACK_FRAME_OVERHEAD(r1) | ||
417 | mr r29,r3 | ||
418 | mr r30,r4 | ||
419 | ori r3,r5,CLONE_VM /* flags */ | ||
420 | oris r3,r3,(CLONE_UNTRACED>>16) | ||
421 | li r4,0 /* new sp (unused) */ | ||
422 | li r0,__NR_clone | ||
423 | sc | ||
424 | bns+ 1f /* did system call indicate error? */ | ||
425 | neg r3,r3 /* if so, make return code negative */ | ||
426 | 1: cmpdi 0,r3,0 /* parent or child? */ | ||
427 | bne 2f /* return if parent */ | ||
428 | li r0,0 | ||
429 | stdu r0,-STACK_FRAME_OVERHEAD(r1) | ||
430 | ld r2,8(r29) | ||
431 | ld r29,0(r29) | ||
432 | mtlr r29 /* fn addr in lr */ | ||
433 | mr r3,r30 /* load arg and call fn */ | ||
434 | blrl | ||
435 | li r0,__NR_exit /* exit after child exits */ | ||
436 | li r3,0 | ||
437 | sc | ||
438 | 2: addi r1,r1,STACK_FRAME_OVERHEAD | ||
439 | ld r29,-24(r1) | ||
440 | ld r30,-16(r1) | ||
441 | blr | ||
442 | |||
443 | /* | ||
444 | * disable_kernel_fp() | 410 | * disable_kernel_fp() |
445 | * Disable the FPU. | 411 | * Disable the FPU. |
446 | */ | 412 | */ |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 3e4031581c65..19e4288d8486 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -94,7 +94,6 @@ EXPORT_SYMBOL(pci_dram_offset); | |||
94 | #endif /* CONFIG_PCI */ | 94 | #endif /* CONFIG_PCI */ |
95 | 95 | ||
96 | EXPORT_SYMBOL(start_thread); | 96 | EXPORT_SYMBOL(start_thread); |
97 | EXPORT_SYMBOL(kernel_thread); | ||
98 | 97 | ||
99 | EXPORT_SYMBOL(giveup_fpu); | 98 | EXPORT_SYMBOL(giveup_fpu); |
100 | #ifdef CONFIG_ALTIVEC | 99 | #ifdef CONFIG_ALTIVEC |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index d5ad666efd8b..ba48233500f6 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -733,30 +733,39 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
733 | extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ | 733 | extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ |
734 | 734 | ||
735 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 735 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
736 | unsigned long unused, struct task_struct *p, | 736 | unsigned long arg, struct task_struct *p, |
737 | struct pt_regs *regs) | 737 | struct pt_regs *regs) |
738 | { | 738 | { |
739 | struct pt_regs *childregs, *kregs; | 739 | struct pt_regs *childregs, *kregs; |
740 | extern void ret_from_fork(void); | 740 | extern void ret_from_fork(void); |
741 | extern void ret_from_kernel_thread(void); | ||
742 | void (*f)(void); | ||
741 | unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; | 743 | unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; |
742 | 744 | ||
743 | CHECK_FULL_REGS(regs); | ||
744 | /* Copy registers */ | 745 | /* Copy registers */ |
745 | sp -= sizeof(struct pt_regs); | 746 | sp -= sizeof(struct pt_regs); |
746 | childregs = (struct pt_regs *) sp; | 747 | childregs = (struct pt_regs *) sp; |
747 | *childregs = *regs; | 748 | if (!regs) { |
748 | if ((childregs->msr & MSR_PR) == 0) { | ||
749 | /* for kernel thread, set `current' and stackptr in new task */ | 749 | /* for kernel thread, set `current' and stackptr in new task */ |
750 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
750 | childregs->gpr[1] = sp + sizeof(struct pt_regs); | 751 | childregs->gpr[1] = sp + sizeof(struct pt_regs); |
751 | #ifdef CONFIG_PPC32 | 752 | #ifdef CONFIG_PPC64 |
752 | childregs->gpr[2] = (unsigned long) p; | 753 | childregs->gpr[14] = *(unsigned long *)usp; |
753 | #else | 754 | childregs->gpr[2] = ((unsigned long *)usp)[1], |
754 | clear_tsk_thread_flag(p, TIF_32BIT); | 755 | clear_tsk_thread_flag(p, TIF_32BIT); |
756 | #else | ||
757 | childregs->gpr[14] = usp; /* function */ | ||
758 | childregs->gpr[2] = (unsigned long) p; | ||
755 | #endif | 759 | #endif |
760 | childregs->gpr[15] = arg; | ||
756 | p->thread.regs = NULL; /* no user register state */ | 761 | p->thread.regs = NULL; /* no user register state */ |
762 | f = ret_from_kernel_thread; | ||
757 | } else { | 763 | } else { |
764 | CHECK_FULL_REGS(regs); | ||
765 | *childregs = *regs; | ||
758 | childregs->gpr[1] = usp; | 766 | childregs->gpr[1] = usp; |
759 | p->thread.regs = childregs; | 767 | p->thread.regs = childregs; |
768 | childregs->gpr[3] = 0; /* Result from fork() */ | ||
760 | if (clone_flags & CLONE_SETTLS) { | 769 | if (clone_flags & CLONE_SETTLS) { |
761 | #ifdef CONFIG_PPC64 | 770 | #ifdef CONFIG_PPC64 |
762 | if (!is_32bit_task()) | 771 | if (!is_32bit_task()) |
@@ -765,8 +774,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
765 | #endif | 774 | #endif |
766 | childregs->gpr[2] = childregs->gpr[6]; | 775 | childregs->gpr[2] = childregs->gpr[6]; |
767 | } | 776 | } |
777 | |||
778 | f = ret_from_fork; | ||
768 | } | 779 | } |
769 | childregs->gpr[3] = 0; /* Result from fork() */ | ||
770 | sp -= STACK_FRAME_OVERHEAD; | 780 | sp -= STACK_FRAME_OVERHEAD; |
771 | 781 | ||
772 | /* | 782 | /* |
@@ -805,19 +815,17 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
805 | p->thread.dscr = current->thread.dscr; | 815 | p->thread.dscr = current->thread.dscr; |
806 | } | 816 | } |
807 | #endif | 817 | #endif |
808 | |||
809 | /* | 818 | /* |
810 | * The PPC64 ABI makes use of a TOC to contain function | 819 | * The PPC64 ABI makes use of a TOC to contain function |
811 | * pointers. The function (ret_from_except) is actually a pointer | 820 | * pointers. The function (ret_from_except) is actually a pointer |
812 | * to the TOC entry. The first entry is a pointer to the actual | 821 | * to the TOC entry. The first entry is a pointer to the actual |
813 | * function. | 822 | * function. |
814 | */ | 823 | */ |
815 | #ifdef CONFIG_PPC64 | 824 | #ifdef CONFIG_PPC64 |
816 | kregs->nip = *((unsigned long *)ret_from_fork); | 825 | kregs->nip = *((unsigned long *)f); |
817 | #else | 826 | #else |
818 | kregs->nip = (unsigned long)ret_from_fork; | 827 | kregs->nip = (unsigned long)f; |
819 | #endif | 828 | #endif |
820 | |||
821 | return 0; | 829 | return 0; |
822 | } | 830 | } |
823 | 831 | ||
@@ -1055,26 +1063,13 @@ int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3, | |||
1055 | regs, 0, NULL, NULL); | 1063 | regs, 0, NULL, NULL); |
1056 | } | 1064 | } |
1057 | 1065 | ||
1058 | int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | 1066 | void __ret_from_kernel_execve(struct pt_regs *normal) |
1059 | unsigned long a3, unsigned long a4, unsigned long a5, | 1067 | __noreturn; |
1060 | struct pt_regs *regs) | 1068 | |
1069 | void ret_from_kernel_execve(struct pt_regs *normal) | ||
1061 | { | 1070 | { |
1062 | int error; | 1071 | set_thread_flag(TIF_RESTOREALL); |
1063 | char *filename; | 1072 | __ret_from_kernel_execve(normal); |
1064 | |||
1065 | filename = getname((const char __user *) a0); | ||
1066 | error = PTR_ERR(filename); | ||
1067 | if (IS_ERR(filename)) | ||
1068 | goto out; | ||
1069 | flush_fp_to_thread(current); | ||
1070 | flush_altivec_to_thread(current); | ||
1071 | flush_spe_to_thread(current); | ||
1072 | error = do_execve(filename, | ||
1073 | (const char __user *const __user *) a1, | ||
1074 | (const char __user *const __user *) a2, regs); | ||
1075 | putname(filename); | ||
1076 | out: | ||
1077 | return error; | ||
1078 | } | 1073 | } |
1079 | 1074 | ||
1080 | static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, | 1075 | static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 8b4c049aee20..804e323c139d 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/stddef.h> | 35 | #include <linux/stddef.h> |
36 | #include <linux/tty.h> | 36 | #include <linux/tty.h> |
37 | #include <linux/binfmts.h> | 37 | #include <linux/binfmts.h> |
38 | #include <linux/freezer.h> | ||
39 | #endif | 38 | #endif |
40 | 39 | ||
41 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index abd1112da54f..9c2ed90ece8f 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -156,28 +156,6 @@ asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd, | |||
156 | (off_t __user *)offset, count); | 156 | (off_t __user *)offset, count); |
157 | } | 157 | } |
158 | 158 | ||
159 | long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | ||
160 | unsigned long a3, unsigned long a4, unsigned long a5, | ||
161 | struct pt_regs *regs) | ||
162 | { | ||
163 | int error; | ||
164 | char * filename; | ||
165 | |||
166 | filename = getname((char __user *) a0); | ||
167 | error = PTR_ERR(filename); | ||
168 | if (IS_ERR(filename)) | ||
169 | goto out; | ||
170 | flush_fp_to_thread(current); | ||
171 | flush_altivec_to_thread(current); | ||
172 | |||
173 | error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); | ||
174 | |||
175 | putname(filename); | ||
176 | |||
177 | out: | ||
178 | return error; | ||
179 | } | ||
180 | |||
181 | /* Note: it is necessary to treat option as an unsigned int, | 159 | /* Note: it is necessary to treat option as an unsigned int, |
182 | * with the corresponding cast to a signed int to insure that the | 160 | * with the corresponding cast to a signed int to insure that the |
183 | * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) | 161 | * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) |
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index bb08e2afc5de..9e2cfe0349c3 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
@@ -91,8 +91,6 @@ static inline struct thread_info *current_thread_info(void) | |||
91 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ | 91 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ |
92 | #define TIF_SECCOMP 10 /* secure computing */ | 92 | #define TIF_SECCOMP 10 /* secure computing */ |
93 | #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ | 93 | #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ |
94 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling | ||
95 | TIF_NEED_RESCHED */ | ||
96 | #define TIF_31BIT 17 /* 32bit process */ | 94 | #define TIF_31BIT 17 /* 32bit process */ |
97 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 95 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
98 | #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ | 96 | #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ |
@@ -100,7 +98,6 @@ static inline struct thread_info *current_thread_info(void) | |||
100 | 98 | ||
101 | #define _TIF_SYSCALL (1<<TIF_SYSCALL) | 99 | #define _TIF_SYSCALL (1<<TIF_SYSCALL) |
102 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 100 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
103 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
104 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 101 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
105 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 102 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
106 | #define _TIF_PER_TRAP (1<<TIF_PER_TRAP) | 103 | #define _TIF_PER_TRAP (1<<TIF_PER_TRAP) |
@@ -109,7 +106,6 @@ static inline struct thread_info *current_thread_info(void) | |||
109 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 106 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
110 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 107 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
111 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | 108 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) |
112 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
113 | #define _TIF_31BIT (1<<TIF_31BIT) | 109 | #define _TIF_31BIT (1<<TIF_31BIT) |
114 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) | 110 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) |
115 | 111 | ||
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h index a18006e97f1c..1425cc034872 100644 --- a/arch/score/include/asm/thread_info.h +++ b/arch/score/include/asm/thread_info.h | |||
@@ -86,16 +86,12 @@ register struct thread_info *__current_thread_info __asm__("r28"); | |||
86 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 86 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
87 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ | 87 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ |
88 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | 88 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
89 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling | ||
90 | TIF_NEED_RESCHED */ | ||
91 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 89 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
92 | 90 | ||
93 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 91 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
94 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 92 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
95 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 93 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
96 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 94 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
97 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
98 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
99 | 95 | ||
100 | #define _TIF_WORK_MASK (0x0000ffff) | 96 | #define _TIF_WORK_MASK (0x0000ffff) |
101 | 97 | ||
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index e382c52ca0d9..c268bbf8b410 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -174,6 +174,7 @@ score_rt_sigreturn(struct pt_regs *regs) | |||
174 | /* It is more difficult to avoid calling this function than to | 174 | /* It is more difficult to avoid calling this function than to |
175 | call it and ignore errors. */ | 175 | call it and ignore errors. */ |
176 | do_sigaltstack((stack_t __user *)&st, NULL, regs->regs[0]); | 176 | do_sigaltstack((stack_t __user *)&st, NULL, regs->regs[0]); |
177 | regs->is_syscall = 0; | ||
177 | 178 | ||
178 | __asm__ __volatile__( | 179 | __asm__ __volatile__( |
179 | "mv\tr0, %0\n\t" | 180 | "mv\tr0, %0\n\t" |
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index bc13b57cdc83..7d5ac4e48485 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -206,6 +206,9 @@ static inline bool test_and_clear_restore_sigmask(void) | |||
206 | ti->status &= ~TS_RESTORE_SIGMASK; | 206 | ti->status &= ~TS_RESTORE_SIGMASK; |
207 | return true; | 207 | return true; |
208 | } | 208 | } |
209 | |||
210 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
211 | |||
209 | #endif /* !__ASSEMBLY__ */ | 212 | #endif /* !__ASSEMBLY__ */ |
210 | 213 | ||
211 | #endif /* __KERNEL__ */ | 214 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index d6b7b6154f87..2f1f65356c0c 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/elf.h> | 22 | #include <linux/elf.h> |
23 | #include <linux/personality.h> | 23 | #include <linux/personality.h> |
24 | #include <linux/binfmts.h> | 24 | #include <linux/binfmts.h> |
25 | #include <linux/freezer.h> | ||
26 | #include <linux/io.h> | 25 | #include <linux/io.h> |
27 | #include <linux/tracehook.h> | 26 | #include <linux/tracehook.h> |
28 | #include <asm/ucontext.h> | 27 | #include <asm/ucontext.h> |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index 6b5b3dfe886b..23853814bd17 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
20 | #include <linux/personality.h> | 20 | #include <linux/personality.h> |
21 | #include <linux/freezer.h> | ||
22 | #include <linux/ptrace.h> | 21 | #include <linux/ptrace.h> |
23 | #include <linux/unistd.h> | 22 | #include <linux/unistd.h> |
24 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index e6cd224506a9..25849ae3e900 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h | |||
@@ -126,13 +126,14 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
126 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 126 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
127 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 127 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
128 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 128 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
129 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
130 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 129 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
131 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 130 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
132 | 131 | ||
133 | #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ | 132 | #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ |
134 | _TIF_SIGPENDING) | 133 | _TIF_SIGPENDING) |
135 | 134 | ||
135 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
136 | |||
136 | #endif /* __KERNEL__ */ | 137 | #endif /* __KERNEL__ */ |
137 | 138 | ||
138 | #endif /* _ASM_THREAD_INFO_H */ | 139 | #endif /* _ASM_THREAD_INFO_H */ |
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index cfa8c38fb9c8..4e2276631081 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h | |||
@@ -256,6 +256,9 @@ static inline bool test_and_clear_restore_sigmask(void) | |||
256 | ti->status &= ~TS_RESTORE_SIGMASK; | 256 | ti->status &= ~TS_RESTORE_SIGMASK; |
257 | return true; | 257 | return true; |
258 | } | 258 | } |
259 | |||
260 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
261 | |||
259 | #endif /* !__ASSEMBLY__ */ | 262 | #endif /* !__ASSEMBLY__ */ |
260 | 263 | ||
261 | #endif /* __KERNEL__ */ | 264 | #endif /* __KERNEL__ */ |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 7bc0859a9f5e..08b4fe1717bb 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -354,15 +354,6 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
354 | regs->regs[1] = ptr_to_compat_reg(&frame->info); | 354 | regs->regs[1] = ptr_to_compat_reg(&frame->info); |
355 | regs->regs[2] = ptr_to_compat_reg(&frame->uc); | 355 | regs->regs[2] = ptr_to_compat_reg(&frame->uc); |
356 | regs->flags |= PT_FLAGS_CALLER_SAVES; | 356 | regs->flags |= PT_FLAGS_CALLER_SAVES; |
357 | |||
358 | /* | ||
359 | * Notify any tracer that was single-stepping it. | ||
360 | * The tracer may want to single-step inside the | ||
361 | * handler too. | ||
362 | */ | ||
363 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
364 | ptrace_notify(SIGTRAP); | ||
365 | |||
366 | return 0; | 357 | return 0; |
367 | 358 | ||
368 | give_sigsegv: | 359 | give_sigsegv: |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index e29b0553211d..67efb656d104 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -219,15 +219,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
219 | regs->regs[1] = (unsigned long) &frame->info; | 219 | regs->regs[1] = (unsigned long) &frame->info; |
220 | regs->regs[2] = (unsigned long) &frame->uc; | 220 | regs->regs[2] = (unsigned long) &frame->uc; |
221 | regs->flags |= PT_FLAGS_CALLER_SAVES; | 221 | regs->flags |= PT_FLAGS_CALLER_SAVES; |
222 | |||
223 | /* | ||
224 | * Notify any tracer that was single-stepping it. | ||
225 | * The tracer may want to single-step inside the | ||
226 | * handler too. | ||
227 | */ | ||
228 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
229 | ptrace_notify(SIGTRAP); | ||
230 | |||
231 | return 0; | 222 | return 0; |
232 | 223 | ||
233 | give_sigsegv: | 224 | give_sigsegv: |
@@ -278,7 +269,8 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
278 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 269 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
279 | if (ret) | 270 | if (ret) |
280 | return; | 271 | return; |
281 | signal_delivered(sig, info, ka, regs, 0); | 272 | signal_delivered(sig, info, ka, regs, |
273 | test_thread_flag(TIF_SINGLESTEP)); | ||
282 | } | 274 | } |
283 | 275 | ||
284 | /* | 276 | /* |
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h index c04e5ab68f56..2c8eeb2df8b4 100644 --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h | |||
@@ -65,8 +65,6 @@ static inline struct thread_info *current_thread_info(void) | |||
65 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 65 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
66 | #define TIF_SIGPENDING 1 /* signal pending */ | 66 | #define TIF_SIGPENDING 1 /* signal pending */ |
67 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 67 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
68 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
69 | * TIF_NEED_RESCHED */ | ||
70 | #define TIF_RESTART_BLOCK 4 | 68 | #define TIF_RESTART_BLOCK 4 |
71 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 69 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
72 | #define TIF_SYSCALL_AUDIT 6 | 70 | #define TIF_SYSCALL_AUDIT 6 |
@@ -76,7 +74,6 @@ static inline struct thread_info *current_thread_info(void) | |||
76 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 74 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
77 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 75 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
78 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 76 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
79 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
80 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | 77 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) |
81 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | 78 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
82 | 79 | ||
diff --git a/arch/unicore32/include/asm/thread_info.h b/arch/unicore32/include/asm/thread_info.h index 89f7557583b8..818b4a1edb5b 100644 --- a/arch/unicore32/include/asm/thread_info.h +++ b/arch/unicore32/include/asm/thread_info.h | |||
@@ -141,12 +141,12 @@ static inline struct thread_info *current_thread_info(void) | |||
141 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 141 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
142 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 142 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
143 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 143 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
144 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
145 | 144 | ||
146 | /* | 145 | /* |
147 | * Change these and you break ASM code in entry-common.S | 146 | * Change these and you break ASM code in entry-common.S |
148 | */ | 147 | */ |
149 | #define _TIF_WORK_MASK 0x000000ff | 148 | #define _TIF_WORK_MASK \ |
149 | (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) | ||
150 | 150 | ||
151 | #endif /* __KERNEL__ */ | 151 | #endif /* __KERNEL__ */ |
152 | #endif /* __UNICORE_THREAD_INFO_H__ */ | 152 | #endif /* __UNICORE_THREAD_INFO_H__ */ |
diff --git a/arch/unicore32/kernel/entry.S b/arch/unicore32/kernel/entry.S index 00a259f9819e..dcb87ab19ddd 100644 --- a/arch/unicore32/kernel/entry.S +++ b/arch/unicore32/kernel/entry.S | |||
@@ -544,8 +544,6 @@ fast_work_pending: | |||
544 | work_pending: | 544 | work_pending: |
545 | cand.a r1, #_TIF_NEED_RESCHED | 545 | cand.a r1, #_TIF_NEED_RESCHED |
546 | bne work_resched | 546 | bne work_resched |
547 | cand.a r1, #_TIF_SIGPENDING|_TIF_NOTIFY_RESUME | ||
548 | beq no_work_pending | ||
549 | mov r0, sp @ 'regs' | 547 | mov r0, sp @ 'regs' |
550 | mov r2, why @ 'syscall' | 548 | mov r2, why @ 'syscall' |
551 | cand.a r1, #_TIF_SIGPENDING @ delivering a signal? | 549 | cand.a r1, #_TIF_SIGPENDING @ delivering a signal? |
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index 8adedb37720a..b8b2ffd774d6 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/signal.h> | 13 | #include <linux/signal.h> |
14 | #include <linux/personality.h> | 14 | #include <linux/personality.h> |
15 | #include <linux/freezer.h> | ||
16 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
17 | #include <linux/tracehook.h> | 16 | #include <linux/tracehook.h> |
18 | #include <linux/elf.h> | 17 | #include <linux/elf.h> |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 8f9ed1afde8f..2c6340796fe9 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -622,6 +622,10 @@ work_notifysig: # deal with pending signals and | |||
622 | movl %esp, %eax | 622 | movl %esp, %eax |
623 | jne work_notifysig_v86 # returning to kernel-space or | 623 | jne work_notifysig_v86 # returning to kernel-space or |
624 | # vm86-space | 624 | # vm86-space |
625 | 1: | ||
626 | #else | ||
627 | movl %esp, %eax | ||
628 | #endif | ||
625 | TRACE_IRQS_ON | 629 | TRACE_IRQS_ON |
626 | ENABLE_INTERRUPTS(CLBR_NONE) | 630 | ENABLE_INTERRUPTS(CLBR_NONE) |
627 | movb PT_CS(%esp), %bl | 631 | movb PT_CS(%esp), %bl |
@@ -632,24 +636,15 @@ work_notifysig: # deal with pending signals and | |||
632 | call do_notify_resume | 636 | call do_notify_resume |
633 | jmp resume_userspace | 637 | jmp resume_userspace |
634 | 638 | ||
639 | #ifdef CONFIG_VM86 | ||
635 | ALIGN | 640 | ALIGN |
636 | work_notifysig_v86: | 641 | work_notifysig_v86: |
637 | pushl_cfi %ecx # save ti_flags for do_notify_resume | 642 | pushl_cfi %ecx # save ti_flags for do_notify_resume |
638 | call save_v86_state # %eax contains pt_regs pointer | 643 | call save_v86_state # %eax contains pt_regs pointer |
639 | popl_cfi %ecx | 644 | popl_cfi %ecx |
640 | movl %eax, %esp | 645 | movl %eax, %esp |
641 | #else | 646 | jmp 1b |
642 | movl %esp, %eax | ||
643 | #endif | 647 | #endif |
644 | TRACE_IRQS_ON | ||
645 | ENABLE_INTERRUPTS(CLBR_NONE) | ||
646 | movb PT_CS(%esp), %bl | ||
647 | andb $SEGMENT_RPL_MASK, %bl | ||
648 | cmpb $USER_RPL, %bl | ||
649 | jb resume_kernel | ||
650 | xorl %edx, %edx | ||
651 | call do_notify_resume | ||
652 | jmp resume_userspace | ||
653 | END(work_pending) | 648 | END(work_pending) |
654 | 649 | ||
655 | # perform syscall exit tracing | 650 | # perform syscall exit tracing |
diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h index 81abfd5d01ac..9481004ac119 100644 --- a/arch/xtensa/include/asm/thread_info.h +++ b/arch/xtensa/include/asm/thread_info.h | |||
@@ -128,19 +128,14 @@ static inline struct thread_info *current_thread_info(void) | |||
128 | #define TIF_SIGPENDING 1 /* signal pending */ | 128 | #define TIF_SIGPENDING 1 /* signal pending */ |
129 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 129 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
130 | #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ | 130 | #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ |
131 | #define TIF_IRET 4 /* return with iret */ | ||
132 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 131 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
133 | #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ | 132 | #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ |
134 | #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ | 133 | #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ |
135 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
136 | 134 | ||
137 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 135 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
138 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 136 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
139 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 137 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
140 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 138 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
141 | #define _TIF_IRET (1<<TIF_IRET) | ||
142 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
143 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
144 | 139 | ||
145 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 140 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
146 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | 141 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index efe4e854b3cd..63c566f627bc 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
21 | #include <linux/personality.h> | 21 | #include <linux/personality.h> |
22 | #include <linux/freezer.h> | ||
23 | #include <linux/tracehook.h> | 22 | #include <linux/tracehook.h> |
24 | 23 | ||
25 | #include <asm/ucontext.h> | 24 | #include <asm/ucontext.h> |
@@ -527,9 +526,6 @@ static void do_signal(struct pt_regs *regs) | |||
527 | 526 | ||
528 | void do_notify_resume(struct pt_regs *regs) | 527 | void do_notify_resume(struct pt_regs *regs) |
529 | { | 528 | { |
530 | if (!user_mode(regs)) | ||
531 | return; | ||
532 | |||
533 | if (test_thread_flag(TIF_SIGPENDING)) | 529 | if (test_thread_flag(TIF_SIGPENDING)) |
534 | do_signal(regs); | 530 | do_signal(regs); |
535 | 531 | ||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c17747236438..bd7c39450b1b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -505,7 +505,7 @@ static inline void init_hrtick(void) | |||
505 | #ifdef CONFIG_SMP | 505 | #ifdef CONFIG_SMP |
506 | 506 | ||
507 | #ifndef tsk_is_polling | 507 | #ifndef tsk_is_polling |
508 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | 508 | #define tsk_is_polling(t) 0 |
509 | #endif | 509 | #endif |
510 | 510 | ||
511 | void resched_task(struct task_struct *p) | 511 | void resched_task(struct task_struct *p) |