perlasm/ppc-xlate.pl: comply with ABIs that specify vrsave as reserved.
authorAndy Polyakov <appro@openssl.org>
Wed, 2 Dec 2015 13:32:08 +0000 (14:32 +0100)
committerAndy Polyakov <appro@openssl.org>
Thu, 3 Dec 2015 12:29:53 +0000 (13:29 +0100)
RT#4162

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/perlasm/ppc-xlate.pl

index f89e8142993166bbd3d9535c204efba0fc5ad9b2..0f46cf06bcb859f50f140443bd1711e91886c768 100755 (executable)
@@ -151,6 +151,26 @@ my $vmr = sub {
     "  vor     $vx,$vy,$vy";
 };
 
+# Some ABIs specify vrsave, special-purpose register #256, as reserved
+# for system use.
+my $no_vrsave = ($flavour =~ /aix|linux64le/);
+my $mtspr = sub {
+    my ($f,$idx,$ra) = @_;
+    if ($idx == 256 && $no_vrsave) {
+       "       or      $ra,$ra,$ra";
+    } else {
+       "       mtspr   $idx,$ra";
+    }
+};
+my $mfspr = sub {
+    my ($f,$rd,$idx) = @_;
+    if ($idx == 256 && $no_vrsave) {
+       "       li      $rd,-1";
+    } else {
+       "       mfspr   $rd,$idx";
+    }
+};
+
 # PowerISA 2.06 stuff
 sub vsxmem_op {
     my ($f, $vrt, $ra, $rb, $op) = @_;