aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/perlasm
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2014-02-14 17:24:12 +0100
committerAndy Polyakov <appro@openssl.org>2014-02-14 17:25:14 +0100
commit104c032b7bed893f87d08ef3178848715e7035b3 (patch)
treed231b0877c1a78f1421666b69df58e46a98b0365 /crypto/perlasm
parentb347341c75656cf8bc039bd0ea5e3571c9299687 (diff)
downloadopenssl-104c032b7bed893f87d08ef3178848715e7035b3.tar.gz
x86[_64]cpuid.pl: add low-level RDSEED.
(cherry picked from commit f4d456408d9d7bca31f34765d1a05fbd9fa55826)
Diffstat (limited to 'crypto/perlasm')
-rwxr-xr-xcrypto/perlasm/x86_64-xlate.pl13
-rw-r--r--crypto/perlasm/x86asm.pl8
2 files changed, 21 insertions, 0 deletions
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index ead4a7d3b5..f51184aedd 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -778,6 +778,19 @@ my $rdrand = sub {
}
};
+my $rdseed = sub {
+ if (shift =~ /%[er](\w+)/) {
+ my @opcode=();
+ my $dst=$1;
+ if ($dst !~ /[0-9]+/) { $dst = $regrm{"%e$dst"}; }
+ rex(\@opcode,0,$1,8);
+ push @opcode,0x0f,0xc7,0xf8|($dst&7);
+ @opcode;
+ } else {
+ ();
+ }
+};
+
sub rxb {
local *opcode=shift;
my ($dst,$src1,$src2,$rxb)=@_;
diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl
index 17abf92297..dcbc738516 100644
--- a/crypto/perlasm/x86asm.pl
+++ b/crypto/perlasm/x86asm.pl
@@ -131,6 +131,14 @@ sub ::rdrand
{ &::generic("rdrand",@_); }
}
+sub ::rdseed
+{ my ($dst)=@_;
+ if ($dst =~ /(e[a-dsd][ixp])/)
+ { &::data_byte(0x0f,0xc7,0xf8|$regrm{$dst}); }
+ else
+ { &::generic("rdrand",@_); }
+}
+
sub rxb {
local *opcode=shift;
my ($dst,$src1,$src2,$rxb)=@_;