fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / frv / kernel / process.c
index 3001b82..515a5ce 100644 (file)
@@ -10,7 +10,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h>
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -26,6 +26,7 @@
 #include <linux/reboot.h>
 #include <linux/interrupt.h>
 
+#include <asm/asm-offsets.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/setup.h>
@@ -39,6 +40,9 @@ asmlinkage void ret_from_fork(void);
 
 #include <asm/pgalloc.h>
 
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
 struct task_struct *alloc_task_struct(void)
 {
        struct task_struct *p = kmalloc(THREAD_SIZE, GFP_KERNEL);
@@ -77,16 +81,20 @@ void (*idle)(void) = core_sleep_idle;
  */
 void cpu_idle(void)
 {
+       int cpu = smp_processor_id();
+
        /* endless idle loop with no priority at all */
        while (1) {
                while (!need_resched()) {
-                       irq_stat[smp_processor_id()].idle_timestamp = jiffies;
+                       irq_stat[cpu].idle_timestamp = jiffies;
 
                        if (!frv_dma_inprogress && idle)
                                idle();
                }
 
+               preempt_enable_no_resched();
                schedule();
+               preempt_disable();
        }
 }
 
@@ -200,7 +208,7 @@ int copy_thread(int nr, unsigned long clone_flags,
 
        regs0 = __kernel_frame0_ptr;
        childregs0 = (struct pt_regs *)
-               ((unsigned long) p->thread_info + THREAD_SIZE - USER_CONTEXT_SIZE);
+               (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
        childregs = childregs0;
 
        /* set up the userspace frame (the only place that the USP is stored) */
@@ -216,7 +224,7 @@ int copy_thread(int nr, unsigned long clone_flags,
                *childregs = *regs;
                childregs->sp = (unsigned long) childregs0;
                childregs->next_frame = childregs0;
-               childregs->gr15 = (unsigned long) p->thread_info;
+               childregs->gr15 = (unsigned long) task_thread_info(p);
                childregs->gr29 = (unsigned long) p;
        }
 
@@ -239,32 +247,10 @@ int copy_thread(int nr, unsigned long clone_flags,
        return 0;
 } /* end copy_thread() */
 
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs *regs, struct user *dump)
-{
-#if 0
-       /* changed the size calculations - should hopefully work better. lbt */
-       dump->magic = CMAGIC;
-       dump->start_code = 0;
-       dump->start_stack = user_stack(regs) & ~(PAGE_SIZE - 1);
-       dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
-       dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
-       dump->u_dsize -= dump->u_tsize;
-       dump->u_ssize = 0;
-
-       if (dump->start_stack < TASK_SIZE)
-               dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
-
-       dump->regs = *(struct user_context *) regs;
-#endif
-}
-
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char *name, char **argv, char **envp)
+asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
 {
        int error;
        char * filename;
@@ -386,3 +372,11 @@ int elf_check_arch(const struct elf32_hdr *hdr)
 
        return 1;
 }
+
+int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
+{
+       memcpy(fpregs,
+              &current->thread.user->f,
+              sizeof(current->thread.user->f));
+       return 1;
+}