summaryrefslogtreecommitdiff
path: root/arch/mips/kernel/process.c
diff options
context:
space:
mode:
authorRalf Bächle <ralf@linux-mips.org>2004-12-01 01:07:46 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-12-01 01:07:46 -0800
commitb7aacd4af38ce517f785b56cc2f1aae008d54a4a (patch)
treed093d5a4523d31c79cbc50af58681b517c0f910f /arch/mips/kernel/process.c
parentd80f0adee6a434ea0be11c56e86fe7005ac96fc4 (diff)
[PATCH] MIPS updates
o General updates of MIPS to 2.6.10-rc2 o Remove the Baget platform due to lack of maintenance over several years. Some of the drivers remain and will be removed in a separate patch. o Remove the HP Laserjet platform. No user reports ever and no patches from the original submitters made this port a neat hack - and a directory full of clutter. o SMP support for the PMC-Sierra. Signed-Off-By: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips/kernel/process.c')
-rw-r--r--arch/mips/kernel/process.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index d607f0b54740..fb76e458e340 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -5,6 +5,7 @@
*
* Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
+ * Copyright (C) 2004 Thiemo Seufer
*/
#include <linux/config.h>
#include <linux/errno.h>
@@ -99,10 +100,14 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childksp = (unsigned long)ti + THREAD_SIZE - 32;
+ preempt_disable();
+
if (is_fpu_owner()) {
save_fp(p);
}
+ preempt_enable();
+
/* set up new TSS. */
childregs = (struct pt_regs *) childksp - 1;
*childregs = *regs;
@@ -154,39 +159,30 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
/*
* Create a kernel thread
*/
+ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
+{
+ do_exit(fn(arg));
+}
+
long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
{
- long retval;
-
- __asm__ __volatile__(
- " move $6, $sp \n"
- " move $4, %5 \n"
- " li $2, %1 \n"
- " syscall \n"
- " beq $6, $sp, 1f \n"
-#ifdef CONFIG_MIPS32 /* On o32 the caller has to create the stackframe */
- " subu $sp, 32 \n"
-#endif
- " move $4, %3 \n"
- " jalr %4 \n"
- " move $4, $2 \n"
- " li $2, %2 \n"
- " syscall \n"
-#ifdef CONFIG_MIPS32 /* On o32 the caller has to deallocate the stackframe */
- " addiu $sp, 32 \n"
+ struct pt_regs regs;
+
+ memset(&regs, 0, sizeof(regs));
+
+ regs.regs[4] = (unsigned long) arg;
+ regs.regs[5] = (unsigned long) fn;
+ regs.cp0_epc = (unsigned long) kernel_thread_helper;
+ regs.cp0_status = read_c0_status();
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+ regs.cp0_status &= ~(ST0_KUP | ST0_IEC);
+ regs.cp0_status |= ST0_IEP;
+#else
+ regs.cp0_status |= ST0_EXL;
#endif
- "1: move %0, $2"
- : "=r" (retval)
- : "i" (__NR_clone), "i" (__NR_exit), "r" (arg), "r" (fn),
- "r" (flags | CLONE_VM | CLONE_UNTRACED)
- /*
- * The called subroutine might have destroyed any of the
- * at, result, argument or temporary registers ...
- */
- : "$2", "$3", "$4", "$5", "$6", "$7", "$8",
- "$9","$10","$11","$12","$13","$14","$15","$24","$25","$31");
-
- return retval;
+
+ /* Ok, create the new process.. */
+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
}
struct mips_frame_info {