git: 54e1546e0934 - main - i386: simplify flow control in irettraps
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Aug 2022 19:25:13 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=54e1546e09340682c871ad1387e42a765e117ad3
commit 54e1546e09340682c871ad1387e42a765e117ad3
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-22 05:56:45 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-24 19:12:22 +0000
i386: simplify flow control in irettraps
It is enough to have only one 'call calltrap' locally.
Reviewed by: jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36302
---
sys/i386/i386/exception.s | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 8279a4602ebf..2373fa425210 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -231,26 +231,23 @@ 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: 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
@@ -259,6 +256,7 @@ irettraps:
movl %esp, %esi
rep; movsb
movl %edx, %esp
+ /* kernel mode, normal */
jmp calltrap
/*