git: bf71e2e26745 - stable/13 - i386: simplify flow control in irettraps

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 31 Aug 2022 01:32:15 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=bf71e2e2674547dd2ef554c37de86ee30a54eb50

commit bf71e2e2674547dd2ef554c37de86ee30a54eb50
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-22 05:56:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-31 01:20:27 +0000

    i386: simplify flow control in irettraps
    
    (cherry picked from commit 54e1546e09340682c871ad1387e42a765e117ad3)
---
 sys/i386/i386/exception.s | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 90c3182f9b13..4e347642cc0f 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -236,27 +236,24 @@ irettraps:
 	jne	2f
 	/* -8 because exception did not switch ring */
 	movl	$(2 * TF_SZ - TF_EIP - 8), %ecx
-	jmp	6f
+	jmp	5f
 2:	leal	(doreti_popl_ds - 1b)(%ebx), %edx
 	cmpl	%edx, TF_EIP(%esp)
 	jne	3f
 	movl	$(2 * TF_SZ - TF_DS - 8), %ecx
-	jmp	6f
+	jmp	5f
 3:	leal	(doreti_popl_es - 1b)(%ebx), %edx
 	cmpl	%edx, TF_EIP(%esp)
 	jne	4f
 	movl	$(2 * TF_SZ - TF_ES - 8), %ecx
-	jmp	6f
+	jmp	5f
 4:	leal	(doreti_popl_fs - 1b)(%ebx), %edx
 	cmpl	%edx, TF_EIP(%esp)
-	jne	5f
+	jne	calltrap
 	movl	$(2 * TF_SZ - TF_FS - 8), %ecx
 	jmp	6f
-	/* kernel mode, normal */
-5:	FAKE_MCOUNT(TF_EIP(%esp))
-	jmp	calltrap
-6:	cmpl	$PMAP_TRM_MIN_ADDRESS, %esp	/* trampoline stack ? */
-	jb	5b	/* if not, no need to change stacks */
+5:	cmpl	$PMAP_TRM_MIN_ADDRESS, %esp	/* trampoline stack ? */
+	jb	calltrap	  /* if not, no need to change stacks */
 	movl	(tramp_idleptd - 1b)(%ebx), %eax
 	movl	%eax, %cr3
 	movl	PCPU(KESP0), %edx
@@ -265,7 +262,7 @@ irettraps:
 	movl	%esp, %esi
 	rep; movsb
 	movl	%edx, %esp
-	FAKE_MCOUNT(TF_EIP(%esp))
+	/* kernel mode, normal */
 	jmp	calltrap
 
 /*