From 39fcf44099dd64679c232c4a7bb81cf469e4e43c Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Fri, 21 Sep 2012 12:26:38 -0400 Subject: c6x: switch to generic kernel_execve Signed-off-by: Mark Salter Signed-off-by: Al Viro --- arch/c6x/include/asm/unistd.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/c6x/include') diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h index 6d54ea4262eb..1ce3a6f2372b 100644 --- a/arch/c6x/include/asm/unistd.h +++ b/arch/c6x/include/asm/unistd.h @@ -16,6 +16,8 @@ #if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL) #define _ASM_C6X_UNISTD_H +#define __ARCH_WANT_KERNEL_EXECVE + /* Use the standard ABI for syscalls. */ #include -- cgit v1.2.3 From 680a14535c330481517d3f95b2277353a14b8442 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Fri, 21 Sep 2012 12:26:39 -0400 Subject: c6x: switch to generic sys_execve Signed-off-by: Mark Salter Signed-off-by: Al Viro --- arch/c6x/include/asm/syscalls.h | 5 ----- arch/c6x/include/asm/unistd.h | 1 + arch/c6x/kernel/entry.S | 23 ----------------------- arch/c6x/kernel/process.c | 22 ---------------------- 4 files changed, 1 insertion(+), 50 deletions(-) (limited to 'arch/c6x/include') 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); struct pt_regs; extern asmlinkage long sys_c6x_clone(struct pt_regs *regs); -extern asmlinkage long sys_c6x_execve(const char __user *name, - const char __user *const __user *argv, - const char __user *const __user *envp, - struct pt_regs *regs); - #include diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h index 1ce3a6f2372b..3c131d5888c1 100644 --- a/arch/c6x/include/asm/unistd.h +++ b/arch/c6x/include/asm/unistd.h @@ -17,6 +17,7 @@ #define _ASM_C6X_UNISTD_H #define __ARCH_WANT_KERNEL_EXECVE +#define __ARCH_WANT_SYS_EXECVE /* Use the standard ABI for syscalls. */ #include diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S index 32e3683da718..5449c36018fe 100644 --- a/arch/c6x/kernel/entry.S +++ b/arch/c6x/kernel/entry.S @@ -647,29 +647,6 @@ ENTRY(sys_rt_sigreturn) #endif ENDPROC(sys_rt_sigreturn) -ENTRY(sys_execve) - ADDAW .D2 SP,2,B6 ; put regs addr in 4th parameter - ; & adjust regs stack addr - LDW .D2T2 *+SP(REGS_B4+8),B4 - - ;; c6x_execve(char *name, char **argv, - ;; char **envp, struct pt_regs *regs) -#ifdef CONFIG_C6X_BIG_KERNEL - || MVKL .S1 sys_c6x_execve,A0 - MVKH .S1 sys_c6x_execve,A0 - B .S2X A0 -#else - || B .S2 sys_c6x_execve -#endif - STW .D2T2 B3,*SP--[2] - ADDKPC .S2 ret_from_c6x_execve,B3,3 - -ret_from_c6x_execve: - LDW .D2T2 *++SP[2],B3 - NOP 4 - BNOP .S2 B3,5 -ENDPROC(sys_execve) - ENTRY(sys_pread_c6x) MV .D2X A8,B7 #ifdef CONFIG_C6X_BIG_KERNEL diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c index d2ffc9bdaba1..f98616d92f2d 100644 --- a/arch/c6x/kernel/process.c +++ b/arch/c6x/kernel/process.c @@ -207,28 +207,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, return 0; } -/* - * c6x_execve() executes a new program. - */ -SYSCALL_DEFINE4(c6x_execve, const char __user *, name, - const char __user *const __user *, argv, - const char __user *const __user *, envp, - struct pt_regs *, regs) -{ - int error; - char *filename; - - filename = getname(name); - error = PTR_ERR(filename); - if (IS_ERR(filename)) - goto out; - - error = do_execve(filename, argv, envp, regs); - putname(filename); -out: - return error; -} - unsigned long get_wchan(struct task_struct *p) { return p->thread.wchan; -- cgit v1.2.3 From 5687580bcb758ddc95be9894f592a65034e77401 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 22 Sep 2012 18:23:49 -0400 Subject: c6x: switch to generic kernel_thread() Signed-off-by: Al Viro --- arch/c6x/Kconfig | 1 + arch/c6x/include/asm/processor.h | 2 -- arch/c6x/kernel/process.c | 24 +++++------------------- 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'arch/c6x/include') 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 select OF select OF_EARLY_FLATTREE select GENERIC_CLOCKEVENTS + select GENERIC_KERNEL_THREAD config MMU 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) { } -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); - #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c index f98616d92f2d..2770d9a9a84e 100644 --- a/arch/c6x/kernel/process.c +++ b/arch/c6x/kernel/process.c @@ -104,22 +104,6 @@ void machine_power_off(void) halt_loop(); } -/* - * Create a kernel thread - */ -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - struct pt_regs regs = { - .a0 = (unsigned long)fn, - .a1 = (unsigned long)arg, - .tsr = 0, /* kernel mode */ - }; - - /* Ok, create the new process.. */ - return do_fork(flags | CLONE_VM | CLONE_UNTRACED, -1, ®s, - 0, NULL, NULL); -} - void flush_thread(void) { } @@ -177,14 +161,16 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs = task_pt_regs(p); - *childregs = *regs; - - if (usp == -1) { + if (!regs) { /* case of __kernel_thread: we return to supervisor space */ + memset(childregs, 0, sizeof(struct pt_regs)); childregs->sp = (unsigned long)(childregs + 1); p->thread.pc = (unsigned long) ret_from_kernel_thread; + childregs->a0 = usp; /* function */ + childregs->a1 = ustk_size; /* argument */ } else { /* Otherwise use the given stack */ + *childregs = *regs; childregs->sp = usp; p->thread.pc = (unsigned long) ret_from_fork; } -- cgit v1.2.3 From 16a8016372c42c7628eb4a39d75386a461e8c5d0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 1 Jun 2012 14:22:01 -0400 Subject: sanitize tsk_is_polling() Make default just return 0. The current default (checking TIF_POLLING_NRFLAG) is taken to architectures that need it; ones that don't do polling in their idle threads don't need to defined TIF_POLLING_NRFLAG at all. ia64 defined both TS_POLLING (used by its tsk_is_polling()) and TIF_POLLING_NRFLAG (not used at all). Killed the latter... Signed-off-by: Al Viro --- arch/alpha/include/asm/thread_info.h | 2 ++ arch/arm/include/asm/thread_info.h | 2 -- arch/avr32/include/asm/thread_info.h | 4 ---- arch/blackfin/include/asm/thread_info.h | 3 --- arch/c6x/include/asm/thread_info.h | 1 - arch/c6x/kernel/asm-offsets.c | 1 - arch/cris/include/asm/thread_info.h | 2 -- arch/frv/include/asm/thread_info.h | 2 -- arch/h8300/include/asm/thread_info.h | 3 --- arch/hexagon/include/asm/thread_info.h | 2 -- arch/ia64/include/asm/thread_info.h | 2 -- arch/m32r/include/asm/thread_info.h | 2 -- arch/microblaze/include/asm/thread_info.h | 1 + arch/mips/include/asm/thread_info.h | 2 -- arch/mn10300/include/asm/thread_info.h | 2 ++ arch/openrisc/include/asm/thread_info.h | 2 ++ arch/parisc/include/asm/thread_info.h | 2 ++ arch/powerpc/include/asm/thread_info.h | 2 ++ arch/s390/include/asm/thread_info.h | 3 --- arch/score/include/asm/thread_info.h | 3 --- arch/sh/include/asm/thread_info.h | 3 +++ arch/sparc/include/asm/thread_info_32.h | 2 ++ arch/sparc/include/asm/thread_info_64.h | 3 +++ arch/um/include/asm/thread_info.h | 3 --- arch/xtensa/include/asm/thread_info.h | 2 -- kernel/sched/core.c | 2 +- 26 files changed, 20 insertions(+), 38 deletions(-) (limited to 'arch/c6x/include') diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h index 2601c8e338da..4554ecbff7c6 100644 --- a/arch/alpha/include/asm/thread_info.h +++ b/arch/alpha/include/asm/thread_info.h @@ -116,5 +116,7 @@ register struct thread_info *__current_thread_info __asm__("$8"); (int __user *)(value)); \ }) +#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) + #endif /* __KERNEL__ */ #endif /* _ALPHA_THREAD_INFO_H */ diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index af7b0bda3355..b2d6b412172d 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -148,7 +148,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_SYSCALL_TRACE 8 #define TIF_SYSCALL_AUDIT 9 -#define TIF_POLLING_NRFLAG 16 #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 20 @@ -160,7 +159,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) -#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) diff --git a/arch/avr32/include/asm/thread_info.h b/arch/avr32/include/asm/thread_info.h index a32c88cb2601..dc0c45721499 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) #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SIGPENDING 1 /* signal pending */ #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ -#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling - TIF_NEED_RESCHED */ #define TIF_BREAKPOINT 4 /* enter monitor mode on return */ #define TIF_SINGLE_STEP 5 /* single step in progress */ #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ @@ -91,7 +89,6 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) -#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) #define _TIF_MEMDIE (1 << TIF_MEMDIE) #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) @@ -104,7 +101,6 @@ static inline struct thread_info *current_thread_info(void) ((1 << TIF_SIGPENDING) \ | _TIF_NOTIFY_RESUME \ | (1 << TIF_NEED_RESCHED) \ - | (1 << TIF_POLLING_NRFLAG) \ | (1 << TIF_BREAKPOINT) \ | (1 << TIF_RESTORE_SIGMASK)) diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h index f9a8731b7e81..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) #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SIGPENDING 1 /* signal pending */ #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ -#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling - TIF_NEED_RESCHED */ #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ @@ -108,7 +106,6 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SYSCALL_TRACE (1<status &= ~TS_RESTORE_SIGMASK; return true; } +#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) #endif #endif /* __KERNEL__ */ diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index a75a11abf7b0..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"); #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ -#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_FIXADE 20 /* Fix address errors in software */ #define TIF_LOGADE 21 /* Log address errors to syslog */ @@ -126,7 +125,6 @@ register struct thread_info *__current_thread_info __asm__("$28"); #define _TIF_SECCOMP (1<status &= ~TS_RESTORE_SIGMASK; return true; } + +#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) + #endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index dd3807599bb9..25849ae3e900 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h @@ -132,6 +132,8 @@ register struct thread_info *current_thread_info_reg asm("g6"); #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ _TIF_SIGPENDING) +#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) + #endif /* __KERNEL__ */ #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) ti->status &= ~TS_RESTORE_SIGMASK; return true; } + +#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) + #endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ 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) #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SIGPENDING 1 /* signal pending */ #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ -#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling - * TIF_NEED_RESCHED */ #define TIF_RESTART_BLOCK 4 #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ #define TIF_SYSCALL_AUDIT 6 @@ -76,7 +74,6 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) -#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_MEMDIE (1 << TIF_MEMDIE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h index a27bc8ce5eff..214be732b2b2 100644 --- a/arch/xtensa/include/asm/thread_info.h +++ b/arch/xtensa/include/asm/thread_info.h @@ -132,14 +132,12 @@ static inline struct thread_info *current_thread_info(void) #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ -#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define _TIF_SYSCALL_TRACE (1<