diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-09-05 07:06:15 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-09-21 09:29:01 +0000 |
commit | bfca5cb04061ab4bfb1c1e617df1c14d4d82d56d (patch) | |
tree | 72312c815d6a8e5a3f976e8bfb044f3b46a116bb | |
parent | cd082e3f8a612aa2633e30cf90caab9ae3a779d6 (diff) | |
download | src-bfca5cb04061ab4bfb1c1e617df1c14d4d82d56d.tar.gz src-bfca5cb04061ab4bfb1c1e617df1c14d4d82d56d.zip |
i386 copyout_fast: do not use trampstk for temporal data, reduce ucr3 region
(cherry picked from commit 53133503740398fbfc770dfdf4d7e123075a241f)
-rw-r--r-- | sys/i386/i386/copyout_fast.s | 101 |
1 files 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 |