Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 Misc reordering, to clarify and reduce th...
details: https://anonhg.NetBSD.org/src/rev/8dc46b7972c2
branches: trunk
changeset: 464394:8dc46b7972c2
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Oct 04 15:28:00 2019 +0000
description:
Misc reordering, to clarify and reduce the diff against amd64.
diffstat:
sys/arch/i386/i386/i386_trap.S | 49 ++++++++++++++++++++++++-----------------
sys/arch/i386/i386/locore.S | 19 +++++++++++-----
sys/arch/i386/i386/spl.S | 14 +++++++----
3 files changed, 51 insertions(+), 31 deletions(-)
diffs (271 lines):
diff -r 07ea99002bc6 -r 8dc46b7972c2 sys/arch/i386/i386/i386_trap.S
--- a/sys/arch/i386/i386/i386_trap.S Fri Oct 04 15:25:30 2019 +0000
+++ b/sys/arch/i386/i386/i386_trap.S Fri Oct 04 15:28:00 2019 +0000
@@ -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 @@
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 @@
#ifdef DIAGNOSTIC
movl CPUVAR(ILEVEL),%ebx
#endif
- jmp _C_LABEL(trapreturn)
+ jmp .Lalltraps_checkusr
IDTVEC_END(trap0f)
IDTVEC_END(intrspurious)
@@ -302,7 +302,7 @@
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 @@
.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 @@
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 @@
jmp .Lalltraps_checkast /* re-check ASTs */
3: CHECK_DEFERRED_SWITCH
jnz 9f
+
#ifdef XEN
STIC(%eax)
jz 6f
@@ -450,15 +454,23 @@
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 @@
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)
diff -r 07ea99002bc6 -r 8dc46b7972c2 sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S Fri Oct 04 15:25:30 2019 +0000
+++ b/sys/arch/i386/i386/locore.S Fri Oct 04 15:28:00 2019 +0000
@@ -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 @@
pushl $T_ASTFLT /* trap # for doing ASTs */
INTRENTRY
STI(%eax)
+
#ifdef DIAGNOSTIC
movl CPUVAR(ILEVEL),%ebx
testl %ebx,%ebx
@@ -1276,6 +1277,7 @@
#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 @@
movl L_MD_ASTPENDING(%edi), %eax
orl CPUVAR(WANT_PMAPLOAD), %eax
jnz 9f
+
#ifdef XEN
STIC(%eax)
jz 14f
@@ -1313,12 +1316,15 @@
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 @@
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
diff -r 07ea99002bc6 -r 8dc46b7972c2 sys/arch/i386/i386/spl.S
--- a/sys/arch/i386/i386/spl.S Fri Oct 04 15:25:30 2019 +0000
+++ b/sys/arch/i386/i386/spl.S Fri Oct 04 15:28:00 2019 +0000
@@ -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 @@
.Ldoreti_resume_stic:
movl $.Ldoreti_resume,%esi /* address to resume loop at */
.Ldoreti_resume:
+
#if defined(DEBUG)
#ifndef XENPV
pushf
@@ -278,6 +279,7 @@
jz .Ldoreti_panic
#endif /* XENPV */
#endif /* defined(DEBUG) */
+
#if !defined(XENPV)
movl %ebx,%eax
movl CPUVAR(IUNMASK)(,%eax,4),%eax
@@ -288,8 +290,8 @@
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 @@
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 @@
call _C_LABEL(pmap_load)
CLI(%eax)
jmp doreti_checkast /* recheck ASTs */
+
#if defined(DEBUG)
.Ldoreti_panic:
pushl $1f
Home |
Main Index |
Thread Index |
Old Index