aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-09-22 18:23:49 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-01 00:59:09 -0400
commit5687580bcb758ddc95be9894f592a65034e77401 (patch)
tree46e8da685de52b6a72f83d857dd5aaced2657520 /arch
parent680a14535c330481517d3f95b2277353a14b8442 (diff)
c6x: switch to generic kernel_thread()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/c6x/Kconfig1
-rw-r--r--arch/c6x/include/asm/processor.h2
-rw-r--r--arch/c6x/kernel/process.c24
3 files changed, 6 insertions, 21 deletions
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index 983c859e40b..45268b50c0c 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
21config MMU 22config 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 c50af7ef1c9..b9eb3da7f27 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
95extern 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/kernel/process.c b/arch/c6x/kernel/process.c
index f98616d92f2..2770d9a9a84 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -104,22 +104,6 @@ void machine_power_off(void)
104 halt_loop(); 104 halt_loop();
105} 105}
106 106
107/*
108 * Create a kernel thread
109 */
110int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
111{
112 struct pt_regs regs = {
113 .a0 = (unsigned long)fn,
114 .a1 = (unsigned long)arg,
115 .tsr = 0, /* kernel mode */
116 };
117
118 /* Ok, create the new process.. */
119 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, -1, &regs,
120 0, NULL, NULL);
121}
122
123void flush_thread(void) 107void flush_thread(void)
124{ 108{
125} 109}
@@ -177,14 +161,16 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
177 161
178 childregs = task_pt_regs(p); 162 childregs = task_pt_regs(p);
179 163
180 *childregs = *regs; 164 if (!regs) {
181
182 if (usp == -1) {
183 /* 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));
184 childregs->sp = (unsigned long)(childregs + 1); 167 childregs->sp = (unsigned long)(childregs + 1);
185 p->thread.pc = (unsigned long) ret_from_kernel_thread; 168 p->thread.pc = (unsigned long) ret_from_kernel_thread;
169 childregs->a0 = usp; /* function */
170 childregs->a1 = ustk_size; /* argument */
186 } else { 171 } else {
187 /* Otherwise use the given stack */ 172 /* Otherwise use the given stack */
173 *childregs = *regs;
188 childregs->sp = usp; 174 childregs->sp = usp;
189 p->thread.pc = (unsigned long) ret_from_fork; 175 p->thread.pc = (unsigned long) ret_from_fork;
190 } 176 }