summaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/powerpc32/sysdep.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-11-07 12:34:52 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-11-10 16:15:34 -0500
commita988eb00e19e0365bdcb8b3be9ee8d4f6c2c6fbb (patch)
treed6fb870e589b0db79200978068e87a9a9e3469fe /sysdeps/powerpc/powerpc32/sysdep.h
parent9b4e372e9b5f7f4d028237a52ddbb1fbea425917 (diff)
downloadglibc-a988eb00e19e0365bdcb8b3be9ee8d4f6c2c6fbb.tar.gz
PowerPC: abort transaction in syscallsazanella/lockelision-ppc
Linux kernel powerpc documentation states issuing a syscall inside a transaction is not recommended and may lead to undefined behavior. It also states syscalls does not abort transactoin neither they run in transactional state. To avoid side-effects being visible outside transactions, GLIBC with lock elision enable issues a transaction abort instruction just before all syscalls if hardware supports hardware transactions.
Diffstat (limited to 'sysdeps/powerpc/powerpc32/sysdep.h')
-rw-r--r--sysdeps/powerpc/powerpc32/sysdep.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index c8a56aadbf..c4b3ca8696 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -88,7 +88,23 @@ GOT_LABEL: ; \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(name)
+#if !defined IS_IN_rtld && defined (ENABLE_LOCK_ELISION)
+# define ABORT_TRANSACTION \
+ cmpwi 2,0; \
+ beq 1f; \
+ lwz 0,TM_CAPABLE(2); \
+ cmpwi 0,0; \
+ beq 1f; \
+ li 0,_ABORT_SYSCALL; \
+ tabort. 0; \
+ .align 4; \
+1:
+#else
+# define ABORT_TRANSACTION
+#endif
+
#define DO_CALL(syscall) \
+ ABORT_TRANSACTION \
li 0,syscall; \
sc