aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-10 13:17:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-14 19:37:40 -0400
commit557e1995a92d318206910d8b5c62075fe02b37e0 (patch)
tree8373bada8e8f5306eed59487827265305fa0f1be /arch/h8300
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
h8300: generic kernel_thread()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/h8300')
-rw-r--r--arch/h8300/Kconfig1
-rw-r--r--arch/h8300/include/asm/processor.h2
-rw-r--r--arch/h8300/include/asm/ptrace.h2
-rw-r--r--arch/h8300/kernel/entry.S10
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c1
-rw-r--r--arch/h8300/kernel/process.c41
6 files changed, 21 insertions, 36 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 98fabd10e95f..4cef8a91c2a0 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -8,6 +8,7 @@ config H8300
8 select GENERIC_IRQ_SHOW 8 select GENERIC_IRQ_SHOW
9 select GENERIC_CPU_DEVICES 9 select GENERIC_CPU_DEVICES
10 select MODULES_USE_ELF_RELA 10 select MODULES_USE_ELF_RELA
11 select GENERIC_KERNEL_THREAD
11 12
12config SYMBOL_PREFIX 13config SYMBOL_PREFIX
13 string 14 string
diff --git a/arch/h8300/include/asm/processor.h b/arch/h8300/include/asm/processor.h
index 4c9f6f87b617..4b0ca49bb463 100644
--- a/arch/h8300/include/asm/processor.h
+++ b/arch/h8300/include/asm/processor.h
@@ -107,8 +107,6 @@ static inline void release_thread(struct task_struct *dead_task)
107{ 107{
108} 108}
109 109
110extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
111
112/* 110/*
113 * Free current thread data structures etc.. 111 * Free current thread data structures etc..
114 */ 112 */
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h
index d09c440bdba7..00502a61bf0a 100644
--- a/arch/h8300/include/asm/ptrace.h
+++ b/arch/h8300/include/asm/ptrace.h
@@ -60,6 +60,8 @@ struct pt_regs {
60#define user_mode(regs) (!((regs)->ccr & PS_S)) 60#define user_mode(regs) (!((regs)->ccr & PS_S))
61#define instruction_pointer(regs) ((regs)->pc) 61#define instruction_pointer(regs) ((regs)->pc)
62#define profile_pc(regs) instruction_pointer(regs) 62#define profile_pc(regs) instruction_pointer(regs)
63#define current_pt_regs() ((struct pt_regs *) \
64 (THREAD_SIZE + (unsigned long)current_thread_info()) - 1)
63#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
64#endif /* __ASSEMBLY__ */ 66#endif /* __ASSEMBLY__ */
65#endif /* _H8300_PTRACE_H */ 67#endif /* _H8300_PTRACE_H */
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
index ca7431690300..2cdb49a56099 100644
--- a/arch/h8300/kernel/entry.S
+++ b/arch/h8300/kernel/entry.S
@@ -158,6 +158,7 @@ INTERRUPTS = 128
158.globl SYMBOL_NAME(system_call) 158.globl SYMBOL_NAME(system_call)
159.globl SYMBOL_NAME(ret_from_exception) 159.globl SYMBOL_NAME(ret_from_exception)
160.globl SYMBOL_NAME(ret_from_fork) 160.globl SYMBOL_NAME(ret_from_fork)
161.globl SYMBOL_NAME(ret_from_kernel_thread)
161.globl SYMBOL_NAME(ret_from_interrupt) 162.globl SYMBOL_NAME(ret_from_interrupt)
162.globl SYMBOL_NAME(interrupt_redirect_table) 163.globl SYMBOL_NAME(interrupt_redirect_table)
163.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp) 164.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp)
@@ -330,6 +331,15 @@ SYMBOL_NAME_LABEL(ret_from_fork)
330 jsr @SYMBOL_NAME(schedule_tail) 331 jsr @SYMBOL_NAME(schedule_tail)
331 jmp @SYMBOL_NAME(ret_from_exception) 332 jmp @SYMBOL_NAME(ret_from_exception)
332 333
334SYMBOL_NAME_LABEL(ret_from_kernel_thread)
335 mov.l er2,er0
336 jsr @SYMBOL_NAME(schedule_tail)
337 mov.l @(LER4:16,sp),er0
338 mov.l @(LER5:16,sp),er1
339 jsr @er1
340 sub.l @er0,@er0
341 jsr @SYMBOL_NAME(sys_exit)
342
333SYMBOL_NAME_LABEL(resume) 343SYMBOL_NAME_LABEL(resume)
334 /* 344 /*
335 * Beware - when entering resume, offset of tss is in d1, 345 * Beware - when entering resume, offset of tss is in d1,
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
index 6866bd9c7fb4..53d7c0e4bd83 100644
--- a/arch/h8300/kernel/h8300_ksyms.c
+++ b/arch/h8300/kernel/h8300_ksyms.c
@@ -33,7 +33,6 @@ EXPORT_SYMBOL(strncmp);
33 33
34EXPORT_SYMBOL(ip_fast_csum); 34EXPORT_SYMBOL(ip_fast_csum);
35 35
36EXPORT_SYMBOL(kernel_thread);
37EXPORT_SYMBOL(enable_irq); 36EXPORT_SYMBOL(enable_irq);
38EXPORT_SYMBOL(disable_irq); 37EXPORT_SYMBOL(disable_irq);
39 38
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index e8dc1393a13a..e3dfea71c15f 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -47,6 +47,7 @@ void (*pm_power_off)(void) = NULL;
47EXPORT_SYMBOL(pm_power_off); 47EXPORT_SYMBOL(pm_power_off);
48 48
49asmlinkage void ret_from_fork(void); 49asmlinkage void ret_from_fork(void);
50asmlinkage void ret_from_kernel_thread(void);
50 51
51/* 52/*
52 * The idle loop on an H8/300.. 53 * The idle loop on an H8/300..
@@ -122,39 +123,6 @@ void show_regs(struct pt_regs * regs)
122 printk("\n"); 123 printk("\n");
123} 124}
124 125
125/*
126 * Create a kernel thread
127 */
128int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
129{
130 long retval;
131 long clone_arg;
132 mm_segment_t fs;
133
134 fs = get_fs();
135 set_fs (KERNEL_DS);
136 clone_arg = flags | CLONE_VM;
137 __asm__("mov.l sp,er3\n\t"
138 "sub.l er2,er2\n\t"
139 "mov.l %2,er1\n\t"
140 "mov.l %1,er0\n\t"
141 "trapa #0\n\t"
142 "cmp.l sp,er3\n\t"
143 "beq 1f\n\t"
144 "mov.l %4,er0\n\t"
145 "mov.l %3,er1\n\t"
146 "jsr @er1\n\t"
147 "mov.l %5,er0\n\t"
148 "trapa #0\n"
149 "1:\n\t"
150 "mov.l er0,%0"
151 :"=r"(retval)
152 :"i"(__NR_clone),"g"(clone_arg),"g"(fn),"g"(arg),"i"(__NR_exit)
153 :"er0","er1","er2","er3");
154 set_fs (fs);
155 return retval;
156}
157
158void flush_thread(void) 126void flush_thread(void)
159{ 127{
160} 128}
@@ -198,6 +166,13 @@ int copy_thread(unsigned long clone_flags,
198 166
199 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1; 167 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
200 168
169 if (unlikely(p->flags & PF_KTHREAD)) {
170 memset(childregs, 0, sizeof(struct pt_regs));
171 childregs->retpc = (unsigned long) ret_from_kernel_thread;
172 childregs->er4 = topstk; /* arg */
173 childregs->er5 = usp; /* fn */
174 p->thread.ksp = (unsigned long)childregs;
175 }
201 *childregs = *regs; 176 *childregs = *regs;
202 childregs->retpc = (unsigned long) ret_from_fork; 177 childregs->retpc = (unsigned long) ret_from_fork;
203 childregs->er0 = 0; 178 childregs->er0 = 0;