Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

c6x: switch to generic kernel_thread()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 5687580b 680a1453

+6 -21
+1
arch/c6x/Kconfig
··· 17 17 select OF 18 18 select OF_EARLY_FLATTREE 19 19 select GENERIC_CLOCKEVENTS 20 + select GENERIC_KERNEL_THREAD 20 21 21 22 config MMU 22 23 def_bool n
-2
arch/c6x/include/asm/processor.h
··· 92 92 { 93 93 } 94 94 95 - extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 96 - 97 95 #define copy_segments(tsk, mm) do { } while (0) 98 96 #define release_segments(mm) do { } while (0) 99 97
+5 -19
arch/c6x/kernel/process.c
··· 104 104 halt_loop(); 105 105 } 106 106 107 - /* 108 - * Create a kernel thread 109 - */ 110 - int 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 - 123 107 void flush_thread(void) 124 108 { 125 109 } ··· 161 177 162 178 childregs = task_pt_regs(p); 163 179 164 - *childregs = *regs; 165 - 166 - if (usp == -1) { 180 + if (!regs) { 167 181 /* case of __kernel_thread: we return to supervisor space */ 182 + memset(childregs, 0, sizeof(struct pt_regs)); 168 183 childregs->sp = (unsigned long)(childregs + 1); 169 184 p->thread.pc = (unsigned long) ret_from_kernel_thread; 185 + childregs->a0 = usp; /* function */ 186 + childregs->a1 = ustk_size; /* argument */ 170 187 } else { 171 188 /* Otherwise use the given stack */ 189 + *childregs = *regs; 172 190 childregs->sp = usp; 173 191 p->thread.pc = (unsigned long) ret_from_fork; 174 192 }