Module Name: src Committed By: maxv Date: Fri Oct 4 15:28:00 UTC 2019
Modified Files: src/sys/arch/i386/i386: i386_trap.S locore.S spl.S Log Message: Misc reordering, to clarify and reduce the diff against amd64. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/i386_trap.S cvs rdiff -u -r1.170 -r1.171 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/i386/spl.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/i386/i386_trap.S diff -u src/sys/arch/i386/i386/i386_trap.S:1.18 src/sys/arch/i386/i386/i386_trap.S:1.19 --- src/sys/arch/i386/i386/i386_trap.S:1.18 Mon Feb 11 17:28:52 2019 +++ src/sys/arch/i386/i386/i386_trap.S Fri Oct 4 15:28:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $ */ +/* $NetBSD: i386_trap.S,v 1.19 2019/10/04 15:28:00 maxv Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -66,7 +66,7 @@ #if 0 #include <machine/asm.h> -__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.19 2019/10/04 15:28:00 maxv Exp $"); #endif /* @@ -220,7 +220,7 @@ IDTVEC(trap07) pushl %esp call _C_LABEL(fpudna) addl $4,%esp - jmp _C_LABEL(trapreturn) + jmp .Lalltraps_checkusr IDTVEC_END(trap07) IDTVEC(trap08) @@ -282,7 +282,7 @@ IDTVEC(trap0f) #ifdef DIAGNOSTIC movl CPUVAR(ILEVEL),%ebx #endif - jmp _C_LABEL(trapreturn) + jmp .Lalltraps_checkusr IDTVEC_END(trap0f) IDTVEC_END(intrspurious) @@ -302,7 +302,7 @@ IDTVEC(trap10) adcl $0,CPUVAR(NTRAP)+4 call _C_LABEL(fputrap) addl $4,%esp - jmp _C_LABEL(trapreturn) + jmp .Lalltraps_checkusr IDTVEC_END(trap10) IDTVEC(trap11) @@ -394,13 +394,14 @@ IDTVEC_END(tss_trap08) .type _C_LABEL(trap_return_fault_return),@function LABEL(trap_return_fault_return) mov 4(%esp),%esp /* frame for user return */ - jmp _C_LABEL(trapreturn) + jmp .Lalltraps_checkusr END(trap_return_fault_return) /* LINTSTUB: Ignore */ ENTRY(alltraps) INTRENTRY STI(%eax) + calltrap: #ifdef DIAGNOSTIC movl CPUVAR(ILEVEL),%ebx @@ -410,16 +411,18 @@ calltrap: pushl %esp call _C_LABEL(trap) addl $4,%esp -_C_LABEL(trapreturn): .globl trapreturn + +.Lalltraps_checkusr: testb $CHK_UPL,TF_CS(%esp) jnz .Lalltraps_checkast jmp 6f + .Lalltraps_checkast: /* Check for ASTs on exit to user mode. */ CLI(%eax) CHECK_ASTPENDING(%eax) jz 3f -5: CLEAR_ASTPENDING(%eax) + CLEAR_ASTPENDING(%eax) STI(%eax) movl $T_ASTFLT,TF_TRAPNO(%esp) addl $1,CPUVAR(NTRAP) /* statistical info */ @@ -430,6 +433,7 @@ _C_LABEL(trapreturn): .globl trapreturn jmp .Lalltraps_checkast /* re-check ASTs */ 3: CHECK_DEFERRED_SWITCH jnz 9f + #ifdef XEN STIC(%eax) jz 6f @@ -450,15 +454,23 @@ _C_LABEL(trapreturn): .globl trapreturn movl CPUVAR(XSOURCES)(,%eax,4),%eax jmp *IS_RESUME(%eax) 7: movl %ebx,CPUVAR(ILEVEL) /* restore cpl */ - jmp _C_LABEL(trapreturn) -#endif /* XEN */ -#ifndef DIAGNOSTIC -6: INTRFASTEXIT -#else -6: cmpl CPUVAR(ILEVEL),%ebx - jne 3f + jmp .Lalltraps_checkusr +#endif + +6: +#ifdef DIAGNOSTIC + cmpl CPUVAR(ILEVEL),%ebx + jne .Lspl_error +#endif INTRFASTEXIT -3: STI(%eax) + +9: STI(%eax) + call _C_LABEL(pmap_load) + jmp .Lalltraps_checkast /* re-check ASTs */ + +#ifdef DIAGNOSTIC +.Lspl_error: + STI(%eax) pushl $4f call _C_LABEL(panic) addl $4,%esp @@ -467,8 +479,5 @@ _C_LABEL(trapreturn): .globl trapreturn addl $4,%esp jmp .Lalltraps_checkast /* re-check ASTs */ 4: .asciz "SPL NOT LOWERED ON TRAP EXIT\n" -#endif /* DIAGNOSTIC */ -9: STI(%eax) - call _C_LABEL(pmap_load) - jmp .Lalltraps_checkast /* re-check ASTs */ +#endif END(alltraps) Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.170 src/sys/arch/i386/i386/locore.S:1.171 --- src/sys/arch/i386/i386/locore.S:1.170 Fri Oct 4 11:47:07 2019 +++ src/sys/arch/i386/i386/locore.S Fri Oct 4 15:28:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $ */ +/* $NetBSD: locore.S,v 1.171 2019/10/04 15:28:00 maxv Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include <machine/asm.h> -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.171 2019/10/04 15:28:00 maxv Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -1264,6 +1264,7 @@ IDTVEC(syscall) pushl $T_ASTFLT /* trap # for doing ASTs */ INTRENTRY STI(%eax) + #ifdef DIAGNOSTIC movl CPUVAR(ILEVEL),%ebx testl %ebx,%ebx @@ -1276,6 +1277,7 @@ IDTVEC(syscall) #endif 1: #endif /* DIAGNOSTIC */ + addl $1,CPUVAR(NSYSCALL) /* count it atomically */ adcl $0,CPUVAR(NSYSCALL)+4 /* count it atomically */ movl CPUVAR(CURLWP),%edi @@ -1290,6 +1292,7 @@ IDTVEC(syscall) movl L_MD_ASTPENDING(%edi), %eax orl CPUVAR(WANT_PMAPLOAD), %eax jnz 9f + #ifdef XEN STIC(%eax) jz 14f @@ -1313,12 +1316,15 @@ IDTVEC(syscall) jmp .Lsyscall_checkast 14: #endif /* XEN */ -#ifndef DIAGNOSTIC - INTRFASTEXIT -#else /* DIAGNOSTIC */ + +#ifdef DIAGNOSTIC cmpl $IPL_NONE,CPUVAR(ILEVEL) jne 3f +#endif + INTRFASTEXIT + +#ifdef DIAGNOSTIC 3: STI(%eax) pushl $4f call _C_LABEL(panic) @@ -1329,7 +1335,8 @@ IDTVEC(syscall) jmp .Lsyscall_checkast 4: .asciz "SPL NOT LOWERED ON SYSCALL EXIT\n" 5: .asciz "SPL NOT ZERO ON SYSCALL ENTRY\n" -#endif /* DIAGNOSTIC */ +#endif + 9: cmpl $0, CPUVAR(WANT_PMAPLOAD) jz 10f Index: src/sys/arch/i386/i386/spl.S diff -u src/sys/arch/i386/i386/spl.S:1.47 src/sys/arch/i386/i386/spl.S:1.48 --- src/sys/arch/i386/i386/spl.S:1.47 Mon Feb 11 14:59:32 2019 +++ src/sys/arch/i386/i386/spl.S Fri Oct 4 15:28:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.47 2019/02/11 14:59:32 cherry Exp $ */ +/* $NetBSD: spl.S,v 1.48 2019/10/04 15:28:00 maxv Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <machine/asm.h> -__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.47 2019/02/11 14:59:32 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.48 2019/10/04 15:28:00 maxv Exp $"); #include "opt_ddb.h" #include "opt_spldebug.h" @@ -265,6 +265,7 @@ IDTVEC(doreti) .Ldoreti_resume_stic: movl $.Ldoreti_resume,%esi /* address to resume loop at */ .Ldoreti_resume: + #if defined(DEBUG) #ifndef XENPV pushf @@ -278,6 +279,7 @@ IDTVEC(doreti) jz .Ldoreti_panic #endif /* XENPV */ #endif /* defined(DEBUG) */ + #if !defined(XENPV) movl %ebx,%eax movl CPUVAR(IUNMASK)(,%eax,4),%eax @@ -288,8 +290,8 @@ IDTVEC(doreti) movl CPUVAR(ISOURCES)(,%eax, 4),%eax jmp *IS_RESUME(%eax) #endif -2: /* Check for ASTs on exit to user mode. */ -#if defined(XEN) +2: +#if defined(XEN) movl %ebx,%eax movl CPUVAR(XUNMASK)(,%eax,4),%eax andl CPUVAR(XPENDING),%eax @@ -299,12 +301,13 @@ IDTVEC(doreti) movl CPUVAR(XSOURCES)(,%eax, 4),%eax jmp *IS_RESUME(%eax) #endif -3: +3: /* Check for ASTs on exit to user mode. */ movl %ebx,CPUVAR(ILEVEL) 5: testb $CHK_UPL,TF_CS(%esp) jnz doreti_checkast jmp 6f + .type _C_LABEL(doreti_checkast), @function LABEL(doreti_checkast) CHECK_ASTPENDING(%eax) @@ -340,6 +343,7 @@ END(doreti_checkast) call _C_LABEL(pmap_load) CLI(%eax) jmp doreti_checkast /* recheck ASTs */ + #if defined(DEBUG) .Ldoreti_panic: pushl $1f