mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
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>
This commit is contained in:
parent
5313581cb5
commit
750a0e4967
@ -1,3 +1,9 @@
|
||||
2017-10-23 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2017-10-22 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/i386/fpu/e_powf.S: Removed.
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user