x86, x86_64: Add __memcpy_chk assembly versions.
Implement __memcpy_chk() in assembly for x86 and x86_64 and remove the
conditionally-compiled C fallback now that all supported architectures
have an external implementation.
Bug: 389669171
Test: mma
Test: ./tests/run-on-host.sh 32 --gtest_filter='*memcpy*'
Test: ./tests/run-on-host.sh 64 --gtest_filter='*memcpy*'
Change-Id: I755fdd348f2f380e7c40bc57dc1f4d36d791b1c0
diff --git a/libc/arch-x86/string/sse2-memmove-slm.S b/libc/arch-x86/string/sse2-memmove-slm.S
index 2ed4e7b..a25b4c7 100644
--- a/libc/arch-x86/string/sse2-memmove-slm.S
+++ b/libc/arch-x86/string/sse2-memmove-slm.S
@@ -96,6 +96,13 @@
#define SETUP_PIC_REG(x) call __x86.get_pc_thunk.x
.section .text.sse2,"ax",@progbits
+ENTRY (__memcpy_chk)
+/* NOTE: We can't use LEN here because ebx has not been pushed yet. */
+ movl 12(%esp), %ecx
+ cmpl 16(%esp), %ecx
+ ja __memcpy_chk_fail
+/* Fall through to memcpy/memmove. */
+END (__memcpy_chk)
ENTRY (MEMMOVE)
ENTRANCE
movl LEN(%esp), %ecx