git: 4bba531ad15a - stable/13 - i386: lower register's pressure on copyout_fast

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 09:30:07 UTC
The branch stable/13 has been updated by kib:

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

commit 4bba531ad15a5b8a7bbbdc17338b837a2339d733
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-09 20:38:57 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-21 09:29:02 +0000

    i386: lower register's pressure on copyout_fast
    
    (cherry picked from commit cbbf5227955d871d74556d4e83656a003aa9e334)
---
 sys/i386/i386/exception.s | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 8a2194038af6..73d77e289e7a 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -133,15 +133,15 @@ IDTVEC(prot)
 	jmp	irettraps
 IDTVEC(page)
 	testl	$PSL_VM, TF_EFLAGS-TF_ERR(%esp)
-	jnz	5f
+	jnz	6f
 	testb	$SEL_RPL_MASK, TF_CS-TF_ERR(%esp)
-	jnz	5f
+	jnz	6f
 	cmpl	$PMAP_TRM_MIN_ADDRESS, TF_EIP-TF_ERR(%esp)
-	jb	5f
+	jb	6f
 	pushl	%eax
 	movl	TF_EIP-TF_ERR+4(%esp), %eax
 	addl	$1f, %eax
-	call	6f
+	call	7f
 1:	cmpl	$pf_x1, %eax
 	je	2f
 	cmpl	$pf_x2, %eax
@@ -159,19 +159,25 @@ IDTVEC(page)
 	cmpl	$pf_x8, %eax
 	je	2f
 	cmpl	$pf_y1, %eax
-	je	3f
+	je	4f
 	cmpl	$pf_y2, %eax
-	je	3f
-	jmp	4f
-2:	movl	%ebx, %cr3
-3:	popl	%eax
+	je	4f
+	jmp	5f
+2:	movl	$tramp_idleptd, %eax
+	subl	$3f, %eax
+	call	8f
+3:	movl	(%eax), %eax
+	movl	%eax, %cr3
+4:	popl	%eax
 	movl	%edx, TF_EIP-TF_ERR(%esp)
 	addl	$4, %esp
 	iret
-4:	popl	%eax
-5:	pushl	$T_PAGEFLT
+5:	popl	%eax
+6:	pushl	$T_PAGEFLT
 	jmp	alltraps
-6:	subl	(%esp), %eax
+7:	subl	(%esp), %eax
+	retl
+8:	addl	(%esp), %eax
 	retl
 IDTVEC(rsvd_pti)
 IDTVEC(rsvd)