s390x assembly pack: implement OPENSSL_rdtsc as STCKF

.. if avalable. STCK has an artificial delay to ensure uniqueness
which can result in a performance penalty if used heavily
concurrently.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5284)
This commit is contained in:
Patrick Steuer 2018-02-07 18:49:29 +01:00 committed by Andy Polyakov
parent 97d37b85d4
commit 19308587d4

View file

@ -129,6 +129,14 @@ OPENSSL_s390x_facilities:
.type OPENSSL_rdtsc,\@function
.align 16
OPENSSL_rdtsc:
larl %r4,OPENSSL_s390xcap_P
tm S390X_STFLE+3(%r4),0x40 # check for store-clock-fast facility
jz .Lstck
.long 0xb27cf010 # stckf 16($sp)
lg %r2,16($sp)
br $ra
.Lstck:
stck 16($sp)
lg %r2,16($sp)
br $ra