vserver 2.0 rc7
[linux-2.6.git] / arch / um / kernel / process_kern.c
index e4d400b..632b88f 100644 (file)
@@ -21,6 +21,7 @@
 #include "linux/spinlock.h"
 #include "linux/proc_fs.h"
 #include "linux/ptrace.h"
+#include "linux/random.h"
 #include "linux/vs_cvirt.h"
 
 #include "asm/unistd.h"
@@ -44,7 +45,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;
@@ -116,16 +104,6 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
        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;
@@ -153,7 +131,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);
 }
  
@@ -162,10 +139,6 @@ void *get_current(void)
        return(current);
 }
 
-void prepare_to_copy(struct task_struct *tsk)
-{
-}
-
 int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                unsigned long stack_top, struct task_struct * p, 
                struct pt_regs *regs)
@@ -205,7 +178,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
@@ -228,11 +200,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)
 {
@@ -365,11 +332,6 @@ char *uml_strdup(char *string)
        return(new);
 }
 
-void *get_init_task(void)
-{
-       return(&init_thread_union.thread_info.task);
-}
-
 int copy_to_user_proc(void __user *to, void *from, int size)
 {
        return(copy_to_user(to, from, size));
@@ -482,12 +444,17 @@ int singlestepping(void * t)
 }
 
 /*
- * 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:
+ * 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;
+}
+#endif