There are 4 unused bytes in the minimum frame in the ELFv2 ABI. At the
risk of causing a future ABI incompatibility, use this and save 16 bytes
from interrupt and switch frames.

Signed-off-by: Nicholas Piggin <npig...@gmail.com>
---
 arch/powerpc/include/asm/ptrace.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h 
b/arch/powerpc/include/asm/ptrace.h
index ab41d47761c9..cc308dce7ace 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -121,11 +121,16 @@ struct pt_regs
 
 #ifdef CONFIG_PPC64_ELF_ABI_V2
 #define STACK_FRAME_MIN_SIZE   32
-#define STACK_USER_INT_FRAME_SIZE      (sizeof(struct pt_regs) + 
STACK_FRAME_MIN_SIZE + 16)
-#define STACK_INT_FRAME_REGS   (STACK_FRAME_MIN_SIZE + 16)
-#define STACK_INT_FRAME_MARKER STACK_FRAME_MIN_SIZE
-#define STACK_SWITCH_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_MIN_SIZE 
+ 16)
-#define STACK_SWITCH_FRAME_REGS        (STACK_FRAME_MIN_SIZE + 16)
+#define STACK_USER_INT_FRAME_SIZE      (sizeof(struct pt_regs) + 
STACK_FRAME_MIN_SIZE)
+#define STACK_INT_FRAME_REGS   STACK_FRAME_MIN_SIZE
+#define STACK_INT_FRAME_MARKER 12      /* Reserved word next to CR save word */
+
+/*
+ * The switch frame has to match the format of the int frames up to pt_regs,
+ * because fields are accessed with the int frame pt_regs offsets.
+ */
+#define STACK_SWITCH_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_MIN_SIZE)
+#define STACK_SWITCH_FRAME_REGS        STACK_FRAME_MIN_SIZE
 #else
 /*
  * The ELFv1 ABI specifies 48 bytes plus a minimum 64 byte parameter save
-- 
2.37.2

Reply via email to