Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / i386 / kernel / process-xen.c
index 0c2fdcc..6cad288 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/user.h>
 #include <linux/a.out.h>
 #include <linux/interrupt.h>
-#include <linux/config.h>
 #include <linux/utsname.h>
 #include <linux/delay.h>
 #include <linux/reboot.h>
@@ -61,9 +60,6 @@
 #include <asm/tlbflush.h>
 #include <asm/cpu.h>
 
-#include <asm/tlbflush.h>
-#include <asm/cpu.h>
-
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
 static int hlt_counter;
@@ -108,10 +104,10 @@ void xen_idle(void)
        if (need_resched())
                local_irq_enable();
        else {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status &= ~TS_POLLING;
                smp_mb__after_clear_bit();
                safe_halt();
-               set_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status |= TS_POLLING;
        }
 }
 #ifdef CONFIG_APM_MODULE
@@ -146,7 +142,8 @@ void cpu_idle(void)
 {
        int cpu = smp_processor_id();
 
-       set_thread_flag(TIF_POLLING_NRFLAG);
+       current_thread_info()->status |= TS_POLLING;
+
 
        /* endless idle loop with no priority at all */
        while (1) {
@@ -228,7 +225,7 @@ void show_regs(struct pt_regs * regs)
        cr3 = read_cr3();
        cr4 = read_cr4_safe();
        printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
-       show_trace(NULL, &regs->esp);
+       show_trace(NULL, regs, &regs->esp);
 }
 
 /*
@@ -276,15 +273,16 @@ EXPORT_SYMBOL(kernel_thread);
  */
 void exit_thread(void)
 {
-       struct task_struct *tsk = current;
-       struct thread_struct *t = &tsk->thread;
-
        /* The process may have allocated an io port bitmap... nuke it. */
-       if (unlikely(NULL != t->io_bitmap_ptr)) {
+       if (unlikely(test_thread_flag(TIF_IO_BITMAP))) {
+               struct task_struct *tsk = current;
+               struct thread_struct *t = &tsk->thread;
+
                struct physdev_set_iobitmap set_iobitmap = { 0 };
                HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
                kfree(t->io_bitmap_ptr);
                t->io_bitmap_ptr = NULL;
+               clear_thread_flag(TIF_IO_BITMAP);
        }
 }
 
@@ -294,6 +292,7 @@ void flush_thread(void)
 
        memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8);
        memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));        
+       clear_tsk_thread_flag(tsk, TIF_DEBUG);
        /*
         * Forget coprocessor state..
         */
@@ -338,7 +337,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
        savesegment(gs,p->thread.gs);
 
        tsk = current;
-       if (unlikely(NULL != tsk->thread.io_bitmap_ptr)) {
+       if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
                p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
                if (!p->thread.io_bitmap_ptr) {
                        p->thread.io_bitmap_max = 0;
@@ -346,6 +345,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
                }
                memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr,
                        IO_BITMAP_BYTES);
+               set_tsk_thread_flag(p, TIF_IO_BITMAP);
        }
 
        /*
@@ -524,6 +524,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
 #if 0 /* lazy fpu sanity check */
        else BUG_ON(!(read_cr0() & 8));
 #endif
+
        if (next_p->mm)
                load_user_cs_desc(cpu, next_p->mm);
 
@@ -654,9 +655,6 @@ asmlinkage int sys_execve(struct pt_regs regs)
                        (char __user * __user *) regs.edx,
                        &regs);
        if (error == 0) {
-               task_lock(current);
-               current->ptrace &= ~PT_DTRACE;
-               task_unlock(current);
                /* Make sure we don't return using sysenter.. */
                set_thread_flag(TIF_IRET);
        }
@@ -825,6 +823,7 @@ void arch_add_exec_range(struct mm_struct *mm, unsigned long limit)
                }
        }
 }
+
 void arch_remove_exec_range(struct mm_struct *mm, unsigned long old_end)
 {
        struct vm_area_struct *vma;