summaryrefslogtreecommitdiffstats
path: root/crypto/perlasm
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2011-06-04 12:20:45 +0000
committerAndy Polyakov <appro@openssl.org>2011-06-04 12:20:45 +0000
commit301799b803fc9f3e2adaad32b1ccace736bbe7cc (patch)
tree0edc73d8425ac47b5124104760cb0294c53b214f /crypto/perlasm
parent8d515259e2a4631a5b42f1a072b0ff6f8eba189c (diff)
x86[_64]cpuid.pl: add function accessing rdrand instruction.
Diffstat (limited to 'crypto/perlasm')
-rwxr-xr-xcrypto/perlasm/x86_64-xlate.pl15
-rw-r--r--crypto/perlasm/x86asm.pl8
2 files changed, 22 insertions, 1 deletions
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index 91017c69f3..a6b718b5e8 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -625,7 +625,7 @@ my %globals;
/\.comm/ && do { my @str=split(/,\s*/,$line);
my $v=undef;
if ($nasm) {
- $v.="common $prefix@str[0] @str[1]:near";
+ $v.="common $prefix@str[0] @str[1]";
} else {
$v="$current_segment\tENDS\n" if ($current_segment);
$current_segment = ".data";
@@ -757,6 +757,19 @@ my $pclmulqdq = sub {
}
};
+my $rdrand = 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,0xf0|($dst&7);
+ @opcode;
+ } else {
+ ();
+ }
+};
+
if ($nasm) {
print <<___;
default rel
diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl
index efa7b61ce8..b7ddb8137f 100644
--- a/crypto/perlasm/x86asm.pl
+++ b/crypto/perlasm/x86asm.pl
@@ -123,6 +123,14 @@ sub ::pclmulqdq
{ &::generic("pclmulqdq",@_); }
}
+sub ::rdrand
+{ my ($dst)=@_;
+ if ($dst =~ /(e[a-dsd][ixp])/)
+ { &::data_byte(0x0f,0xc7,0xf0|$regrm{$dst}); }
+ else
+ { &::generic("rdrand",@_); }
+}
+
# label management
$lbdecor="L"; # local label decoration, set by package
$label="000";