about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/dl-trampoline.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc64/dl-trampoline.S')
-rw-r--r--sysdeps/powerpc/powerpc64/dl-trampoline.S131
1 files changed, 89 insertions, 42 deletions
diff --git a/sysdeps/powerpc/powerpc64/dl-trampoline.S b/sysdeps/powerpc/powerpc64/dl-trampoline.S
index 18c8a3aa01..69ce523e90 100644
--- a/sysdeps/powerpc/powerpc64/dl-trampoline.S
+++ b/sysdeps/powerpc/powerpc64/dl-trampoline.S
@@ -50,11 +50,8 @@ EALIGN(_dl_runtime_resolve, 4, 0)
 /* Store the LR in the LR Save area.  */
 	std	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
 	cfi_offset (lr, FRAME_LR_SAVE)
-	mfcr	r0
 	std	r9,INT_PARMS+48(r1)
 	std	r10,INT_PARMS+56(r1)
-/* I'm almost certain we don't have to save cr...  be safe.  */
-	std	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
 	bl	JUMPTARGET(_dl_fixup)
 #ifndef SHARED
 	nop
@@ -66,11 +63,9 @@ EALIGN(_dl_runtime_resolve, 4, 0)
 	ld	r8,INT_PARMS+40(r1)
 	ld	r7,INT_PARMS+32(r1)
 	mtlr	r0
-	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
 	ld	r6,INT_PARMS+24(r1)
 	ld	r5,INT_PARMS+16(r1)
 	ld	r4,INT_PARMS+8(r1)
-	mtcrf	0xFF,r0
 /* Prepare for calling the function returned by fixup.  */
 	PPC64_LOAD_FUNCPTR r3
 	ld	r3,INT_PARMS+0(r1)
@@ -85,18 +80,30 @@ END(_dl_runtime_resolve)
 #undef FRAME_SIZE
 #undef INT_PARMS
 
-	/* Stack layout:
-	   (Note: some of these are not required for the ELFv2 ABI.)
-	  +592   previous backchain
-	  +584   spill_r31
-	  +576   spill_r30
-	  +560   v1
-	  +552   fp4
-	  +544   fp3
-	  +536   fp2
-	  +528   fp1
-	  +520   r4
-	  +512   r3
+	/* Stack layout:		ELFv2 ABI.
+					+752   previous backchain
+					+744   spill_r31
+					+736   spill_r30
+					+720   v8
+					+704   v7
+					+688   v6
+					+672   v5
+					+656   v4
+					+640   v3
+					+624   v2
+					+608   v1
+					+600   fp10
+	  ELFv1 ABI			+592   fp9
+	  +592   previous backchain	+584   fp8
+	  +584   spill_r31		+576   fp7
+	  +576   spill_r30		+568   fp6
+	  +560   v1			+560   fp5
+	  +552   fp4			+552   fp4
+	  +544   fp3			+544   fp3
+	  +536   fp2			+536   fp2
+	  +528   fp1			+528   fp1
+	  +520   r4			+520   r4
+	  +512   r3			+512   r3
 	   return values
           +504   free
 	  +496   stackframe
@@ -157,10 +164,15 @@ END(_dl_runtime_resolve)
 	  +8     CR save area
 	r1+0     stack back chain
 	*/
-#define FRAME_SIZE 592
+#if _CALL_ELF == 2
+# define FRAME_SIZE 752
+# define VR_RTN 608
+#else
+# define FRAME_SIZE 592
+# define VR_RTN 560
+#endif
 #define INT_RTN 512
 #define FPR_RTN 528
-#define VR_RTN 560
 #define STACK_FRAME 496
 #define CALLING_LR 488
 #define CALLING_SP 480
@@ -205,18 +217,14 @@ EALIGN(_dl_profile_resolve, 4, 0)
 	mflr	r5
 	std	r7,INT_PARMS+32(r1)
 	std	r8,INT_PARMS+40(r1)
-/* Store the LR in the LR Save area of the previous frame.  */
-/* XXX Do we have to do this?  */
+/* Store the LR in the LR Save area.  */
 	la	r8,FRAME_SIZE(r1)
 	std	r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
 	cfi_offset (lr, FRAME_LR_SAVE)
 	std	r5,CALLING_LR(r1)
-	mfcr	r0
 	std	r9,INT_PARMS+48(r1)
 	std	r10,INT_PARMS+56(r1)
 	std	r8,CALLING_SP(r1)
-/* I'm almost certain we don't have to save cr...  be safe.  */
-	std	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
 	ld	r12,.LC__dl_hwcap@toc(r2)
 #ifdef SHARED
 	/* Load _rtld_local_ro._dl_hwcap.  */
@@ -319,11 +327,9 @@ L(restoreFXR):
 	ld	r8,INT_PARMS+40(r1)
 	ld	r7,INT_PARMS+32(r1)
 	mtlr	r0
-	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
 	ld	r6,INT_PARMS+24(r1)
 	ld	r5,INT_PARMS+16(r1)
 	ld	r4,INT_PARMS+8(r1)
-	mtcrf	0xFF,r0
 /* Prepare for calling the function returned by fixup.  */
 	PPC64_LOAD_FUNCPTR r3
 	ld	r3,INT_PARMS+0(r1)
@@ -346,10 +352,11 @@ L(restoreFXR):
 	lfd	fp12,FPR_PARMS+88(r1)
 	lfd	fp13,FPR_PARMS+96(r1)
 /* Unwind the stack frame, and jump.  */
-	ld	r31,584(r1)
-	ld	r30,576(r1)
+	ld	r31,FRAME_SIZE-8(r1)
+	ld	r30,FRAME_SIZE-16(r1)
 	addi	r1,r1,FRAME_SIZE
 	bctr
+
 L(do_pltexit):
 	la	r10,(VR_PARMS+0)(r1)
 	la	r9,(VR_PARMS+16)(r1)
@@ -383,11 +390,9 @@ L(restoreFXR2):
 	ld	r8,INT_PARMS+40(r1)
 	ld	r7,INT_PARMS+32(r1)
 	mtlr	r0
-	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
 	ld	r6,INT_PARMS+24(r1)
 	ld	r5,INT_PARMS+16(r1)
 	ld	r4,INT_PARMS+8(r1)
-	mtcrf	0xFF,r0
 /* Prepare for calling the function returned by fixup.  */
 	std	r2,FRAME_TOC_SAVE(r1)
 	PPC64_LOAD_FUNCPTR r3
@@ -413,16 +418,37 @@ L(restoreFXR2):
 /* But return here and store the return values.  */
 	std	r3,INT_RTN(r1)
 	std	r4,INT_RTN+8(r1)
-	stfd	fp1,FPR_PARMS+0(r1)
-	stfd	fp2,FPR_PARMS+8(r1)
+	stfd	fp1,FPR_RTN+0(r1)
+	stfd	fp2,FPR_RTN+8(r1)
 	cmpdi	cr0,r12,0
 	la	r10,VR_RTN(r1)
-	stfd	fp3,FPR_PARMS+16(r1)
-	stfd	fp4,FPR_PARMS+24(r1)
+	stfd	fp3,FPR_RTN+16(r1)
+	stfd	fp4,FPR_RTN+24(r1)
+#if _CALL_ELF == 2
+	la	r12,VR_RTN+16(r1)
+	stfd	fp5,FPR_RTN+32(r1)
+	stfd	fp6,FPR_RTN+40(r1)
+	li	r5,32
+	li	r6,64
+	stfd	fp7,FPR_RTN+48(r1)
+	stfd	fp8,FPR_RTN+56(r1)
+	stfd	fp9,FPR_RTN+64(r1)
+	stfd	fp10,FPR_RTN+72(r1)
+#endif
 	mr	r3,r31
 	mr	r4,r30
 	beq	L(callpltexit)
 	stvx	v2,0,r10
+#if _CALL_ELF == 2
+	stvx	v3,0,r12
+	stvx	v4,r5,r10
+	stvx	v5,r5,r12
+	addi	r5,r5,64
+	stvx	v6,r6,r10
+	stvx	v7,r6,r12
+	stvx	v8,r5,r10
+	stvx	v9,r5,r12
+#endif
 L(callpltexit):
 	addi	r5,r1,INT_PARMS
 	addi	r6,r1,INT_RTN
@@ -434,18 +460,39 @@ L(callpltexit):
 	lwz	r12,VR_VRSAVE(r1)
 	ld	r3,INT_RTN(r1)
 	ld	r4,INT_RTN+8(r1)
-	lfd	fp1,FPR_PARMS+0(r1)
-	lfd	fp2,FPR_PARMS+8(r1)
+	lfd	fp1,FPR_RTN+0(r1)
+	lfd	fp2,FPR_RTN+8(r1)
 	cmpdi	cr0,r12,0
-	la	r10,VR_RTN(r1)
-	lfd	fp3,FPR_PARMS+16(r1)
-	lfd	fp4,FPR_PARMS+24(r1)
+	la	r11,VR_RTN(r1)
+	lfd	fp3,FPR_RTN+16(r1)
+	lfd	fp4,FPR_RTN+24(r1)
+#if _CALL_ELF == 2
+	la	r12,VR_RTN+16(r1)
+	lfd	fp5,FPR_RTN+32(r1)
+	lfd	fp6,FPR_RTN+40(r1)
+	li	r30,32
+	li	r31,64
+	lfd	fp7,FPR_RTN+48(r1)
+	lfd	fp8,FPR_RTN+56(r1)
+	lfd	fp9,FPR_RTN+64(r1)
+	lfd	fp10,FPR_RTN+72(r1)
+#endif
 	beq	L(pltexitreturn)
-	lvx	v2,0,r10
+	lvx	v2,0,r11
+#if _CALL_ELF == 2
+	lvx	v3,0,r12
+	lvx	v4,r30,r11
+	lvx	v5,r30,r12
+	addi	r30,r30,64
+	lvx	v6,r31,r11
+	lvx	v7,r31,r12
+	lvx	v8,r30,r11
+	lvx	v9,r30,r12
+#endif
 L(pltexitreturn):
 	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
-	ld	r31,584(r1)
-	ld	r30,576(r1)
+	ld	r31,FRAME_SIZE-8(r1)
+	ld	r30,FRAME_SIZE-16(r1)
 	mtlr	r0
 	ld	r1,0(r1)
 	blr