Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152375192
D17288.id48381.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D17288.id48381.diff
View Options
Index: sys/amd64/amd64/support.S
===================================================================
--- sys/amd64/amd64/support.S
+++ sys/amd64/amd64/support.S
@@ -915,27 +915,22 @@
.macro COPYINSTR smap
PUSH_FRAME_POINTER
movq %rdx,%r8 /* %r8 = maxlen */
- movq %rcx,%r9 /* %r9 = *len */
- xchgq %rdi,%rsi /* %rdi = from, %rsi = to */
- movq PCPU(CURPCB),%rcx
- movq $cpystrflt,PCB_ONFAULT(%rcx)
+ movq PCPU(CURPCB),%r9
+ movq $cpystrflt,PCB_ONFAULT(%r9)
movq $VM_MAXUSER_ADDRESS,%rax
/* make sure 'from' is within bounds */
- subq %rsi,%rax
+ subq %rdi,%rax
jbe cpystrflt
SMAP_DISABLE \smap
/* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */
cmpq %rdx,%rax
- jae 1f
- movq %rax,%rdx
- movq %rax,%r8
+ jb 8f
1:
incq %rdx
-
2:
decq %rdx
.if \smap == 0
@@ -944,9 +939,11 @@
jz copyinstr_toolong_smap
.endif
- lodsb
- stosb
- orb %al,%al
+ movb (%rdi),%al
+ movb %al,(%rsi)
+ incq %rsi
+ incq %rdi
+ testb %al,%al
jnz 2b
SMAP_ENABLE \smap
@@ -956,30 +953,42 @@
xorl %eax,%eax
/* set *lencopied and return %eax */
- movq PCPU(CURPCB),%rcx
- movq $0,PCB_ONFAULT(%rcx)
+ movq %rax,PCB_ONFAULT(%r9)
- testq %r9,%r9
+ testq %rcx,%rcx
jz 3f
subq %rdx,%r8
- movq %r8,(%r9)
+ movq %r8,(%rcx)
3:
POP_FRAME_POINTER
ret
+ ALIGN_TEXT
+8:
+ movq %rax,%rdx
+ movq %rax,%r8
+ jmp 1b
+
.endm
+ENTRY(copyinstr_nosmap)
+ COPYINSTR smap=0
+END(copyinstr_nosmap)
+
+ENTRY(copyinstr_smap)
+ COPYINSTR smap=1
+END(copyinstr_smap)
+
cpystrflt:
/* Fault entry clears PSL.AC */
movl $EFAULT,%eax
cpystrflt_x:
/* set *lencopied and return %eax */
- movq PCPU(CURPCB),%rcx
- movq $0,PCB_ONFAULT(%rcx)
+ movq $0,PCB_ONFAULT(%r9)
- testq %r9,%r9
+ testq %rcx,%rcx
jz 1f
subq %rdx,%r8
- movq %r8,(%r9)
+ movq %r8,(%rcx)
1:
POP_FRAME_POINTER
ret
@@ -994,14 +1003,6 @@
movl $ENAMETOOLONG,%eax
jmp cpystrflt_x
-ENTRY(copyinstr_nosmap)
- COPYINSTR smap=0
-END(copyinstr_nosmap)
-
-ENTRY(copyinstr_smap)
- COPYINSTR smap=1
-END(copyinstr_smap)
-
/*
* copystr(from, to, maxlen, int *lencopied)
* %rdi, %rsi, %rdx, %rcx
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 15, 1:17 PM (5 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31540884
Default Alt Text
D17288.id48381.diff (2 KB)
Attached To
Mode
D17288: amd64: depessimize copyinstr
Attached
Detach File
Event Timeline
Log In to Comment