bitkeeper revision 1.1159.258.8 (421bc0b0jvILWAafCXfC9uUwrkZb3A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 22 Feb 2005 23:30:56 +0000 (23:30 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 22 Feb 2005 23:30:56 +0000 (23:30 +0000)
Clean up task-switch path. Now differs more from native code, but
it is a critical path. Also fixed a comment and FPU TS setting.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c

index 5eaf9e384cf299d281fb718844e76e5a3b3e8e22..26dee14c3ae92be360fcbde84c29924512f6a15b 100644 (file)
@@ -481,11 +481,8 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
        asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
 
        /*
-        * We clobber FS and GS here so that we avoid a GPF when
-        * restoring previous task's FS/GS values in Xen when the LDT
-        * is switched. If we don't do this then we can end up
-        * erroneously re-flushing the page-update queue when we
-        * 'execute_multicall_list'.
+        * We clobber FS and GS here so that we avoid a GPF when restoring
+        * previous task's FS/GS values in Xen when the LDT is switched.
         */
        __asm__ __volatile__ ( 
                "xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs" : : :
@@ -501,7 +498,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
         * synchronously trapping to Xen.
         */
        if (prev_p->thread_info->status & TS_USEDFPU) {
-               save_init_fpu(prev_p);
+               __save_init_fpu(prev_p); /* _not_ save_init_fpu() */
                queue_multicall0(__HYPERVISOR_fpu_taskswitch);
        }
 
@@ -510,12 +507,6 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
         * This is load_esp0(tss, next) with a multicall.
         */
        tss->esp0 = next->esp0;
-       /* This can only happen when SEP is enabled, no need to test
-        * "SEP"arately */
-       if (unlikely(tss->ss1 != next->sysenter_cs)) {
-               tss->ss1 = next->sysenter_cs;
-               wrmsr(MSR_IA32_SYSENTER_CS, next->sysenter_cs, 0);
-       }
        queue_multicall2(__HYPERVISOR_stack_switch, tss->ss0, tss->esp0);
 
        /*
@@ -549,7 +540,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
        /*
         * Restore %fs and %gs if needed.
         */
-       if (unlikely(prev->fs | prev->gs | next->fs | next->gs)) {
+       if (unlikely(next->fs | next->gs)) {
                loadsegment(fs, next->fs);
                loadsegment(gs, next->gs);
        }