Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175562567
D17265.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
D17265.diff
View Options
Index: head/sys/amd64/amd64/support.S
===================================================================
--- head/sys/amd64/amd64/support.S
+++ head/sys/amd64/amd64/support.S
@@ -309,9 +309,9 @@
*/
.macro COPYOUT smap erms
PUSH_FRAME_POINTER
- movq PCPU(CURPCB),%rax
+ movq PCPU(CURPCB),%r9
/* Trap entry clears PSL.AC */
- movq $copyout_fault,PCB_ONFAULT(%rax)
+ movq $copy_fault,PCB_ONFAULT(%r9)
testq %rdx,%rdx /* anything to do? */
jz 2f
@@ -327,7 +327,7 @@
*/
movq %rsi,%rax
addq %rdx,%rax
- jc copyout_fault
+ jc copy_fault
/*
* XXX STOP USING VM_MAXUSER_ADDRESS.
* It is an end address, not a max, so every time it is used correctly it
@@ -336,7 +336,7 @@
*/
movq $VM_MAXUSER_ADDRESS,%rcx
cmpq %rcx,%rax
- ja copyout_fault
+ ja copy_fault
xchgq %rdi,%rsi
/* bcopy(%rsi, %rdi, %rdx) */
@@ -344,21 +344,27 @@
SMAP_DISABLE \smap
.if \erms == 0
+ cmpq $15,%rcx
+ jbe 1f
shrq $3,%rcx
rep
movsq
movb %dl,%cl
andb $7,%cl
- je 1f
+ jne 1f
+ SMAP_ENABLE \smap
+ xorl %eax,%eax
+ movq %rax,PCB_ONFAULT(%r9)
+ POP_FRAME_POINTER
+ ret
.endif
+1:
rep
movsb
-1:
SMAP_ENABLE \smap
2:
xorl %eax,%eax
- movq PCPU(CURPCB),%rdx
- movq %rax,PCB_ONFAULT(%rdx)
+ movq %rax,PCB_ONFAULT(%r9)
POP_FRAME_POINTER
ret
.endmacro
@@ -379,22 +385,14 @@
COPYOUT smap=1 erms=1
END(copyout_smap_erms)
- ALIGN_TEXT
-copyout_fault:
- movq PCPU(CURPCB),%rdx
- movq $0,PCB_ONFAULT(%rdx)
- movq $EFAULT,%rax
- POP_FRAME_POINTER
- ret
-
/*
* copyin(from_user, to_kernel, len)
* %rdi, %rsi, %rdx
*/
.macro COPYIN smap erms
PUSH_FRAME_POINTER
- movq PCPU(CURPCB),%rax
- movq $copyin_fault,PCB_ONFAULT(%rax)
+ movq PCPU(CURPCB),%r9
+ movq $copy_fault,PCB_ONFAULT(%r9)
testq %rdx,%rdx /* anything to do? */
jz 2f
@@ -403,10 +401,10 @@
*/
movq %rdi,%rax
addq %rdx,%rax
- jc copyin_fault
+ jc copy_fault
movq $VM_MAXUSER_ADDRESS,%rcx
cmpq %rcx,%rax
- ja copyin_fault
+ ja copy_fault
xchgq %rdi,%rsi
movq %rdx,%rcx
@@ -414,22 +412,28 @@
SMAP_DISABLE \smap
.if \erms == 0
+ cmpq $15,%rcx
+ jbe 1f
shrq $3,%rcx /* copy longword-wise */
rep
movsq
movb %al,%cl
andb $7,%cl /* copy remaining bytes */
- je 1f
+ jne 1f
+ SMAP_ENABLE \smap
+ xorl %eax,%eax
+ movq %rax,PCB_ONFAULT(%r9)
+ POP_FRAME_POINTER
+ ret
.endif
+1:
rep
movsb
-1:
SMAP_ENABLE \smap
2:
xorl %eax,%eax
- movq PCPU(CURPCB),%rdx
- movq %rax,PCB_ONFAULT(%rdx)
+ movq %rax,PCB_ONFAULT(%r9)
POP_FRAME_POINTER
ret
.endmacro
@@ -451,10 +455,10 @@
END(copyin_smap_erms)
ALIGN_TEXT
-copyin_fault:
+copy_fault:
movq PCPU(CURPCB),%rdx
movq $0,PCB_ONFAULT(%rdx)
- movq $EFAULT,%rax
+ movl $EFAULT,%eax
POP_FRAME_POINTER
ret
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 12, 5:38 PM (14 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40689707
Default Alt Text
D17265.diff (2 KB)
Attached To
Mode
D17265: amd64: even up copyin/copyout with memcpy + other cleanup
Attached
Detach File
Event Timeline
Log In to Comment