fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / m32r / kernel / process.c
index 9e7de27..95acb57 100644 (file)
@@ -1,6 +1,5 @@
 /*
  *  linux/arch/m32r/kernel/process.c
- *    orig : sh
  *
  *  Copyright (c) 2001, 2002  Hiroyuki Kondo, Hirokazu Takata,
  *                            Hitoshi Yamamoto
@@ -22,7 +21,6 @@
  */
 
 #include <linux/fs.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/ptrace.h>
 #include <linux/unistd.h>
@@ -51,6 +49,10 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
  * Powermanagement idle function, if any..
  */
 void (*pm_idle)(void) = NULL;
+EXPORT_SYMBOL(pm_idle);
+
+void (*pm_power_off)(void) = NULL;
+EXPORT_SYMBOL(pm_power_off);
 
 void disable_hlt(void)
 {
@@ -105,19 +107,23 @@ void cpu_idle (void)
 
                        idle();
                }
+               preempt_enable_no_resched();
                schedule();
+               preempt_disable();
        }
 }
 
 void machine_restart(char *__unused)
 {
+#if defined(CONFIG_PLAT_MAPPI3)
+       outw(1, (unsigned long)PLD_REBOOT);
+#endif
+
        printk("Please push reset button!\n");
        while (1)
                cpu_relax();
 }
 
-EXPORT_SYMBOL(machine_restart);
-
 void machine_halt(void)
 {
        printk("Please push reset button!\n");
@@ -125,15 +131,11 @@ void machine_halt(void)
                cpu_relax();
 }
 
-EXPORT_SYMBOL(machine_halt);
-
 void machine_power_off(void)
 {
        /* M32R_FIXME */
 }
 
-EXPORT_SYMBOL(machine_power_off);
-
 static int __init idle_setup (char *str)
 {
        if (!strncmp(str, "poll", 4)) {
@@ -172,7 +174,7 @@ void show_regs(struct pt_regs * regs)
          regs->acc1h, regs->acc1l);
 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
        printk("ACCH[%08lx]:ACCL[%08lx]\n", \
-         regs->acch, regs->accl);
+         regs->acc0h, regs->acc0l);
 #else
 #error unknown isa configuration
 #endif
@@ -209,8 +211,8 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
        regs.psw = M32R_PSW_BIE;
 
        /* Ok, create the new process. */
-       return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL,
-               NULL);
+       return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
+               0, &regs, 0, NULL, NULL);
 }
 
 /*
@@ -243,15 +245,10 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
 int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
        unsigned long unused, struct task_struct *tsk, struct pt_regs *regs)
 {
-       struct pt_regs *childregs;
-       unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE;
+       struct pt_regs *childregs = task_pt_regs(tsk);
        extern void ret_from_fork(void);
 
-       tsk->set_child_tid = tsk->clear_child_tid = NULL;
-
        /* Copy registers */
-       sp -= sizeof (struct pt_regs);
-       childregs = (struct pt_regs *)sp;
        *childregs = *regs;
 
        childregs->spu = spu;
@@ -263,14 +260,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
        return 0;
 }
 
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs * regs, struct user * dump)
-{
-       /* M32R_FIXME */
-}
-
 /*
  * Capture the user space registers if the task is not running (in user space)
  */
@@ -292,13 +281,16 @@ asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
 }
 
 asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
-       unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5,
-       unsigned long r6, struct pt_regs regs)
+                        unsigned long parent_tidptr,
+                        unsigned long child_tidptr,
+                        unsigned long r4, unsigned long r5, unsigned long r6,
+                        struct pt_regs regs)
 {
        if (!newsp)
                newsp = regs.spu;
 
-       return do_fork(clone_flags, newsp, &regs, 0, NULL, NULL);
+       return do_fork(clone_flags, newsp, &regs, 0,
+                      (int __user *)parent_tidptr, (int __user *)child_tidptr);
 }
 
 /*
@@ -322,9 +314,10 @@ asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, char __user * __user *uenvp,
-  unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
-  struct pt_regs regs)
+asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv,
+                         char __user * __user *uenvp,
+                         unsigned long r3, unsigned long r4, unsigned long r5,
+                         unsigned long r6, struct pt_regs regs)
 {
        int error;
        char *filename;
@@ -335,8 +328,11 @@ asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, c
                goto out;
 
        error = do_execve(filename, uargv, uenvp, &regs);
-       if (error == 0)
+       if (error == 0) {
+               task_lock(current);
                current->ptrace &= ~PT_DTRACE;
+               task_unlock(current);
+       }
        putname(filename);
 out:
        return error;
@@ -353,4 +349,3 @@ unsigned long get_wchan(struct task_struct *p)
        /* M32R_FIXME */
        return (0);
 }
-