Page MenuHomeFreeBSD

D61981.1795611087.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61981.1795611087.diff

diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -116,11 +116,11 @@
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
- jne 80f
+ jne 90f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
- jne 10081608f
+ jne 90f
POP_FRAME_POINTER
ret
ALIGN_TEXT
@@ -128,11 +128,11 @@
movl (%rdi),%r8d
movl (%rsi),%r9d
cmpl %r8d,%r9d
- jne 80f
+ jne 90f
movl -4(%rdi,%rdx),%r8d
movl -4(%rsi,%rdx),%r9d
cmpl %r8d,%r9d
- jne 10040804f
+ jne 90f
POP_FRAME_POINTER
ret
ALIGN_TEXT
@@ -140,11 +140,11 @@
movzwl (%rdi),%r8d
movzwl (%rsi),%r9d
cmpl %r8d,%r9d
- jne 1f
+ jne 90f
movzwl -2(%rdi,%rdx),%r8d
movzwl -2(%rsi,%rdx),%r9d
cmpl %r8d,%r9d
- jne 1f
+ jne 90f
POP_FRAME_POINTER
ret
ALIGN_TEXT
@@ -154,19 +154,19 @@
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
- jne 80f
+ jne 90f
movq 8(%rdi),%r8
movq 8(%rsi),%r9
cmpq %r8,%r9
- jne 10163208f
+ jne 90f
movq -16(%rdi,%rdx),%r8
movq -16(%rsi,%rdx),%r9
cmpq %r8,%r9
- jne 10163216f
+ jne 90f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
- jne 10163224f
+ jne 90f
POP_FRAME_POINTER
ret
ALIGN_TEXT
@@ -196,9 +196,9 @@
ret
/*
- * Mismatch was found.
- *
- * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes).
+ * Mismatch was found in a 16 byte block, the sub/or above destroyed
+ * the loaded values. Load the two quads again (all within the block,
+ * which is within the buffers) and compute the result from them.
*/
ALIGN_TEXT
10320016:
@@ -208,64 +208,28 @@
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
- jne 80f
- leaq 8(%rdi),%rdi
- leaq 8(%rsi),%rsi
- jmp 80f
- ALIGN_TEXT
-10081608:
-10163224:
- leaq -8(%rdi,%rdx),%rdi
- leaq -8(%rsi,%rdx),%rsi
- jmp 80f
- ALIGN_TEXT
-10163216:
- leaq -16(%rdi,%rdx),%rdi
- leaq -16(%rsi,%rdx),%rsi
- jmp 80f
- ALIGN_TEXT
-10163208:
- leaq 8(%rdi),%rdi
- leaq 8(%rsi),%rsi
- jmp 80f
- ALIGN_TEXT
-10040804:
- leaq -4(%rdi,%rdx),%rdi
- leaq -4(%rsi,%rdx),%rsi
- jmp 1f
-
- ALIGN_TEXT
-80:
- movl (%rdi),%r8d
- movl (%rsi),%r9d
- cmpl %r8d,%r9d
- jne 1f
- leaq 4(%rdi),%rdi
- leaq 4(%rsi),%rsi
+ jne 90f
+ movq 8(%rdi),%r8
+ movq 8(%rsi),%r9
/*
- * We have up to 4 bytes to inspect.
+ * %r8 and %r9 hold the (zero-extended, little-endian) words from b1 and
+ * b2. All bytes preceding them have compared equal; the first differing
+ * byte is the lowest one set in %r8 ^ %r9. If the words are equal
+ * (the buffers changed under us), report equality.
*/
-1:
- movzbl (%rdi),%eax
- movzbl (%rsi),%r8d
- cmpb %r8b,%al
- jne 2f
-
- movzbl 1(%rdi),%eax
- movzbl 1(%rsi),%r8d
- cmpb %r8b,%al
- jne 2f
-
- movzbl 2(%rdi),%eax
- movzbl 2(%rsi),%r8d
- cmpb %r8b,%al
- jne 2f
-
- movzbl 3(%rdi),%eax
- movzbl 3(%rsi),%r8d
-2:
+90:
+ movq %r8,%rcx
+ xorq %r9,%rcx
+ jz 91f
+ bsfq %rcx,%rcx
+ andl $0x38,%ecx
+ shrq %cl,%r8
+ shrq %cl,%r9
+ movzbl %r8b,%eax
+ movzbl %r9b,%r8d
subl %r8d,%eax
+91:
POP_FRAME_POINTER
ret
END(memcmp)

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 25, 12:51 PM (16 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41990139
Default Alt Text
D61981.1795611087.diff (2 KB)

Event Timeline