linux: sparc: Fix syscall_cancel for LEON

Message ID 20240902195841.1455273-1-adhemerval.zanella@linaro.org
State New
Headers
Series linux: sparc: Fix syscall_cancel for LEON |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Adhemerval Zanella Sept. 2, 2024, 7:58 p.m. UTC
  LEON2/LEON3 are both sparcv8, which does not support branch hints
(bne,pn) nor the return instruction.

Checked with a build for sparcv8-linux-gnu targetting leon. I also
check some cancellation tests with qemu-system (targeting LEON3).
---
 sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
index aa5c658ce1..0db93c77bf 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
@@ -42,7 +42,11 @@  __syscall_cancel_arch_start:
 	     __syscall_do_cancel()  */
 	ld	[%i0], %g2
 	andcc	%g2, TCB_CANCELED_BITMASK, %g0
+#ifdef __sparcv9
 	bne,pn	%icc, 2f
+#else
+	bne	2f
+#endif
 	/* Issue a 6 argument syscall.  */
 	 mov	%i1, %g1
 	mov	%i2, %o0
@@ -60,8 +64,13 @@  __syscall_cancel_arch_end:
 	sub	%g0, %o0, %o0
 1:
 	mov	%o0, %i0
+#ifdef __sparcv9
 	return	%i7+8
 	 nop
+#else
+	jmp	%i7+8
+	 restore
+#endif
 
 2:
 	call	__syscall_do_cancel, 0