PowerPC64 FRAME_PARM_SAVE

I think FRAME_PARM[1-9]_SAVE confuse the code, particularly
FRAME_PARM9_SAVE.  There are only 8 parameter save slots!

	* sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN,
	FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional.
	(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
	FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
	FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace
	uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
This commit is contained in:
Alan Modra 2017-06-14 10:43:33 +09:30
parent dd8854361b
commit fb499eb04e
3 changed files with 26 additions and 37 deletions

View File

@ -1,3 +1,13 @@
2017-06-14 Alan Modra <amodra@gmail.com>
* sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN,
FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional.
(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace
uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
2017-06-14 Alan Modra <amodra@gmail.com> 2017-06-14 Alan Modra <amodra@gmail.com>
* sysdeps/powerpc/powerpc64/sysdep.h: (call_mcount_parm_offset): Delete. * sysdeps/powerpc/powerpc64/sysdep.h: (call_mcount_parm_offset): Delete.

View File

@ -21,40 +21,19 @@
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
/* Stack frame offsets. */ /* Stack frame offsets. */
#define FRAME_BACKCHAIN 0
#define FRAME_CR_SAVE 8
#define FRAME_LR_SAVE 16
#if _CALL_ELF != 2 #if _CALL_ELF != 2
#define FRAME_MIN_SIZE 112 #define FRAME_MIN_SIZE 112
#define FRAME_MIN_SIZE_PARM 112 #define FRAME_MIN_SIZE_PARM 112
#define FRAME_BACKCHAIN 0
#define FRAME_CR_SAVE 8
#define FRAME_LR_SAVE 16
#define FRAME_TOC_SAVE 40 #define FRAME_TOC_SAVE 40
#define FRAME_PARM_SAVE 48 #define FRAME_PARM_SAVE 48
#define FRAME_PARM1_SAVE 48
#define FRAME_PARM2_SAVE 56
#define FRAME_PARM3_SAVE 64
#define FRAME_PARM4_SAVE 72
#define FRAME_PARM5_SAVE 80
#define FRAME_PARM6_SAVE 88
#define FRAME_PARM7_SAVE 96
#define FRAME_PARM8_SAVE 104
#define FRAME_PARM9_SAVE 112
#else #else
#define FRAME_MIN_SIZE 32 #define FRAME_MIN_SIZE 32
#define FRAME_MIN_SIZE_PARM 96 #define FRAME_MIN_SIZE_PARM 96
#define FRAME_BACKCHAIN 0
#define FRAME_CR_SAVE 8
#define FRAME_LR_SAVE 16
#define FRAME_TOC_SAVE 24 #define FRAME_TOC_SAVE 24
#define FRAME_PARM_SAVE 32 #define FRAME_PARM_SAVE 32
#define FRAME_PARM1_SAVE 32
#define FRAME_PARM2_SAVE 40
#define FRAME_PARM3_SAVE 48
#define FRAME_PARM4_SAVE 56
#define FRAME_PARM5_SAVE 64
#define FRAME_PARM6_SAVE 72
#define FRAME_PARM7_SAVE 80
#define FRAME_PARM8_SAVE 88
#define FRAME_PARM9_SAVE 96
#endif #endif
/* Support macros for CALL_MCOUNT. */ /* Support macros for CALL_MCOUNT. */

View File

@ -26,17 +26,17 @@
ENTRY (__makecontext) ENTRY (__makecontext)
CALL_MCOUNT 3 CALL_MCOUNT 3
/* Save parameters into the parameter save area of callers frame. */ /* Save parameters into the parameter save area of callers frame. */
std r3,FRAME_PARM1_SAVE(r1) /* ucontext_t *ucp */ std r3,FRAME_PARM_SAVE+0(r1) /* ucontext_t *ucp */
std r4,FRAME_PARM2_SAVE(r1) /* void (*func)(void) */ std r4,FRAME_PARM_SAVE+8(r1) /* void (*func)(void) */
std r5,FRAME_PARM3_SAVE(r1) /* int argc */ std r5,FRAME_PARM_SAVE+16(r1) /* int argc */
std r6,FRAME_PARM4_SAVE(r1) /* ... */ std r6,FRAME_PARM_SAVE+24(r1) /* ... */
std r7,FRAME_PARM5_SAVE(r1) std r7,FRAME_PARM_SAVE+32(r1)
std r8,FRAME_PARM6_SAVE(r1) std r8,FRAME_PARM_SAVE+40(r1)
std r9,FRAME_PARM7_SAVE(r1) std r9,FRAME_PARM_SAVE+48(r1)
std r10,FRAME_PARM8_SAVE(r1) std r10,FRAME_PARM_SAVE+56(r1)
mflr r0 mflr r0
/* Get the address of the target functions first parameter. */ /* Get the address of the target functions first parameter. */
addi r6,r1,FRAME_PARM4_SAVE addi r6,r1,FRAME_PARM_SAVE+24
std r0,FRAME_LR_SAVE(r1) std r0,FRAME_LR_SAVE(r1)
cfi_offset (lr, FRAME_LR_SAVE) cfi_offset (lr, FRAME_LR_SAVE)
stdu r1,-128(r1) stdu r1,-128(r1)
@ -55,7 +55,7 @@ ENTRY(__makecontext)
clrrdi r7,r7,4 clrrdi r7,r7,4
li r0,0 li r0,0
stdu r0,-64(r7) stdu r0,-64(r7)
std r3,FRAME_PARM1_SAVE(r7) /* Store context in dummy parm1. */ std r3,FRAME_PARM_SAVE(r7) /* Store context in dummy parm1. */
mflr r0 mflr r0
std r2,FRAME_TOC_SAVE(r7) /* Store the TOC pointer for later. */ std r2,FRAME_TOC_SAVE(r7) /* Store the TOC pointer for later. */
std r0,FRAME_LR_SAVE(r7) std r0,FRAME_LR_SAVE(r7)
@ -102,7 +102,7 @@ L(parmloop2):
addi r0,r5,-8 addi r0,r5,-8
ble cr1,L(noparms) ble cr1,L(noparms)
mtctr r0 mtctr r0
addi r9,r8,FRAME_PARM9_SAVE-8 addi r9,r8,FRAME_PARM_SAVE+64-8
L(parmloop): L(parmloop):
ldu r0,8(r7) ldu r0,8(r7)
stdu r0,8(r9) stdu r0,8(r9)
@ -148,7 +148,7 @@ L(noparms):
L(exitcode): L(exitcode):
/* Recover the ucontext and TOC from the dummy frame. */ /* Recover the ucontext and TOC from the dummy frame. */
ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */ ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */
ld r3,FRAME_PARM1_SAVE(r1) ld r3,FRAME_PARM_SAVE(r1)
ld r2,FRAME_TOC_SAVE(r1) ld r2,FRAME_TOC_SAVE(r1)
ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */ ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */
cmpdi r3,0 cmpdi r3,0