93dc2d
commit 5daf13b1e637eec0f7a2de05b177cb0d76479aa2
93dc2d
Author: Matheus Castanho <msc@linux.ibm.com>
93dc2d
Date:   Wed Dec 1 11:14:40 2021 -0300
93dc2d
93dc2d
    powerpc64[le]: Allocate extra stack frame on syscall.S
93dc2d
    
93dc2d
    The syscall function does not allocate the extra stack frame for scv like other
93dc2d
    assembly syscalls using DO_CALL_SCV. So after commit d120fb9941 changed the
93dc2d
    offset that is used to save LR, syscall ended up using an invalid offset,
93dc2d
    causing regressions on powerpc64. So make sure the extra stack frame is
93dc2d
    allocated in syscall.S as well to make it consistent with other uses of
93dc2d
    DO_CALL_SCV and avoid similar issues in the future.
93dc2d
    
93dc2d
    Tested on powerpc, powerpc64, and powerpc64le (with and without scv)
93dc2d
    
93dc2d
    Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
93dc2d
    
93dc2d
    (cherry picked from commit ae91d3df24a4a1b1f264d101a71a298bff310d14)
93dc2d
93dc2d
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
93dc2d
index a29652feaf6764cf..a5497c8370982fe3 100644
93dc2d
--- a/sysdeps/unix/sysv/linux/powerpc/syscall.S
93dc2d
+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S
93dc2d
@@ -27,7 +27,11 @@ ENTRY (syscall)
93dc2d
 	mr   r8,r9
93dc2d
 #if defined(USE_PPC_SCV) && !IS_IN(rtld) && (defined(__PPC64__) || defined(__powerpc64__))
93dc2d
 	CHECK_SCV_SUPPORT r9 0f
93dc2d
+	stdu r1,-SCV_FRAME_SIZE(r1)
93dc2d
+	cfi_adjust_cfa_offset(SCV_FRAME_SIZE)
93dc2d
 	DO_CALL_SCV
93dc2d
+	addi r1,r1,SCV_FRAME_SIZE
93dc2d
+	cfi_adjust_cfa_offset(-SCV_FRAME_SIZE)
93dc2d
 	RET_SCV
93dc2d
 	b 1f
93dc2d
 #endif