ce426f
# commit 8b8a692cfd7d80f1ee7c8b9ab356a259367dd187
ce426f
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
ce426f
# Date:   Wed Dec 4 06:55:03 2013 -0600
ce426f
# 
ce426f
#     PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
ce426f
#     
ce426f
#     This updates glibc for the changes in the ELFv2 relating to the
ce426f
#     stack frame layout.  These are described in more detail here:
ce426f
#     http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
ce426f
#     http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
ce426f
#     
ce426f
#     Specifically, the "compiler and linker doublewords" were removed,
ce426f
#     which has the effect that the save slot for the TOC register is
ce426f
#     now at offset 24 rather than 40 to the stack pointer.
ce426f
#     
ce426f
#     In addition, a function may now no longer necessarily assume that
ce426f
#     its caller has set up a 64-byte register save area its use.
ce426f
#     
ce426f
#     To address the first change, the patch goes through all assembler
ce426f
#     files and replaces immediate offsets in instructions accessing the
ce426f
#     ABI-defined stack slots by symbolic offsets.  Those already were
ce426f
#     defined in ucontext_i.sym and used in some of the context routines,
ce426f
#     but that doesn't really seem like the right place for those defines.
ce426f
#     
ce426f
#     The patch instead defines those symbolic offsets in sysdeps.h,
ce426f
#     in two variants for the old and new ABI, and uses them systematically
ce426f
#     in all assembler files, not just the context routines.
ce426f
#     
ce426f
#     The second change only affected a few assembler files that used
ce426f
#     the save area to temporarily store some registers.  In those
ce426f
#     cases where this happens within a leaf function, this patch
ce426f
#     changes the code to store those registers to the "red zone"
ce426f
#     below the stack pointer.  Otherwise, the functions already allocate
ce426f
#     a stack frame, and the patch changes them to add extra space in
ce426f
#     these frames as temporary space for the ELFv2 ABI.
ce426f
# 
ce426f
diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
ce426f
--- glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h	2014-05-29 14:10:00.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -31,6 +31,14 @@
ce426f
 #  define DASHDASHPFX(str) __##str
ce426f
 # endif
ce426f
 
ce426f
+#if _CALL_ELF == 2
ce426f
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16+48)
ce426f
+#define CANCEL_PARM_SAVE (FRAME_MIN_SIZE+16)
ce426f
+#else
ce426f
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16)
ce426f
+#define CANCEL_PARM_SAVE (CANCEL_FRAMESIZE+FRAME_PARM_SAVE)
ce426f
+#endif
ce426f
+
ce426f
 # undef PSEUDO
ce426f
 # define PSEUDO(name, syscall_name, args)				\
ce426f
   .section ".text";							\
ce426f
@@ -44,52 +52,52 @@
ce426f
     PSEUDO_RET;								\
ce426f
   .size DASHDASHPFX(syscall_name##_nocancel),.-DASHDASHPFX(syscall_name##_nocancel);	\
ce426f
   .Lpseudo_cancel:							\
ce426f
-    stdu 1,-128(1);							\
ce426f
-    cfi_adjust_cfa_offset (128);					\
ce426f
+    stdu 1,-CANCEL_FRAMESIZE(1);					\
ce426f
+    cfi_adjust_cfa_offset (CANCEL_FRAMESIZE);				\
ce426f
     mflr 9;								\
ce426f
-    std  9,128+16(1);							\
ce426f
-    cfi_offset (lr, 16);						\
ce426f
+    std  9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1);				\
ce426f
+    cfi_offset (lr, FRAME_LR_SAVE);					\
ce426f
     DOCARGS_##args;	/* save syscall args around CENABLE.  */	\
ce426f
     CENABLE;								\
ce426f
-    std  3,112(1);	/* store CENABLE return value (MASK).  */	\
ce426f
+    std  3,FRAME_MIN_SIZE(1); /* store CENABLE return value (MASK).  */	\
ce426f
     UNDOCARGS_##args;	/* restore syscall args.  */			\
ce426f
     DO_CALL (SYS_ify (syscall_name));					\
ce426f
     mfcr 0;		/* save CR/R3 around CDISABLE.  */		\
ce426f
-    std  3,120(1);							\
ce426f
-    std  0,128+8(1);							\
ce426f
-    cfi_offset (cr, 8);							\
ce426f
-    ld   3,112(1);	/* pass MASK to CDISABLE.  */			\
ce426f
+    std  3,FRAME_MIN_SIZE+8(1);						\
ce426f
+    std  0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1);				\
ce426f
+    cfi_offset (cr, FRAME_CR_SAVE);					\
ce426f
+    ld   3,FRAME_MIN_SIZE(1); /* pass MASK to CDISABLE.  */		\
ce426f
     CDISABLE;								\
ce426f
-    ld   9,128+16(1);							\
ce426f
-    ld   0,128+8(1);	/* restore CR/R3. */				\
ce426f
-    ld   3,120(1);							\
ce426f
+    ld   9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1);				\
ce426f
+    ld   0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1); /* restore CR/R3. */	\
ce426f
+    ld   3,FRAME_MIN_SIZE+8(1);						\
ce426f
     mtlr 9;								\
ce426f
     mtcr 0;								\
ce426f
-    addi 1,1,128;							\
ce426f
-    cfi_adjust_cfa_offset (-128);					\
ce426f
+    addi 1,1,CANCEL_FRAMESIZE;						\
ce426f
+    cfi_adjust_cfa_offset (-CANCEL_FRAMESIZE);				\
ce426f
     cfi_restore (lr);							\
ce426f
     cfi_restore (cr)
ce426f
 
ce426f
 # define DOCARGS_0
ce426f
 # define UNDOCARGS_0
ce426f
 
ce426f
-# define DOCARGS_1	std 3,128+48(1); DOCARGS_0
ce426f
-# define UNDOCARGS_1	ld 3,128+48(1); UNDOCARGS_0
ce426f
+# define DOCARGS_1	std 3,CANCEL_PARM_SAVE(1); DOCARGS_0
ce426f
+# define UNDOCARGS_1	ld 3,CANCEL_PARM_SAVE(1); UNDOCARGS_0
ce426f
 
ce426f
-# define DOCARGS_2	std 4,128+56(1); DOCARGS_1
ce426f
-# define UNDOCARGS_2	ld 4,128+56(1); UNDOCARGS_1
ce426f
+# define DOCARGS_2	std 4,CANCEL_PARM_SAVE+8(1); DOCARGS_1
ce426f
+# define UNDOCARGS_2	ld 4,CANCEL_PARM_SAVE+8(1); UNDOCARGS_1
ce426f
 
ce426f
-# define DOCARGS_3	std 5,128+64(1); DOCARGS_2
ce426f
-# define UNDOCARGS_3	ld 5,128+64(1); UNDOCARGS_2
ce426f
+# define DOCARGS_3	std 5,CANCEL_PARM_SAVE+16(1); DOCARGS_2
ce426f
+# define UNDOCARGS_3	ld 5,CANCEL_PARM_SAVE+16(1); UNDOCARGS_2
ce426f
 
ce426f
-# define DOCARGS_4	std 6,128+72(1); DOCARGS_3
ce426f
-# define UNDOCARGS_4	ld 6,128+72(1); UNDOCARGS_3
ce426f
+# define DOCARGS_4	std 6,CANCEL_PARM_SAVE+24(1); DOCARGS_3
ce426f
+# define UNDOCARGS_4	ld 6,CANCEL_PARM_SAVE+24(1); UNDOCARGS_3
ce426f
 
ce426f
-# define DOCARGS_5	std 7,128+80(1); DOCARGS_4
ce426f
-# define UNDOCARGS_5	ld 7,128+80(1); UNDOCARGS_4
ce426f
+# define DOCARGS_5	std 7,CANCEL_PARM_SAVE+32(1); DOCARGS_4
ce426f
+# define UNDOCARGS_5	ld 7,CANCEL_PARM_SAVE+32(1); UNDOCARGS_4
ce426f
 
ce426f
-# define DOCARGS_6	std 8,128+88(1); DOCARGS_5
ce426f
-# define UNDOCARGS_6	ld 8,128+88(1); UNDOCARGS_5
ce426f
+# define DOCARGS_6	std 8,CANCEL_PARM_SAVE+40(1); DOCARGS_5
ce426f
+# define UNDOCARGS_6	ld 8,CANCEL_PARM_SAVE+40(1); UNDOCARGS_5
ce426f
 
ce426f
 # ifdef IS_IN_libpthread
ce426f
 #  ifdef SHARED
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -133,7 +133,7 @@
ce426f
 	ld r14,((JB_GPRS+0)*8)(r3)
ce426f
 	lfd fp14,((JB_FPRS+0)*8)(r3)
ce426f
 #if defined SHARED && !defined IS_IN_rtld
ce426f
-	std r2,40(r1)	/* Restore the callers TOC save area.  */
ce426f
+	std r2,FRAME_TOC_SAVE(r1)	/* Restore the callers TOC save area.  */
ce426f
 #endif
ce426f
 	ld r15,((JB_GPRS+1)*8)(r3)
ce426f
 	lfd fp15,((JB_FPRS+1)*8)(r3)
ce426f
@@ -151,7 +151,7 @@
ce426f
 	PTR_DEMANGLE2 (r0, r25)
ce426f
 #endif
ce426f
 	mtlr r0
ce426f
-/* 	std r2,40(r1)	Restore the TOC save area.  */
ce426f
+/* 	std r2,FRAME_TOC_SAVE(r1)	Restore the TOC save area.  */
ce426f
 	ld r21,((JB_GPRS+7)*8)(r3)
ce426f
 	lfd fp21,((JB_FPRS+7)*8)(r3)
ce426f
 	ld r22,((JB_GPRS+8)*8)(r3)
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -66,8 +66,8 @@
ce426f
 BODY_LABEL (_init):
ce426f
 	LOCALENTRY(_init)
ce426f
 	mflr 0
ce426f
-	std 0, 16(r1)
ce426f
-	stdu r1, -112(r1)
ce426f
+	std 0, FRAME_LR_SAVE(r1)
ce426f
+	stdu r1, -FRAME_MIN_SIZE_PARM(r1)
ce426f
 #if PREINIT_FUNCTION_WEAK
ce426f
 	addis r9, r2, .LC0@toc@ha
ce426f
 	ld r0, .LC0@toc@l(r9)
ce426f
@@ -84,5 +84,5 @@
ce426f
 BODY_LABEL (_fini):
ce426f
 	LOCALENTRY(_fini)
ce426f
 	mflr 0
ce426f
-	std 0, 16(r1)
ce426f
-	stdu r1, -112(r1)
ce426f
+	std 0, FRAME_LR_SAVE(r1)
ce426f
+	stdu r1, -FRAME_MIN_SIZE_PARM(r1)
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -39,13 +39,13 @@
ce426f
 #include <sysdep.h>
ce426f
 
ce426f
 	.section .init,"ax",@progbits
ce426f
-	addi r1, r1, 112
ce426f
-	ld r0, 16(r1)
ce426f
+	addi r1, r1, FRAME_MIN_SIZE_PARM
ce426f
+	ld r0, FRAME_LR_SAVE(r1)
ce426f
 	mtlr r0
ce426f
 	blr
ce426f
 
ce426f
 	.section .fini,"ax",@progbits
ce426f
-	addi r1, r1, 112
ce426f
-	ld r0, 16(r1)
ce426f
+	addi r1, r1, FRAME_MIN_SIZE_PARM
ce426f
+	ld r0, FRAME_LR_SAVE(r1)
ce426f
 	mtlr r0
ce426f
 	blr
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -26,13 +26,13 @@
ce426f
    parm1 (r3) and the index (r0) need to be converted to an offset
ce426f
    (index * 24) in parm2 (r4).  */
ce426f
 
ce426f
-#define FRAME_SIZE 176
ce426f
+#define FRAME_SIZE (FRAME_MIN_SIZE+64)
ce426f
 /* We need to save the registers used to pass parameters, ie. r3 thru
ce426f
    r10;  Use local var space rather than the parameter save area,
ce426f
    because gcc as of 2010/05 doesn't allocate a proper stack frame for
ce426f
    a function that makes no calls except for __tls_get_addr and we
ce426f
    might be here resolving the __tls_get_addr call.  */
ce426f
-#define INT_PARMS 112
ce426f
+#define INT_PARMS FRAME_MIN_SIZE
ce426f
 EALIGN(_dl_runtime_resolve, 4, 0)
ce426f
 	stdu	r1,-FRAME_SIZE(r1)
ce426f
 	cfi_adjust_cfa_offset (FRAME_SIZE)
ce426f
@@ -48,25 +48,25 @@
ce426f
 	mflr	r0
ce426f
 	std	r8,INT_PARMS+40(r1)
ce426f
 /* Store the LR in the LR Save area.  */
ce426f
-	std	r0,FRAME_SIZE+16(r1)
ce426f
-	cfi_offset (lr, 16)
ce426f
+	std	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
+	cfi_offset (lr, FRAME_LR_SAVE)
ce426f
 	mfcr	r0
ce426f
 	std	r9,INT_PARMS+48(r1)
ce426f
 	std	r10,INT_PARMS+56(r1)
ce426f
 /* I'm almost certain we don't have to save cr...  be safe.  */
ce426f
-	std	r0,FRAME_SIZE+8(r1)
ce426f
+	std	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ce426f
 	bl	JUMPTARGET(_dl_fixup)
ce426f
 #ifndef SHARED
ce426f
 	nop
ce426f
 #endif
ce426f
 /* Put the registers back.  */
ce426f
-	ld	r0,FRAME_SIZE+16(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
 	ld	r10,INT_PARMS+56(r1)
ce426f
 	ld	r9,INT_PARMS+48(r1)
ce426f
 	ld	r8,INT_PARMS+40(r1)
ce426f
 	ld	r7,INT_PARMS+32(r1)
ce426f
 	mtlr	r0
ce426f
-	ld	r0,FRAME_SIZE+8(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ce426f
 	ld	r6,INT_PARMS+24(r1)
ce426f
 	ld	r5,INT_PARMS+16(r1)
ce426f
 	ld	r4,INT_PARMS+8(r1)
ce426f
@@ -76,7 +76,7 @@
ce426f
 	ld	r3,INT_PARMS+0(r1)
ce426f
 #if _CALL_ELF == 2
ce426f
 /* Restore the caller's TOC in case we jump to a local entry point.  */
ce426f
-	ld	r2,FRAME_SIZE+40(r1)
ce426f
+	ld	r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
ce426f
 #endif
ce426f
 /* Unwind the stack frame, and jump.  */
ce426f
 	addi	r1,r1,FRAME_SIZE
ce426f
@@ -86,6 +86,7 @@
ce426f
 #undef INT_PARMS
ce426f
 
ce426f
 	/* Stack layout:
ce426f
+	   (Note: some of these are not required for the ELFv2 ABI.)
ce426f
 	  +592   previous backchain
ce426f
 	  +584   spill_r31
ce426f
 	  +576   spill_r30
ce426f
@@ -147,10 +148,11 @@
ce426f
 	  +64    parm3
ce426f
 	  +56    parm2
ce426f
 	  +48    parm1
ce426f
-	 * Parameter save area, Allocated by the call, at least 8 double words
ce426f
-	  +40    TOC save area
ce426f
-	  +32    Reserved for linker
ce426f
-	  +24    Reserved for compiler
ce426f
+	 * Parameter save area
ce426f
+	 * (v1 ABI: Allocated by the call, at least 8 double words)
ce426f
+	  +40    v1 ABI: TOC save area
ce426f
+	  +32    v1 ABI: Reserved for linker
ce426f
+	  +24    v1 ABI: Reserved for compiler / v2 ABI: TOC save area
ce426f
 	  +16    LR save area
ce426f
 	  +8     CR save area
ce426f
 	r1+0     stack back chain
ce426f
@@ -206,15 +208,15 @@
ce426f
 /* Store the LR in the LR Save area of the previous frame.  */
ce426f
 /* XXX Do we have to do this?  */
ce426f
 	la	r8,FRAME_SIZE(r1)
ce426f
-	std	r5,FRAME_SIZE+16(r1)
ce426f
-	cfi_offset (lr, 16)
ce426f
+	std	r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
+	cfi_offset (lr, FRAME_LR_SAVE)
ce426f
 	std	r5,CALLING_LR(r1)
ce426f
 	mfcr	r0
ce426f
 	std	r9,INT_PARMS+48(r1)
ce426f
 	std	r10,INT_PARMS+56(r1)
ce426f
 	std	r8,CALLING_SP(r1)
ce426f
 /* I'm almost certain we don't have to save cr...  be safe.  */
ce426f
-	std	r0,FRAME_SIZE+8(r1)
ce426f
+	std	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ce426f
 	ld	r12,.LC__dl_hwcap@toc(r2)
ce426f
 #ifdef SHARED
ce426f
 	/* Load _rtld_local_ro._dl_hwcap.  */
ce426f
@@ -311,13 +313,13 @@
ce426f
 	lvx	v12,r11,r10
ce426f
 	lvx	v13,r11,r9
ce426f
 L(restoreFXR):
ce426f
-	ld	r0,FRAME_SIZE+16(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
 	ld	r10,INT_PARMS+56(r1)
ce426f
 	ld	r9,INT_PARMS+48(r1)
ce426f
 	ld	r8,INT_PARMS+40(r1)
ce426f
 	ld	r7,INT_PARMS+32(r1)
ce426f
 	mtlr	r0
ce426f
-	ld	r0,FRAME_SIZE+8(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ce426f
 	ld	r6,INT_PARMS+24(r1)
ce426f
 	ld	r5,INT_PARMS+16(r1)
ce426f
 	ld	r4,INT_PARMS+8(r1)
ce426f
@@ -327,7 +329,7 @@
ce426f
 	ld	r3,INT_PARMS+0(r1)
ce426f
 #if _CALL_ELF == 2
ce426f
 /* Restore the caller's TOC in case we jump to a local entry point.  */
ce426f
-	ld	r2,FRAME_SIZE+40(r1)
ce426f
+	ld	r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
ce426f
 #endif
ce426f
 /* Load the floating point registers.  */
ce426f
 	lfd	fp1,FPR_PARMS+0(r1)
ce426f
@@ -375,19 +377,19 @@
ce426f
 	lvx	v12,r11,r10
ce426f
 	lvx	v13,r11,r9
ce426f
 L(restoreFXR2):
ce426f
-	ld	r0,FRAME_SIZE+16(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
 	ld	r10,INT_PARMS+56(r1)
ce426f
 	ld	r9,INT_PARMS+48(r1)
ce426f
 	ld	r8,INT_PARMS+40(r1)
ce426f
 	ld	r7,INT_PARMS+32(r1)
ce426f
 	mtlr	r0
ce426f
-	ld	r0,FRAME_SIZE+8(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ce426f
 	ld	r6,INT_PARMS+24(r1)
ce426f
 	ld	r5,INT_PARMS+16(r1)
ce426f
 	ld	r4,INT_PARMS+8(r1)
ce426f
 	mtcrf	0xFF,r0
ce426f
 /* Prepare for calling the function returned by fixup.  */
ce426f
-	std	r2,40(r1)
ce426f
+	std	r2,FRAME_TOC_SAVE(r1)
ce426f
 	PPC64_LOAD_FUNCPTR r3
ce426f
 	ld	r3,INT_PARMS+0(r1)
ce426f
 /* Load the floating point registers.  */
ce426f
@@ -406,7 +408,7 @@
ce426f
 	lfd	fp13,FPR_PARMS+96(r1)
ce426f
 /* Call the target function.  */
ce426f
 	bctrl
ce426f
-	ld	r2,40(r1)
ce426f
+	ld	r2,FRAME_TOC_SAVE(r1)
ce426f
 	lwz	r12,VR_VRSAVE(r1)
ce426f
 /* But return here and store the return values.  */
ce426f
 	std	r3,INT_RTN(r1)
ce426f
@@ -441,7 +443,7 @@
ce426f
 	beq	L(pltexitreturn)
ce426f
 	lvx	v2,0,r10
ce426f
 L(pltexitreturn):
ce426f
-	ld	r0,FRAME_SIZE+16(r1)
ce426f
+	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ce426f
 	ld	r31,584(r1)
ce426f
 	ld	r30,576(r1)
ce426f
 	mtlr	r0
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -24,16 +24,16 @@
ce426f
 ENTRY(_mcount)
ce426f
 	mflr		 r4
ce426f
 	ld		 r11, 0(r1)
ce426f
-	stdu		 r1,-112(r1)
ce426f
-	cfi_adjust_cfa_offset (112)
ce426f
-	std		 r4, 128(r1)
ce426f
-	cfi_offset (lr, 16)
ce426f
-	ld		 r3, 16(r11)
ce426f
+	stdu		 r1,-FRAME_MIN_SIZE(r1)
ce426f
+	cfi_adjust_cfa_offset (FRAME_MIN_SIZE)
ce426f
+	std		 r4, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
ce426f
+	cfi_offset (lr, FRAME_LR_SAVE)
ce426f
+	ld		 r3, FRAME_LR_SAVE(r11)
ce426f
 	bl		 JUMPTARGET(__mcount_internal)
ce426f
 	nop
ce426f
-	ld		 r0, 128(r1)
ce426f
+	ld		 r0, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
ce426f
 	mtlr		 r0
ce426f
-	addi		 r1,r1,112
ce426f
+	addi		 r1,r1,FRAME_MIN_SIZE
ce426f
 	blr
ce426f
 END(_mcount)
ce426f
 
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -56,7 +56,7 @@
ce426f
    bugz #269.  __GI__setjmp is used in csu/libc-start.c when
ce426f
    HAVE_CLEANUP_JMP_BUF is defined.  */
ce426f
 ENTRY (__GI__setjmp)
ce426f
-	std r2,40(r1)		/* Save the callers TOC in the save area.  */
ce426f
+	std r2,FRAME_TOC_SAVE(r1)		/* Save the callers TOC in the save area.  */
ce426f
 	CALL_MCOUNT 1
ce426f
 	li r4,0			/* Set second argument to 0.  */
ce426f
 	b JUMPTARGET (GLUE(__sigsetjmp,_ent))
ce426f
@@ -83,7 +83,7 @@
ce426f
 #endif
ce426f
 	mflr r0
ce426f
 #if defined SHARED && !defined IS_IN_rtld
ce426f
-	ld   r5,40(r1)	/* Retrieve the callers TOC.  */
ce426f
+	ld   r5,FRAME_TOC_SAVE(r1)	/* Retrieve the callers TOC.  */
ce426f
 	std  r5,(JB_GPR2*8)(3)
ce426f
 #else
ce426f
 	std  r2,(JB_GPR2*8)(3)
ce426f
@@ -219,14 +219,14 @@
ce426f
 	b	JUMPTARGET (__sigjmp_save)
ce426f
 #else
ce426f
 	mflr	r0
ce426f
-	std	r0,16(r1)
ce426f
-	stdu	r1,-112(r1)
ce426f
-	cfi_adjust_cfa_offset(112)
ce426f
-	cfi_offset(lr,16)
ce426f
+	std	r0,FRAME_LR_SAVE(r1)
ce426f
+	stdu	r1,-FRAME_MIN_SIZE(r1)
ce426f
+	cfi_adjust_cfa_offset(FRAME_MIN_SIZE)
ce426f
+	cfi_offset(lr,FRAME_LR_SAVE)
ce426f
 	bl	JUMPTARGET (__sigjmp_save)
ce426f
 	nop
ce426f
-	ld	r0,112+16(r1)
ce426f
-	addi	r1,r1,112
ce426f
+	ld	r0,FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
ce426f
+	addi	r1,r1,FRAME_MIN_SIZE
ce426f
 	mtlr	r0
ce426f
 	blr
ce426f
 #endif
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -20,25 +20,67 @@
ce426f
 
ce426f
 #ifdef __ASSEMBLER__
ce426f
 
ce426f
+/* Stack frame offsets.  */
ce426f
+#if _CALL_ELF != 2
ce426f
+#define FRAME_MIN_SIZE		112
ce426f
+#define FRAME_MIN_SIZE_PARM	112
ce426f
+#define FRAME_BACKCHAIN		0
ce426f
+#define FRAME_CR_SAVE		8
ce426f
+#define FRAME_LR_SAVE		16
ce426f
+#define FRAME_TOC_SAVE		40
ce426f
+#define FRAME_PARM_SAVE		48
ce426f
+#define FRAME_PARM1_SAVE	48
ce426f
+#define FRAME_PARM2_SAVE	56
ce426f
+#define FRAME_PARM3_SAVE	64
ce426f
+#define FRAME_PARM4_SAVE	72
ce426f
+#define FRAME_PARM5_SAVE	80
ce426f
+#define FRAME_PARM6_SAVE	88
ce426f
+#define FRAME_PARM7_SAVE	96
ce426f
+#define FRAME_PARM8_SAVE	104
ce426f
+#define FRAME_PARM9_SAVE	112
ce426f
+#else
ce426f
+#define FRAME_MIN_SIZE		32
ce426f
+#define FRAME_MIN_SIZE_PARM	96
ce426f
+#define FRAME_BACKCHAIN		0
ce426f
+#define FRAME_CR_SAVE		8
ce426f
+#define FRAME_LR_SAVE		16
ce426f
+#define FRAME_TOC_SAVE		24
ce426f
+#define FRAME_PARM_SAVE		32
ce426f
+#define FRAME_PARM1_SAVE	32
ce426f
+#define FRAME_PARM2_SAVE	40
ce426f
+#define FRAME_PARM3_SAVE	48
ce426f
+#define FRAME_PARM4_SAVE	56
ce426f
+#define FRAME_PARM5_SAVE	64
ce426f
+#define FRAME_PARM6_SAVE	72
ce426f
+#define FRAME_PARM7_SAVE	80
ce426f
+#define FRAME_PARM8_SAVE	88
ce426f
+#define FRAME_PARM9_SAVE	96
ce426f
+#endif
ce426f
+
ce426f
 /* Support macros for CALL_MCOUNT.  */
ce426f
+#if _CALL_ELF == 2
ce426f
+#define call_mcount_parm_offset (-64)
ce426f
+#else
ce426f
+#define call_mcount_parm_offset FRAME_PARM_SAVE
ce426f
+#endif
ce426f
 	.macro SAVE_ARG NARG
ce426f
 	.if \NARG
ce426f
 	SAVE_ARG \NARG-1
ce426f
-	std	2+\NARG,40+8*(\NARG)(1)
ce426f
+	std	2+\NARG,call_mcount_parm_offset-8+8*(\NARG)(1)
ce426f
 	.endif
ce426f
 	.endm
ce426f
 
ce426f
 	.macro REST_ARG NARG
ce426f
 	.if \NARG
ce426f
 	REST_ARG \NARG-1
ce426f
-	ld	2+\NARG,112+40+8*(\NARG)(1)
ce426f
+	ld	2+\NARG,FRAME_MIN_SIZE_PARM+call_mcount_parm_offset-8+8*(\NARG)(1)
ce426f
 	.endif
ce426f
 	.endm
ce426f
 
ce426f
 	.macro CFI_SAVE_ARG NARG
ce426f
 	.if \NARG
ce426f
 	CFI_SAVE_ARG \NARG-1
ce426f
-	cfi_offset(2+\NARG,40+8*(\NARG))
ce426f
+	cfi_offset(2+\NARG,call_mcount_parm_offset-8+8*(\NARG))
ce426f
 	.endif
ce426f
 	.endm
ce426f
 
ce426f
@@ -55,20 +97,20 @@
ce426f
 #ifdef	PROF
ce426f
 	mflr	r0
ce426f
 	SAVE_ARG \NARG
ce426f
-	std	r0,16(r1)
ce426f
-	stdu	r1,-112(r1)
ce426f
-	cfi_adjust_cfa_offset(112)
ce426f
-	cfi_offset(lr,16)
ce426f
+	std	r0,FRAME_LR_SAVE(r1)
ce426f
+	stdu	r1,-FRAME_MIN_SIZE_PARM(r1)
ce426f
+	cfi_adjust_cfa_offset(FRAME_MIN_SIZE_PARM)
ce426f
+	cfi_offset(lr,FRAME_LR_SAVE)
ce426f
 	CFI_SAVE_ARG \NARG
ce426f
 	bl	JUMPTARGET (_mcount)
ce426f
 #ifndef SHARED
ce426f
 	nop
ce426f
 #endif
ce426f
-	ld	r0,128(r1)
ce426f
+	ld	r0,FRAME_MIN_SIZE_PARM+FRAME_LR_SAVE(r1)
ce426f
 	REST_ARG \NARG
ce426f
 	mtlr	r0
ce426f
-	addi	r1,r1,112
ce426f
-	cfi_adjust_cfa_offset(-112)
ce426f
+	addi	r1,r1,FRAME_MIN_SIZE_PARM
ce426f
+	cfi_adjust_cfa_offset(-FRAME_MIN_SIZE_PARM)
ce426f
 	cfi_restore(lr)
ce426f
 	CFI_REST_ARG \NARG
ce426f
 #endif
ce426f
@@ -267,15 +309,15 @@
ce426f
     .else; \
ce426f
 .Local_syscall_error: \
ce426f
     mflr 0; \
ce426f
-    std 0,16(1); \
ce426f
-    stdu 1,-112(1); \
ce426f
-    cfi_adjust_cfa_offset(112); \
ce426f
-    cfi_offset(lr,16); \
ce426f
+    std 0,FRAME_LR_SAVE(1); \
ce426f
+    stdu 1,-FRAME_MIN_SIZE(1); \
ce426f
+    cfi_adjust_cfa_offset(FRAME_MIN_SIZE); \
ce426f
+    cfi_offset(lr,FRAME_LR_SAVE); \
ce426f
     bl JUMPTARGET(__syscall_error); \
ce426f
     nop; \
ce426f
-    ld 0,112+16(1); \
ce426f
-    addi 1,1,112; \
ce426f
-    cfi_adjust_cfa_offset(-112); \
ce426f
+    ld 0,FRAME_MIN_SIZE+FRAME_LR_SAVE(1); \
ce426f
+    addi 1,1,FRAME_MIN_SIZE; \
ce426f
+    cfi_adjust_cfa_offset(-FRAME_MIN_SIZE); \
ce426f
     mtlr 0; \
ce426f
     cfi_restore(lr); \
ce426f
     blr; \
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S
ce426f
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -33,24 +33,24 @@
ce426f
 	cmpld	reg, r1;				\
ce426f
 	bge+	.Lok;					\
ce426f
 	mflr	r0;					\
ce426f
-	std	r0,16(r1);				\
ce426f
+	std	r0,FRAME_LR_SAVE(r1);			\
ce426f
 	mr	r31,r3;					\
ce426f
 	mr	r30,r4;					\
ce426f
-	stdu	r1,-144(r1);				\
ce426f
+	stdu	r1,-FRAME_MIN_SIZE-32(r1);		\
ce426f
 	cfi_remember_state;				\
ce426f
-	cfi_adjust_cfa_offset (144);			\
ce426f
-	cfi_offset (lr, 16);				\
ce426f
+	cfi_adjust_cfa_offset (FRAME_MIN_SIZE+32);	\
ce426f
+	cfi_offset (lr, FRAME_LR_SAVE);			\
ce426f
 	li	r3,0;					\
ce426f
-	addi	r4,r1,112;				\
ce426f
+	addi	r4,r1,FRAME_MIN_SIZE;			\
ce426f
 	li	r0,__NR_sigaltstack;			\
ce426f
 	sc;						\
ce426f
 	/* Without working sigaltstack we cannot perform the test.  */ \
ce426f
 	bso	.Lok2;					\
ce426f
-	lwz	r0,112+8(r1);				\
ce426f
+	lwz	r0,FRAME_MIN_SIZE+8(r1);		\
ce426f
 	andi.	r4,r0,1;				\
ce426f
 	beq	.Lfail;					\
ce426f
-	ld	r0,112+16(r1);				\
ce426f
-	ld	r4,112(r1);				\
ce426f
+	ld	r0,FRAME_MIN_SIZE+16(r1);		\
ce426f
+	ld	r4,FRAME_MIN_SIZE(r1);			\
ce426f
 	add	r4,r4,r0;				\
ce426f
 	sub	r3,r3,reg;				\
ce426f
 	cmpld	r3,r0;					\
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
ce426f
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -31,9 +31,9 @@
ce426f
 	CALL_MCOUNT 1
ce426f
 	DISCARD_BOUNDS (r3)	/* the bounds are meaningless, so toss 'em.  */
ce426f
 
ce426f
-	std	r3,48(r1)
ce426f
+	std	r3,-8(r1)
ce426f
 	DO_CALL(SYS_ify(brk))
ce426f
-	ld	r6,48(r1)
ce426f
+	ld	r6,-8(r1)
ce426f
 	ld	r5,.LC__curbrk@toc(r2)
ce426f
 	std     r3,0(r5)
ce426f
 	cmpld   r6,r3
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
ce426f
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -45,22 +45,22 @@
ce426f
 	cror	cr0*4+eq,cr1*4+eq,cr0*4+eq
ce426f
 	beq-	cr0,L(badargs)
ce426f
 
ce426f
-	/* Save some regs in parm save area.  */
ce426f
+	/* Save some regs in the "red zone".  */
ce426f
 #ifdef RESET_PID
ce426f
-	std	r29,48(r1)
ce426f
+	std	r29,-24(r1)
ce426f
 #endif
ce426f
-	std	r30,56(r1)
ce426f
-	std	r31,64(r1)
ce426f
+	std	r30,-16(r1)
ce426f
+	std	r31,-8(r1)
ce426f
 #ifdef RESET_PID
ce426f
-	cfi_offset(r29,48)
ce426f
+	cfi_offset(r29,-24)
ce426f
 #endif
ce426f
-	cfi_offset(r30,56)
ce426f
-	cfi_offset(r31,64)
ce426f
+	cfi_offset(r30,-16)
ce426f
+	cfi_offset(r31,-8)
ce426f
 
ce426f
 	/* Set up stack frame for child.  */
ce426f
 	clrrdi	r4,r4,4
ce426f
 	li	r0,0
ce426f
-	stdu	r0,-112(r4) /* min stack frame is 112 bytes per ABI */
ce426f
+	stdu	r0,-FRAME_MIN_SIZE_PARM(r4)
ce426f
 
ce426f
 	/* Save fn, args, stack across syscall.  */
ce426f
 	mr	r30,r3			/* Function in r30.  */
ce426f
@@ -102,12 +102,12 @@
ce426f
 L(oldpid):
ce426f
 #endif
ce426f
 
ce426f
-	std	r2,40(r1)
ce426f
+	std	r2,FRAME_TOC_SAVE(r1)
ce426f
 	/* Call procedure.  */
ce426f
 	PPC64_LOAD_FUNCPTR r30
ce426f
 	mr	r3,r31
ce426f
 	bctrl
ce426f
-	ld	r2,40(r1)
ce426f
+	ld	r2,FRAME_TOC_SAVE(r1)
ce426f
 	/* Call _exit with result from procedure.  */
ce426f
 #ifdef SHARED
ce426f
 	b	JUMPTARGET(__GI__exit)
ce426f
@@ -126,15 +126,15 @@
ce426f
 L(parent):
ce426f
 	/* Parent.  Restore registers & return.  */
ce426f
 #ifdef RESET_PID
ce426f
-	cfi_offset(r29,48)
ce426f
+	cfi_offset(r29,-24)
ce426f
 #endif
ce426f
-	cfi_offset(r30,56)
ce426f
-	cfi_offset(r31,64)
ce426f
+	cfi_offset(r30,-16)
ce426f
+	cfi_offset(r31,-8)
ce426f
 #ifdef RESET_PID
ce426f
-	ld	r29,48(r1)
ce426f
+	ld	r29,-24(r1)
ce426f
 #endif
ce426f
-	ld	r30,56(r1)
ce426f
-	ld	r31,64(r1)
ce426f
+	ld	r30,-16(r1)
ce426f
+	ld	r31,-8(r1)
ce426f
 #ifdef RESET_PID
ce426f
 	cfi_restore(r29)
ce426f
 #endif
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
ce426f
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -46,8 +46,13 @@
ce426f
 # endif
ce426f
 #endif
ce426f
 
ce426f
-#define FRAMESIZE 128
ce426f
-#define stackblock FRAMESIZE+48 /* offset to parm save area.  */
ce426f
+#if _CALL_ELF == 2
ce426f
+#define FRAMESIZE (FRAME_MIN_SIZE+16+64)
ce426f
+#define stackblock (FRAME_MIN_SIZE+16)
ce426f
+#else
ce426f
+#define FRAMESIZE (FRAME_MIN_SIZE+16)
ce426f
+#define stackblock (FRAMESIZE+FRAME_PARM_SAVE) /* offset to parm save area.  */
ce426f
+#endif
ce426f
 
ce426f
 	.text
ce426f
 ENTRY(__socket)
ce426f
@@ -98,22 +103,22 @@
ce426f
 .Lsocket_cancel:
ce426f
 	cfi_adjust_cfa_offset(FRAMESIZE)
ce426f
 	mflr	r9
ce426f
-	std	r9,FRAMESIZE+16(r1)
ce426f
-	cfi_offset (lr, 16)
ce426f
+	std	r9,FRAMESIZE+FRAME_LR_SAVE(r1)
ce426f
+	cfi_offset (lr, FRAME_LR_SAVE)
ce426f
 	CENABLE
ce426f
-	std	r3,120(r1)
ce426f
+	std	r3,FRAME_MIN_SIZE+8(r1)
ce426f
 	li	r3,P(SOCKOP_,socket)
ce426f
 	addi	r4,r1,stackblock
ce426f
 	DO_CALL(SYS_ify(socketcall))
ce426f
 	mfcr	r0
ce426f
-	std	r3,112(r1)
ce426f
-	std	r0,FRAMESIZE+8(r1)
ce426f
-	cfi_offset (cr, 8)
ce426f
-	ld  	r3,120(r1)
ce426f
+	std	r3,FRAME_MIN_SIZE(r1)
ce426f
+	std	r0,FRAMESIZE+FRAME_CR_SAVE(r1)
ce426f
+	cfi_offset (cr, FRAME_CR_SAVE)
ce426f
+	ld  	r3,FRAME_MIN_SIZE+8(r1)
ce426f
 	CDISABLE
ce426f
-	ld	r4,FRAMESIZE+16(r1)
ce426f
-	ld	r0,FRAMESIZE+8(r1)
ce426f
-	ld	r3,112(r1)
ce426f
+	ld	r4,FRAMESIZE+FRAME_LR_SAVE(r1)
ce426f
+	ld	r0,FRAMESIZE+FRAME_CR_SAVE(r1)
ce426f
+	ld	r3,FRAME_MIN_SIZE(r1)
ce426f
 	mtlr	r4
ce426f
 	mtcr	r0
ce426f
 	addi	r1,r1,FRAMESIZE
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
ce426f
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym	2014-05-29 14:09:56.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym	2014-05-29 14:10:00.000000000 -0500
ce426f
@@ -8,27 +8,6 @@
ce426f
 SIG_SETMASK
ce426f
 
ce426f
 
ce426f
--- Offsets of the fields in the powerpc64 ABI stack frame.
ce426f
--- XXX Do these correspond to some struct?
ce426f
-
ce426f
-FRAME_BACKCHAIN		0
ce426f
-FRAME_CR_SAVE		8
ce426f
-FRAME_LR_SAVE		16
ce426f
-FRAME_COMPILER_DW	24
ce426f
-FRAME_LINKER_DW		32
ce426f
-FRAME_TOC_SAVE		40
ce426f
-FRAME_PARM_SAVE		48
ce426f
-FRAME_PARM1_SAVE	48
ce426f
-FRAME_PARM2_SAVE	56
ce426f
-FRAME_PARM3_SAVE	64
ce426f
-FRAME_PARM4_SAVE	72
ce426f
-FRAME_PARM5_SAVE	80
ce426f
-FRAME_PARM6_SAVE	88
ce426f
-FRAME_PARM7_SAVE	96
ce426f
-FRAME_PARM8_SAVE	104
ce426f
-FRAME_PARM9_SAVE	112
ce426f
-
ce426f
-
ce426f
 -- Offsets of the fields in the ucontext_t structure.
ce426f
 #define ucontext(member)	offsetof (ucontext_t, member)
ce426f
 #define mcontext(member)	ucontext (uc_mcontext.member)