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 rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.67.4.6 retrieving revision 1.95.8.4 diff -u -p -r1.67.4.6 -r1.95.8.4 --- src/sys/arch/i386/i386/locore.S 2010/08/11 22:52:11 1.67.4.6 +++ src/sys/arch/i386/i386/locore.S 2012/04/29 23:04:41 1.95.8.4 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.67.4.6 2010/08/11 22:52:11 yamt Exp $ */ +/* $NetBSD: locore.S,v 1.95.8.4 2012/04/29 23:04:41 mrg Exp $ */ /* * Copyright-o-rama! @@ -129,7 +129,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.67.4.6 2010/08/11 22:52:11 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.95.8.4 2012/04/29 23:04:41 mrg Exp $"); #include "opt_compat_oldboot.h" #include "opt_ddb.h" @@ -238,7 +238,12 @@ _C_LABEL(tablesize): .long 0 .space 512 tmpstk: - +#ifdef XEN + .align PAGE_SIZE, 0x0 # Align on page boundary +_C_LABEL(tmpgdt): + .space PAGE_SIZE # Xen expects a page +#endif /* XEN */ + .globl tmpgdt #ifndef XEN #define _RELOC(x) ((x) - KERNBASE) #else @@ -677,7 +682,7 @@ try586: /* Use the `cpuid' instruction. */ movl %cr0,%eax # get control word # enable paging & NPX emulation - orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP),%eax + orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP|CR0_AM),%eax movl %eax,%cr0 # and page NOW! pushl $begin # jump to high mem @@ -787,6 +792,15 @@ start: cpuid movl %eax,RELOC(cpuid_level) + /* + * Use a temp page. We'll re- add it to uvm(9) once we're + * done using it. + */ + movl $RELOC(tmpgdt), %eax + pushl %eax # start of temporary gdt + call _C_LABEL(initgdt) + addl $4,%esp + call xen_pmap_bootstrap /* @@ -999,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 @@ -1018,12 +1034,12 @@ 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 orl %eax,%eax - jnz,pn .Lcopy_iobitmap + jnz .Lcopy_iobitmap movl $(IOMAP_INVALOFF << 16),CPUVAR(IOBASE) .Liobitmap_done: @@ -1038,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 @@ -1055,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 @@ -1145,7 +1165,8 @@ syscall1: #endif 1: #endif /* DIAGNOSTIC */ - incl CPUVAR(NSYSCALL) # count it atomically + addl $1,CPUVAR(NSYSCALL) # count it atomically + adcl $0,CPUVAR(NSYSCALL)+4 # count it atomically movl CPUVAR(CURLWP),%edi movl L_PROC(%edi),%edx movl %esp,L_MD_REGS(%edi) # save pointer to frame