]> err.no Git - linux-2.6/blobdiff - arch/um/kernel/process_kern.c
Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
[linux-2.6] / arch / um / kernel / process_kern.c
index 7a943696f9507b64230c3528c4ccfddb77795227..c23d8a08d0ff5403df391fbdd04ca86baa89a391 100644 (file)
@@ -8,6 +8,7 @@
 #include "linux/kernel.h"
 #include "linux/sched.h"
 #include "linux/interrupt.h"
+#include "linux/string.h"
 #include "linux/mm.h"
 #include "linux/slab.h"
 #include "linux/utsname.h"
@@ -43,7 +44,6 @@
 #include "tlb.h"
 #include "frame_kern.h"
 #include "sigcontext.h"
-#include "2_5compat.h"
 #include "os.h"
 #include "mode.h"
 #include "mode_kern.h"
  */
 struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
 
-struct task_struct *get_task(int pid, int require)
-{
-        struct task_struct *ret;
-
-        read_lock(&tasklist_lock);
-       ret = find_task_by_pid(pid);
-        read_unlock(&tasklist_lock);
-
-        if(require && (ret == NULL)) panic("get_task couldn't find a task\n");
-        return(ret);
-}
-
 int external_pid(void *t)
 {
        struct task_struct *task = t ? t : current;
@@ -108,23 +96,13 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 
        current->thread.request.u.thread.proc = fn;
        current->thread.request.u.thread.arg = arg;
-       pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, NULL, 0, NULL,
-                     NULL);
+       pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0,
+                     &current->thread.regs, 0, NULL, NULL);
        if(pid < 0)
                panic("do_fork failed in kernel_thread, errno = %d", pid);
        return(pid);
 }
 
-void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
-              struct task_struct *tsk)
-{
-       int cpu = smp_processor_id();
-
-       if (prev != next) 
-               cpu_clear(cpu, prev->cpu_vm_mask);
-       cpu_set(cpu, next->cpu_vm_mask);
-}
-
 void set_current(void *t)
 {
        struct task_struct *task = t;
@@ -152,7 +130,6 @@ void release_thread(struct task_struct *task)
  
 void exit_thread(void)
 {
-       CHOOSE_MODE(exit_thread_tt(), exit_thread_skas());
        unprotect_stack((unsigned long) current_thread);
 }
  
@@ -192,7 +169,7 @@ int current_pid(void)
 
 void default_idle(void)
 {
-       uml_idle_timer();
+       CHOOSE_MODE(uml_idle_timer(), (void) 0);
 
        atomic_inc(&init_mm.mm_count);
        current->mm = &init_mm;
@@ -200,7 +177,6 @@ void default_idle(void)
 
        while(1){
                /* endless idle loop with no priority at all */
-               SET_PRI(current);
 
                /*
                 * although we are an idle CPU, we do not want to
@@ -223,11 +199,6 @@ int page_size(void)
        return(PAGE_SIZE);
 }
 
-unsigned long page_mask(void)
-{
-       return(PAGE_MASK);
-}
-
 void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 
                      pte_t *pte_out)
 {
@@ -352,17 +323,7 @@ void do_uml_exitcalls(void)
 
 char *uml_strdup(char *string)
 {
-       char *new;
-
-       new = kmalloc(strlen(string) + 1, GFP_KERNEL);
-       if(new == NULL) return(NULL);
-       strcpy(new, string);
-       return(new);
-}
-
-void *get_init_task(void)
-{
-       return(&init_thread_union.thread_info.task);
+       return kstrdup(string, GFP_KERNEL);
 }
 
 int copy_to_user_proc(void __user *to, void *from, int size)
@@ -451,7 +412,7 @@ int __init make_proc_sysemu(void)
 
        if (ent == NULL)
        {
-               printk("Failed to register /proc/sysemu\n");
+               printk(KERN_WARNING "Failed to register /proc/sysemu\n");
                return(0);
        }
 
@@ -476,21 +437,18 @@ int singlestepping(void * t)
        return 2;
 }
 
+/*
+ * Only x86 and x86_64 have an arch_align_stack().
+ * All other arches have "#define arch_align_stack(x) (x)"
+ * in their asm/system.h
+ * As this is included in UML from asm-um/system-generic.h,
+ * we can use it to behave as the subarch does.
+ */
+#ifndef arch_align_stack
 unsigned long arch_align_stack(unsigned long sp)
 {
        if (randomize_va_space)
                sp -= get_random_int() % 8192;
        return sp & ~0xf;
 }
-
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
+#endif