]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
LoongArch64 assembly pack: Really implement OPENSSL_rdtsc
authorXi Ruoyao <xry111@xry111.site>
Sun, 26 Nov 2023 11:49:48 +0000 (19:49 +0800)
committerTomas Mraz <tomas@openssl.org>
Tue, 19 Dec 2023 17:34:34 +0000 (18:34 +0100)
LoongArch [rdtimel.w][1] instruction reads the low 32 bits of the
64-bit stable counter, implement OPENSSL_rdtsc with it instead of always
returning 0.

[1]:https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_rdtimelh_w_rdtime_d

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22823)

crypto/loongarch64cpuid.pl

index d16a8e98f2251d53ce6d35e806e33d5ba6e01785..8a84caca923b679911c7c23370ec7123da844483 100644 (file)
@@ -101,8 +101,8 @@ $code.=<<___;
 .globl OPENSSL_rdtsc
 .type   OPENSSL_rdtsc,\@function
 OPENSSL_rdtsc:
-    move    $a0,$zero
-    jr      $ra
+    rdtimel.w $a0,$zero
+    jr        $ra
 ___
 }