about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-10-23 07:43:32 +1030
committerAlan Modra <amodra@gmail.com>2017-10-23 07:46:07 +1030
commit750a0e4967375d0b2bedb77af515b8bc6966e6f6 (patch)
tree9139c510decfa4f304f8ffd63c3f433f2122f179 /sysdeps/powerpc/powerpc64
parent5313581cb52fd5d3d2cf222ddb6f8f86f090974f (diff)
downloadglibc-750a0e4967375d0b2bedb77af515b8bc6966e6f6.tar.gz
glibc-750a0e4967375d0b2bedb77af515b8bc6966e6f6.tar.xz
glibc-750a0e4967375d0b2bedb77af515b8bc6966e6f6.zip
PowerPC64 power7 strncpy stack handling and cfi
This patch moves the frame setup and teardown to immediately around
the single memset call, as has been done for power8.  I've also
decreased FRAMESIZE to that needed to save the two callee-saved
registers used.  Plus added cfi.

	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Decrease FRAMESIZE.
	Move LR save and frame setup/teardown and LR restore to
	immediately around memset call.  Provide cfi.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/powerpc64')
-rw-r--r--sysdeps/powerpc/powerpc64/power7/strncpy.S23
1 files changed, 13 insertions, 10 deletions
diff --git a/sysdeps/powerpc/powerpc64/power7/strncpy.S b/sysdeps/powerpc/powerpc64/power7/strncpy.S
index b2833b8a50..0ae65a0fc5 100644
--- a/sysdeps/powerpc/powerpc64/power7/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/strncpy.S
@@ -53,7 +53,7 @@
 # endif
 #endif  /* !USE_AS_STPNCPY  */
 
-#define		FRAMESIZE	(FRAME_MIN_SIZE+32)
+#define		FRAMESIZE	(FRAME_MIN_SIZE+16)
 
 #ifndef MEMSET
 /* For builds with no IFUNC support, local calls should be made to internal
@@ -74,14 +74,13 @@ ENTRY (FUNC_NAME, 4)
 #endif
 	CALL_MCOUNT 3
 
-	mflr r0			/* load link register LR to r0  */
 	or r10, r3, r4		/* to verify source and destination  */
 	rldicl. r8, r10, 0, 61	/* is double word aligned .. ?  */
 
 	std r19, -8(r1)		/* save callers register , r19  */
 	std r18, -16(r1)	/* save callers register , r18  */
-	std r0, 16(r1)		/* store the link register  */
-	stdu r1, -FRAMESIZE(r1)	/* create the stack frame  */
+	cfi_offset(r19, -8)
+	cfi_offset(r18, -16)
 
 	mr r9, r3		/* save r3 into r9 for use  */
 	mr r18, r3		/* save r3 for retCode of strncpy  */
@@ -224,6 +223,11 @@ L(zeroFill):
 	cmpdi cr7, r8, 0	/* compare if length is zero  */
 	beq cr7, L(update3return)
 
+	mflr r0			/* load link register LR to r0  */
+	std r0, 16(r1)		/* store the link register  */
+	stdu r1, -FRAMESIZE(r1)	/* create the stack frame  */
+	cfi_adjust_cfa_offset(FRAMESIZE)
+	cfi_offset(lr, 16)
 	mr r3, r19		/* fill buffer with  */
 	li r4, 0		/* zero fill buffer  */
 	mr r5, r8		/* how many bytes to fill buffer with  */
@@ -231,6 +235,11 @@ L(zeroFill):
 #ifndef MEMSET_is_local
 	nop
 #endif
+	ld r0, FRAMESIZE+16(r1) /* read the saved link register  */
+	addi r1, r1, FRAMESIZE	/* restore stack pointer  */
+	cfi_adjust_cfa_offset(-FRAMESIZE)
+	mtlr r0
+	cfi_restore(lr)
 
 L(update3return):
 #ifdef USE_AS_STPNCPY
@@ -241,11 +250,8 @@ L(hop2return):
 #ifndef USE_AS_STPNCPY
 	mr r3, r18		/* set return value  */
 #endif
-	addi r1, r1, FRAMESIZE	/* restore stack pointer  */
-	ld r0, 16(r1)		/* read the saved link register  */
 	ld r18, -16(r1)		/* restore callers save register, r18  */
 	ld r19, -8(r1)		/* restore callers save register, r19  */
-	mtlr r0			/* branch to link register  */
 	blr			/* return  */
 
 	.p2align 4
@@ -279,16 +285,13 @@ L(oneBYone):
 
 	.p2align 4
 L(done):
-	addi r1, r1, FRAMESIZE	/* restore stack pointer  */
 #ifdef USE_AS_STPNCPY
 	mr r3, r19		/* set the return value  */
 #else
 	mr r3, r18		/* set the return value  */
 #endif
-	ld r0, 16(r1)		/* read the saved link register  */
 	ld r18, -16(r1)		/* restore callers save register, r18  */
 	ld r19, -8(r1)		/* restore callers save register, r19  */
-	mtlr r0			/* branch to link register  */
 	blr			/* return  */
 
 L(update1):