summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/strchr.S
diff options
context:
space:
mode:
authorLiubov Dmitrieva <ldmitrie@sourceware.org>2013-08-30 18:37:28 +0400
committerLiubov Dmitrieva <ldmitrie@sourceware.org>2013-10-23 23:51:44 +0400
commit029183a4ca3f765f63e7b64bc260622f02b04539 (patch)
treec7f6912d9575e27f691f219ad9437e9af39e016e /sysdeps/x86_64/strchr.S
parent01d5454d13d2c21b9a08b28441d37a7ddce089a6 (diff)
downloadglibc-029183a4ca3f765f63e7b64bc260622f02b04539.tar.gz
Implemented bound check support for string/memory routines for x86_64.ldmitrie/intel_mpx
TODO: Fix bound check support in strcmp-sse2 and implement in strspn, strstr and strcspn.
Diffstat (limited to 'sysdeps/x86_64/strchr.S')
-rw-r--r--sysdeps/x86_64/strchr.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/sysdeps/x86_64/strchr.S b/sysdeps/x86_64/strchr.S
index d89f1eba8f..8519a81117 100644
--- a/sysdeps/x86_64/strchr.S
+++ b/sysdeps/x86_64/strchr.S
@@ -22,6 +22,10 @@
.text
ENTRY (strchr)
+#ifdef __CHKP__
+ bndcl (%rdi), %bnd0
+ bndcu (%rdi), %bnd0
+#endif
movd %esi, %xmm1
movq %rdi, %rcx
punpcklbw %xmm1, %xmm1
@@ -29,6 +33,9 @@ ENTRY (strchr)
pxor %xmm2, %xmm2
punpcklbw %xmm1, %xmm1
orl $0xffffffff, %esi
+#ifdef __CHKP__
+ bndcu (%rdi), %bnd0
+#endif
movdqa (%rdi), %xmm0
pshufd $0, %xmm1, %xmm1
subq %rdi, %rcx
@@ -44,7 +51,11 @@ ENTRY (strchr)
orl %edx, %ecx
jnz 1f
-2: movdqa (%rdi), %xmm0
+2:
+#ifdef __CHKP__
+ bndcu (%rdi), %bnd0
+#endif
+ movdqa (%rdi), %xmm0
leaq 16(%rdi), %rdi
movdqa %xmm0, %xmm3
pcmpeqb %xmm1, %xmm0