about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
diff options
context:
space:
mode:
authorMatheus Castanho <msc@linux.ibm.com>2021-04-09 14:47:27 -0300
committerMatheus Castanho <msc@linux.ibm.com>2021-06-10 16:23:25 -0300
commitebae2f5a6f971a8f0b6c99e00f9c45ef7433924a (patch)
tree285a7fe55a04da03c9d2b2e6844174951eacc6a3 /sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
parentacc85ea1eb046eee9296fbc4803b82cb485ced07 (diff)
downloadglibc-ebae2f5a6f971a8f0b6c99e00f9c45ef7433924a.tar.gz
glibc-ebae2f5a6f971a8f0b6c99e00f9c45ef7433924a.tar.xz
glibc-ebae2f5a6f971a8f0b6c99e00f9c45ef7433924a.zip
Add build option to disable usage of scv on powerpc
Commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef added support for the scv
syscall ABI on powerpc.  Since then systems that have kernel and processor
support started using scv.  However adding the proper support for a new syscall
ABI requires changes to several other projects (e.g. qemu, valgrind, strace,
kernel), which are gradually receiving support.

Meanwhile, having a way to disable scv on glibc at build time can be useful for
distros that may encounter conflicts with projects that still do not support the
scv ABI, buying time until proper support is added.

This commit adds a --disable-scv option that disables scv support and uses sc
for all syscalls, like before commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef.

Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S14
1 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index e9bd8cb960..777ead80b0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -38,11 +38,13 @@ ENTRY (__clone)
 	beq-	cr0,L(badargs)
 
 	/* Save some regs in the "red zone".  */
+#ifdef USE_PPC_SCV
 	std	r28,-32(r1)
+	cfi_offset(r28,-32)
+#endif
 	std	r29,-24(r1)
 	std	r30,-16(r1)
 	std	r31,-8(r1)
-	cfi_offset(r28,-32)
 	cfi_offset(r29,-24)
 	cfi_offset(r30,-16)
 	cfi_offset(r31,-8)
@@ -71,6 +73,7 @@ ENTRY (__clone)
 
 	/* Do the call.  */
 	li 	r0,SYS_ify(clone)
+#ifdef USE_PPC_SCV
 	CHECK_SCV_SUPPORT r28 0f
 	/* This is equivalent to DO_CALL_SCV, but we cannot use the macro here
 	because it uses CFI directives and we just called cfi_endproc.  */
@@ -87,6 +90,7 @@ ENTRY (__clone)
 	/* When using scv, error is indicated by negative r3.  */
 	cmpdi	cr1,r3,0
 	b 1f
+#endif /* USE_PPC_SCV */
 0:      DO_CALL_SC
 
 	/* Check for child process.  */
@@ -119,22 +123,26 @@ L(parent):
 	cmpdi cr1,r28,0
 
 	/* Parent.  Restore registers & return.  */
+#ifdef USE_PPC_SCV
 	cfi_offset(r28,-32)
+	ld	r28,-32(r1)
+	cfi_restore(r28)
+#endif
 	cfi_offset(r29,-24)
 	cfi_offset(r30,-16)
 	cfi_offset(r31,-8)
-	ld	r28,-32(r1)
 	ld	r29,-24(r1)
 	ld	r30,-16(r1)
 	ld	r31,-8(r1)
-	cfi_restore(r28)
 	cfi_restore(r29)
 	cfi_restore(r30)
 	cfi_restore(r31)
 
+#ifdef USE_PPC_SCV
 	beq cr1,0f
 	RET_SCV
 	b 1f
+#endif
 0:	RET_SC
 1:	TAIL_CALL_SYSCALL_ERROR