2007-05-15 20:51:48 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
2008-01-13 22:01:30 +00:00
|
|
|
$flavour = shift;
|
2007-05-15 20:51:48 +00:00
|
|
|
|
|
|
|
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
|
|
|
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
|
|
|
|
( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or
|
|
|
|
die "can't locate ppc-xlate.pl";
|
|
|
|
|
2008-01-13 22:01:30 +00:00
|
|
|
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
|
2007-05-15 20:51:48 +00:00
|
|
|
|
2008-01-13 22:01:30 +00:00
|
|
|
if ($flavour=~/64/) {
|
2007-05-15 20:51:48 +00:00
|
|
|
$CMPLI="cmpldi";
|
|
|
|
$SHRLI="srdi";
|
|
|
|
$SIGNX="extsw";
|
|
|
|
} else {
|
|
|
|
$CMPLI="cmplwi";
|
|
|
|
$SHRLI="srwi";
|
|
|
|
$SIGNX="mr";
|
|
|
|
}
|
|
|
|
|
|
|
|
$code=<<___;
|
2008-09-12 14:45:54 +00:00
|
|
|
.machine "any"
|
2007-05-15 20:51:48 +00:00
|
|
|
.text
|
|
|
|
|
2011-11-14 20:54:17 +00:00
|
|
|
.globl .OPENSSL_ppc64_probe
|
2007-05-15 20:51:48 +00:00
|
|
|
.align 4
|
2011-11-14 20:54:17 +00:00
|
|
|
.OPENSSL_ppc64_probe:
|
|
|
|
fcfid f1,f1
|
|
|
|
extrdi r0,r0,32,0
|
2007-05-15 20:51:48 +00:00
|
|
|
blr
|
2011-11-14 20:54:17 +00:00
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,0,0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_ppc64_probe,.-.OPENSSL_ppc64_probe
|
2011-11-14 20:54:17 +00:00
|
|
|
|
|
|
|
.globl .OPENSSL_altivec_probe
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_altivec_probe:
|
|
|
|
.long 0x10000484 # vor v0,v0,v0
|
|
|
|
blr
|
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,0,0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_altivec_probe,.-..OPENSSL_altivec_probe
|
2007-05-15 20:51:48 +00:00
|
|
|
|
2014-07-20 12:36:49 +00:00
|
|
|
.globl .OPENSSL_crypto207_probe
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_crypto207_probe:
|
|
|
|
lvx_u v0,0,r1
|
|
|
|
vcipher v0,v0,v0
|
|
|
|
blr
|
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,0,0
|
|
|
|
.size .OPENSSL_crypto207_probe,.-.OPENSSL_crypto207_probe
|
|
|
|
|
2007-05-15 20:51:48 +00:00
|
|
|
.globl .OPENSSL_wipe_cpu
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_wipe_cpu:
|
|
|
|
xor r0,r0,r0
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f0,f31
|
|
|
|
fmr f1,f31
|
|
|
|
fmr f2,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
mr r3,r1
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f3,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r4,r4,r4
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f4,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r5,r5,r5
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f5,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r6,r6,r6
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f6,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r7,r7,r7
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f7,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r8,r8,r8
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f8,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r9,r9,r9
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f9,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r10,r10,r10
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f10,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r11,r11,r11
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f11,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
xor r12,r12,r12
|
2011-11-14 20:54:17 +00:00
|
|
|
fmr f12,f31
|
|
|
|
fmr f13,f31
|
2007-05-15 20:51:48 +00:00
|
|
|
blr
|
2011-11-14 20:54:17 +00:00
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,0,0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_wipe_cpu,.-.OPENSSL_wipe_cpu
|
2007-05-15 20:51:48 +00:00
|
|
|
|
|
|
|
.globl .OPENSSL_atomic_add
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_atomic_add:
|
2011-11-14 20:54:17 +00:00
|
|
|
Ladd: lwarx r5,0,r3
|
2007-05-15 20:51:48 +00:00
|
|
|
add r0,r4,r5
|
|
|
|
stwcx. r0,0,r3
|
2011-11-14 20:54:17 +00:00
|
|
|
bne- Ladd
|
2007-05-15 20:51:48 +00:00
|
|
|
$SIGNX r3,r0
|
|
|
|
blr
|
2011-11-14 20:54:17 +00:00
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,2,0
|
|
|
|
.long 0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_atomic_add,.-.OPENSSL_atomic_add
|
2007-05-15 20:51:48 +00:00
|
|
|
|
|
|
|
.globl .OPENSSL_rdtsc
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_rdtsc:
|
|
|
|
mftb r3
|
|
|
|
mftbu r4
|
|
|
|
blr
|
2011-11-14 20:54:17 +00:00
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,0,0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_rdtsc,.-.OPENSSL_rdtsc
|
2007-05-15 20:51:48 +00:00
|
|
|
|
|
|
|
.globl .OPENSSL_cleanse
|
|
|
|
.align 4
|
|
|
|
.OPENSSL_cleanse:
|
|
|
|
$CMPLI r4,7
|
|
|
|
li r0,0
|
|
|
|
bge Lot
|
2010-02-12 17:02:13 +00:00
|
|
|
$CMPLI r4,0
|
|
|
|
beqlr-
|
2007-05-15 20:51:48 +00:00
|
|
|
Little: mtctr r4
|
|
|
|
stb r0,0(r3)
|
|
|
|
addi r3,r3,1
|
2012-04-27 20:19:23 +00:00
|
|
|
bdnz \$-8
|
2007-05-15 20:51:48 +00:00
|
|
|
blr
|
|
|
|
Lot: andi. r5,r3,3
|
|
|
|
beq Laligned
|
|
|
|
stb r0,0(r3)
|
|
|
|
subi r4,r4,1
|
|
|
|
addi r3,r3,1
|
|
|
|
b Lot
|
|
|
|
Laligned:
|
|
|
|
$SHRLI r5,r4,2
|
|
|
|
mtctr r5
|
|
|
|
stw r0,0(r3)
|
|
|
|
addi r3,r3,4
|
2012-04-27 20:19:23 +00:00
|
|
|
bdnz \$-8
|
2007-05-15 20:51:48 +00:00
|
|
|
andi. r4,r4,3
|
|
|
|
bne Little
|
|
|
|
blr
|
2011-11-14 20:54:17 +00:00
|
|
|
.long 0
|
|
|
|
.byte 0,12,0x14,0,0,0,2,0
|
|
|
|
.long 0
|
2013-10-14 22:31:45 +00:00
|
|
|
.size .OPENSSL_cleanse,.-.OPENSSL_cleanse
|
2007-05-15 20:51:48 +00:00
|
|
|
___
|
|
|
|
|
|
|
|
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
|
|
|
print $code;
|
|
|
|
close STDOUT;
|