diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-11-07 12:34:52 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2015-01-12 06:32:08 -0500 |
commit | 56cf2763819d2f721c98f2b8bcc04a3c673837d3 (patch) | |
tree | 5d2fde37897779f64b83951c1ef99406fd384055 /sysdeps/powerpc/powerpc64 | |
parent | 4b45943a6f62cfc239e79ad8902f5c7f71fd13ec (diff) | |
download | glibc-56cf2763819d2f721c98f2b8bcc04a3c673837d3.tar.gz glibc-56cf2763819d2f721c98f2b8bcc04a3c673837d3.tar.xz glibc-56cf2763819d2f721c98f2b8bcc04a3c673837d3.zip |
powerpc: abort transaction in syscalls
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 enabled will issue a transaction abort instruction just before all syscalls if hardware supports hardware transactions.
Diffstat (limited to 'sysdeps/powerpc/powerpc64')
-rw-r--r-- | sysdeps/powerpc/powerpc64/sysdep.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index ab9c3d73f4..1f4efe6648 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -283,7 +283,23 @@ LT_LABELSUFFIX(name,_name_end): ; \ TRACEBACK_MASK(name,mask) \ END_2(name) +#if !IS_IN(rtld) && defined (ENABLE_LOCK_ELISION) +# define ABORT_TRANSACTION \ + cmpdi 13,0; \ + beq 1f; \ + lwz 0,TM_CAPABLE(13); \ + 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 |