about summary refs log tree commit diff
path: root/sysdeps/x86_64/memset.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/memset.S')
-rw-r--r--sysdeps/x86_64/memset.S30
1 files changed, 30 insertions, 0 deletions
diff --git a/sysdeps/x86_64/memset.S b/sysdeps/x86_64/memset.S
index 6c69f4b442..ccb2aae480 100644
--- a/sysdeps/x86_64/memset.S
+++ b/sysdeps/x86_64/memset.S
@@ -26,6 +26,15 @@
 	.text
 #if !defined NOT_IN_libc
 ENTRY(__bzero)
+	testq	%rsi, %rsi
+	jz	L(only_return)
+
+#if defined __CHKP__ && defined __CHKWR__
+	bndcl	(%rdi), %bnd0
+	bndcu	-1(%rdi, %rsi), %bnd0
+# endif
+
+	mov	%rdi, %rax
 	movq	%rdi, %rax /* Set return value.  */
 	movq	%rsi, %rdx /* Set n.  */
 	pxor	%xmm8, %xmm8
@@ -53,7 +62,20 @@ ENTRY_CHK (__memset_chk)
 END_CHK (__memset_chk)
 #endif
 
+#if defined __CHKP__ && defined __CHKWR__
+ENTRY (chkp_memset_nochk)
+	jmp	L(entry_from_chkp_memset_nochk)
+END (chkp_memset_nochk)
+#endif
+
 ENTRY (memset)
+	testq	%rdx, %rdx
+	jz	L(only_return)
+#if defined __CHKP__ && defined __CHKWR__
+	bndcl	(%rdi), %bnd0
+	bndcu	-1(%rdi, %rdx), %bnd0
+L(entry_from_chkp_memset_nochk):
+#endif
 	movd	%esi, %xmm8
 	movq	%rdi, %rax
 	punpcklbw	%xmm8, %xmm8
@@ -71,6 +93,9 @@ L(entry_from_bzero):
 L(return):
 	rep
 	ret
+L(only_return):
+	movq	%rdi, %rax
+	ret
 	ALIGN (4)
 L(between_32_64_bytes):
 	movdqu	%xmm8, 16(%rdi)
@@ -129,6 +154,11 @@ L(between8_16bytes):
 END (memset)
 libc_hidden_builtin_def (memset)
 
+#if defined __CHKP__ && defined __CHKWR__
+weak_alias (memset, chkp_memset_nobnd)
+weak_alias (chkp_memset_nochk, chkp_memset_nobnd_nochk)
+#endif
+
 #if defined PIC && !defined NOT_IN_libc && !defined USE_MULTIARCH
 strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
 	.section .gnu.warning.__memset_zero_constant_len_parameter