git: bfca5cb04061 - stable/13 - i386 copyout_fast: do not use trampstk for temporal data, reduce ucr3 region
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Sep 2022 09:30:04 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=bfca5cb04061ab4bfb1c1e617df1c14d4d82d56d
commit bfca5cb04061ab4bfb1c1e617df1c14d4d82d56d
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-05 07:06:15 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-21 09:29:01 +0000
i386 copyout_fast: do not use trampstk for temporal data, reduce ucr3 region
(cherry picked from commit 53133503740398fbfc770dfdf4d7e123075a241f)
---
sys/i386/i386/copyout_fast.s | 101 +++++++++++--------------------------------
1 file changed, 26 insertions(+), 75 deletions(-)
diff --git a/sys/i386/i386/copyout_fast.s b/sys/i386/i386/copyout_fast.s
index d1d17f775872..70647fe7613d 100644
--- a/sys/i386/i386/copyout_fast.s
+++ b/sys/i386/i386/copyout_fast.s
@@ -46,53 +46,27 @@ ENTRY(copyout_fast)
pushl %edi
pushl %ebx
- movl $copyout_fault,%edx
- movl 20(%ebp),%ebx /* KCR3 */
-
- movl PCPU(CURPCB),%eax
- movl PCB_CR3(%eax),%edi
-
+ movl 20(%ebp),%ebx /* KCR3 */
+ movl PCPU(CURPCB),%edx
+ movl PCB_CR3(%edx),%edx /* UCR3 */
+ /* bcopy(%esi = kaddr, %edi = PCPU(copyout_buf), %ecx = len) */
+ movl 16(%ebp),%ecx
+ movl 8(%ebp),%esi
cli
- movl PCPU(TRAMPSTK),%esi
- movl PCPU(COPYOUT_BUF),%eax
- subl $4,%esi
- movl %eax,(%esi)
- movl 12(%ebp),%eax /* udaddr */
- subl $4,%esi
- movl %eax,(%esi)
- movl 16(%ebp),%eax /* len */
- subl $4,%esi
- movl %eax,(%esi)
-
- subl $4, %esi
- movl %edi, (%esi)
+ movl PCPU(COPYOUT_BUF),%edi
+ rep; movsb
- movl 8(%ebp),%eax /* kaddr */
- subl $4,%esi
- movl %eax,(%esi)
- movl PCPU(COPYOUT_BUF),%eax
- subl $4,%esi
- movl %eax,(%esi)
- movl 16(%ebp),%eax /* len */
- subl $4,%esi
- movl %eax,(%esi)
+ movl 16(%ebp),%ecx /* len */
+ movl PCPU(COPYOUT_BUF),%esi /* kaddr */
+ movl 12(%ebp),%edi /* uaddr */
movl %esp,%eax
- movl %esi,%esp
-
- /* bcopy(%esi = kaddr, %edi = PCPU(copyout_buf), %ecx = len) */
- popl %ecx
- popl %edi
- popl %esi
- rep; movsb
+ movl PCPU(TRAMPSTK),%esp
- popl %edi
- movl %edi,%cr3
+ movl %edx,%cr3
+ movl $copyout_fault,%edx
/* bcopy(%esi = PCPU(copyout_buf), %edi = udaddr, %ecx = len) */
- popl %ecx
- popl %edi
- popl %esi
pf_x1: rep; movsb
movl %ebx,%cr3
@@ -114,53 +88,30 @@ ENTRY(copyin_fast)
pushl %edi
pushl %ebx
- movl $copyout_fault,%edx
- movl 20(%ebp),%ebx /* KCR3 */
-
+ movl 20(%ebp),%ebx /* KCR3 */
movl PCPU(CURPCB),%eax
- movl PCB_CR3(%eax),%edi
-
+ movl PCB_CR3(%eax),%edx /* UCR3 */
+ movl 16(%ebp),%ecx /* len */
+ movl 8(%ebp),%esi /* udaddr */
cli
- movl PCPU(TRAMPSTK),%esi
- movl PCPU(COPYOUT_BUF),%eax
- subl $4,%esi
- movl %eax,(%esi)
- movl 12(%ebp),%eax /* kaddr */
- subl $4,%esi
- movl %eax,(%esi)
- movl 16(%ebp),%eax /* len */
- subl $4,%esi
- movl %eax,(%esi)
-
- movl 8(%ebp),%eax /* udaddr */
- subl $4,%esi
- movl %eax,(%esi)
- movl PCPU(COPYOUT_BUF),%eax
- subl $4,%esi
- movl %eax,(%esi)
- movl 16(%ebp),%eax /* len */
- subl $4,%esi
- movl %eax,(%esi)
+ movl PCPU(COPYOUT_BUF),%edi /* kaddr */
movl %esp,%eax
- movl %esi,%esp
- movl %edi,%cr3
-
+ movl PCPU(TRAMPSTK),%esp
+ movl %edx,%cr3
+ movl $copyout_fault,%edx
/* bcopy(%esi = udaddr, %edi = PCPU(copyout_buf), %ecx = len) */
- popl %ecx
- popl %edi
- popl %esi
pf_x2: rep; movsb
movl %ebx,%cr3
+ movl %eax,%esp
/* bcopy(%esi = PCPU(copyout_buf), %edi = kaddr, %ecx = len) */
- popl %ecx
- popl %edi
- popl %esi
+ movl 16(%ebp),%ecx
+ movl 12(%ebp),%edi
+ movl PCPU(COPYOUT_BUF),%esi
rep; movsb
- movl %eax,%esp
sti
xorl %eax,%eax