linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / m68k / kernel / process.c
index a270b5f..2d8ad07 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/a.out.h>
 #include <linux/reboot.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -67,8 +68,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
 {
        struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
        /* Check whether the thread is blocked in resume() */
-       if (sw->retpc > (unsigned long)scheduling_functions_start_here &&
-           sw->retpc < (unsigned long)scheduling_functions_end_here)
+       if (in_sched_functions(sw->retpc))
                return ((unsigned long *)sw->a6)[1];
        else
                return sw->retpc;
@@ -102,7 +102,9 @@ void cpu_idle(void)
        while (1) {
                while (!need_resched())
                        idle();
+               preempt_enable_no_resched();
                schedule();
+               preempt_disable();
        }
 }
 
@@ -113,8 +115,6 @@ void machine_restart(char * __unused)
        for (;;);
 }
 
-EXPORT_SYMBOL(machine_restart);
-
 void machine_halt(void)
 {
        if (mach_halt)
@@ -122,8 +122,6 @@ void machine_halt(void)
        for (;;);
 }
 
-EXPORT_SYMBOL(machine_halt);
-
 void machine_power_off(void)
 {
        if (mach_power_off)
@@ -131,7 +129,8 @@ void machine_power_off(void)
        for (;;);
 }
 
-EXPORT_SYMBOL(machine_power_off);
+void (*pm_power_off)(void) = machine_power_off;
+EXPORT_SYMBOL(pm_power_off);
 
 void show_regs(struct pt_regs * regs)
 {
@@ -232,7 +231,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
        child_tidptr = (int *)regs->d4;
        if (!newsp)
                newsp = rdusp();
-       return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, regs, 0,
+       return do_fork(clone_flags, newsp, regs, 0,
                       parent_tidptr, child_tidptr);
 }
 
@@ -242,10 +241,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs * childregs;
        struct switch_stack * childstack, *stack;
-       unsigned long stack_offset, *retp;
+       unsigned long *retp;
 
-       stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
-       childregs = (struct pt_regs *) ((unsigned long) (p->thread_info) + stack_offset);
+       childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
 
        *childregs = *regs;
        childregs->d0 = 0;
@@ -382,12 +380,6 @@ out:
        return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched    ((unsigned long) scheduling_functions_start_here)
-#define last_sched     ((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long fp, pc;
@@ -396,14 +388,14 @@ unsigned long get_wchan(struct task_struct *p)
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
 
-       stack_page = (unsigned long)(p->thread_info);
+       stack_page = (unsigned long)task_stack_page(p);
        fp = ((struct switch_stack *)p->thread.ksp)->a6;
        do {
                if (fp < stack_page+sizeof(struct thread_info) ||
                    fp >= 8184+stack_page)
                        return 0;
                pc = ((unsigned long *)fp)[1];
-               if (pc < first_sched || pc >= last_sched)
+               if (!in_sched_functions(pc))
                        return pc;
                fp = *(unsigned long *) fp;
        } while (count++ < 16);