From f4d456408d9d7bca31f34765d1a05fbd9fa55826 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Fri, 14 Feb 2014 17:24:12 +0100 Subject: x86[_64]cpuid.pl: add low-level RDSEED. --- crypto/perlasm/x86_64-xlate.pl | 13 +++++++++++++ crypto/perlasm/x86asm.pl | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'crypto/perlasm') diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index ed74b85ac9..4dd7f5252d 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)=@_; -- cgit v1.2.3