Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v retrieving revision 1.96 retrieving revision 1.97 diff -u -p -r1.96 -r1.97 --- src/sys/arch/i386/i386/locore.S 2012/02/24 08:06:07 1.96 +++ src/sys/arch/i386/i386/locore.S 2012/03/02 16:43:31 1.97 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.96 2012/02/24 08:06:07 cherry Exp $ */ +/* $NetBSD: locore.S,v 1.97 2012/03/02 16:43:31 bouyer Exp $ */ /* * Copyright-o-rama! @@ -129,7 +129,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.96 2012/02/24 08:06:07 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.97 2012/03/02 16:43:31 bouyer Exp $"); #include "opt_compat_oldboot.h" #include "opt_ddb.h" @@ -1013,15 +1013,17 @@ ENTRY(cpu_switchto) pushl %edi call _C_LABEL(i386_switch_context) addl $4,%esp -#else /* XEN */ +#else /* !XEN */ /* Switch ring0 esp */ movl PCB_ESP0(%ebx),%eax movl %eax,CPUVAR(ESP0) +#endif /* !XEN */ /* Don't bother with the rest if switching to a system process. */ testl $LW_SYSTEM,L_FLAG(%edi) jnz 4f +#ifndef XEN /* Restore thread-private %fs/%gs descriptors. */ movl CPUVAR(GDT),%ecx movl PCB_FSD(%ebx), %eax @@ -1032,7 +1034,7 @@ ENTRY(cpu_switchto) movl PCB_GSD+4(%ebx), %edx movl %eax, (GUGS_SEL*8)(%ecx) movl %edx, (GUGS_SEL*8+4)(%ecx) -#endif /* XEN */ +#endif /* !XEN */ /* Switch I/O bitmap */ movl PCB_IOMAP(%ebx),%eax @@ -1052,7 +1054,11 @@ ENTRY(cpu_switchto) * is deferred until mi_switch(), when cpu_switchto() returns. */ 2: -#ifndef XEN +#ifdef XEN + pushl %edi + call _C_LABEL(i386_tls_switch) + addl $4,%esp +#else /* !XEN */ movl $IPL_HIGH,CPUVAR(ILEVEL) movl PCB_CR0(%ebx),%ecx /* has CR0_TS clear */ movl %cr0,%edx @@ -1069,7 +1075,7 @@ ENTRY(cpu_switchto) 3: cmpl %edx,%ecx je 4f movl %ecx,%cr0 -#endif /* XEN */ +#endif /* !XEN */ /* Return to the new LWP, returning 'oldlwp' in %eax. */ 4: movl %esi,%eax