aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
Diffstat (limited to 'arch/h8300')
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/include/asm/processor.h2
-rw-r--r--arch/h8300/include/asm/ptrace.h2
-rw-r--r--arch/h8300/include/asm/unistd.h1
-rw-r--r--arch/h8300/kernel/entry.S9
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c1
-rw-r--r--arch/h8300/kernel/process.c62
-rw-r--r--arch/h8300/kernel/sys_h8300.c26
8 files changed, 22 insertions, 83 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 98fabd10e95f..04bef4d25b4a 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -8,6 +8,8 @@ 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
12 select GENERIC_KERNEL_EXECVE
11 13
12config SYMBOL_PREFIX 14config SYMBOL_PREFIX
13 string 15 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/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index 5cd882801d79..07afcfaec995 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -356,6 +356,7 @@
356#define __ARCH_WANT_SYS_SIGPROCMASK 356#define __ARCH_WANT_SYS_SIGPROCMASK
357#define __ARCH_WANT_SYS_RT_SIGACTION 357#define __ARCH_WANT_SYS_RT_SIGACTION
358#define __ARCH_WANT_SYS_RT_SIGSUSPEND 358#define __ARCH_WANT_SYS_RT_SIGSUSPEND
359#define __ARCH_WANT_SYS_EXECVE
359 360
360/* 361/*
361 * "Conditional" syscalls 362 * "Conditional" syscalls
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
index ca7431690300..617a6878787f 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,14 @@ 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 jmp @SYMBOL_NAME(ret_from_exception)
341
333SYMBOL_NAME_LABEL(resume) 342SYMBOL_NAME_LABEL(resume)
334 /* 343 /*
335 * Beware - when entering resume, offset of tss is in d1, 344 * 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..2a45718cc5e8 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;
@@ -208,27 +183,6 @@ int copy_thread(unsigned long clone_flags,
208 return 0; 183 return 0;
209} 184}
210 185
211/*
212 * sys_execve() executes a new program.
213 */
214asmlinkage int sys_execve(const char *name,
215 const char *const *argv,
216 const char *const *envp,
217 int dummy, ...)
218{
219 int error;
220 struct filename *filename;
221 struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4);
222
223 filename = getname(name);
224 error = PTR_ERR(filename);
225 if (IS_ERR(filename))
226 return error;
227 error = do_execve(filename->name, argv, envp, regs);
228 putname(filename);
229 return error;
230}
231
232unsigned long thread_saved_pc(struct task_struct *tsk) 186unsigned long thread_saved_pc(struct task_struct *tsk)
233{ 187{
234 return ((struct pt_regs *)tsk->thread.esp0)->pc; 188 return ((struct pt_regs *)tsk->thread.esp0)->pc;
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 4bdc7311784e..bf350cb7f597 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -46,29 +46,3 @@ asmlinkage void syscall_print(void *dummy,...)
46 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); 46 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
47} 47}
48#endif 48#endif
49
50/*
51 * Do a system call from kernel instead of calling sys_execve so we
52 * end up with proper pt_regs.
53 */
54asmlinkage
55int kernel_execve(const char *filename,
56 const char *const argv[],
57 const char *const envp[])
58{
59 register long res __asm__("er0");
60 register const char *const *_c __asm__("er3") = envp;
61 register const char *const *_b __asm__("er2") = argv;
62 register const char * _a __asm__("er1") = filename;
63 __asm__ __volatile__ ("mov.l %1,er0\n\t"
64 "trapa #0\n\t"
65 : "=r" (res)
66 : "g" (__NR_execve),
67 "g" (_a),
68 "g" (_b),
69 "g" (_c)
70 : "cc", "memory");
71 return res;
72}
73
74