about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/strrchr.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/multiarch/strrchr.S
parent01d5454d13d2c21b9a08b28441d37a7ddce089a6 (diff)
downloadglibc-ldmitrie/intel_mpx.tar.gz
glibc-ldmitrie/intel_mpx.tar.xz
glibc-ldmitrie/intel_mpx.zip
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/multiarch/strrchr.S')
-rw-r--r--sysdeps/x86_64/multiarch/strrchr.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/x86_64/multiarch/strrchr.S b/sysdeps/x86_64/multiarch/strrchr.S
index 3f92a41ef9..1fed105bf0 100644
--- a/sysdeps/x86_64/multiarch/strrchr.S
+++ b/sysdeps/x86_64/multiarch/strrchr.S
@@ -97,6 +97,10 @@ __strrchr_sse42:
 	CALL_MCOUNT
 	testb	%sil, %sil
 	je	__strend_sse4
+# ifdef __CHKP__
+	bndcl  (%rdi), %bnd0
+	bndcu  (%rdi), %bnd0
+# endif
 	xor	%eax,%eax	/* RAX has the last occurrence of s.  */
 	movd	%esi, %xmm1
 	punpcklbw	%xmm1, %xmm1
@@ -135,6 +139,9 @@ L(unaligned_no_byte):
 	   contain the NULL terminator.  */
 	jg	L(exit)
 	addq	$16, %r8
+# ifdef __CHKP__
+	bndcu 	(%r8), %bnd0
+# endif
 
 /* Loop start on aligned string.  */
 	.p2align 4
@@ -142,6 +149,9 @@ L(loop):
 	pcmpistri	$0x4a, (%r8), %xmm1
 	jbe	L(match_or_eos)
 	addq	$16, %r8
+# ifdef __CHKP__
+	bndcu 	(%r8), %bnd0
+# endif
 	jmp	L(loop)
 	.p2align 4
 L(match_or_eos):
@@ -149,11 +159,17 @@ L(match_or_eos):
 L(match_no_eos):
 	leaq	(%r8,%rcx), %rax
 	addq	$16, %r8
+# ifdef __CHKP__
+	bndcu 	(%r8), %bnd0
+# endif
 	jmp     L(loop)
 	.p2align 4
 L(had_eos):
 	jnc     L(exit)
 	leaq	(%r8,%rcx), %rax
+# ifdef __CHKP__
+	bndcu  	(%rax), %bnd0
+# endif
 	.p2align 4
 L(exit):
 	ret