3 $flavour = shift;
4 $output = shift;
5 if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
6
7 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
8
9 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
10 ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
11 ( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or
12 die "can't locate x86_64-xlate.pl";
13
14 open OUT,"| \"$^X\" $xlate $flavour $output";
15 *STDOUT=*OUT;
16
17 ($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order
18 ("%rdi","%rsi","%rdx","%rcx"); # Unix order
19
20 print<<___;
21 .extern OPENSSL_cpuid_setup
22 .hidden OPENSSL_cpuid_setup
23 .section .init
24 call OPENSSL_cpuid_setup
25
26 .hidden OPENSSL_ia32cap_P
27 .comm OPENSSL_ia32cap_P,8,4
28
29 .text
30
31 .globl OPENSSL_atomic_add
32 .type OPENSSL_atomic_add,\@abi-omnipotent
33 .align 16
34 OPENSSL_atomic_add:
35 movl ($arg1),%eax
36 .Lspin: leaq ($arg2,%rax),%r8
37 .byte 0xf0 # lock
38 cmpxchgl %r8d,($arg1)
39 jne .Lspin
40 movl %r8d,%eax
41 .byte 0x48,0x98 # cltq/cdqe
42 ret
43 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
|
3 $flavour = shift;
4 $output = shift;
5 if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
6
7 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
8
9 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
10 ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
11 ( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or
12 die "can't locate x86_64-xlate.pl";
13
14 open OUT,"| \"$^X\" $xlate $flavour $output";
15 *STDOUT=*OUT;
16
17 ($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order
18 ("%rdi","%rsi","%rdx","%rcx"); # Unix order
19
20 print<<___;
21 .extern OPENSSL_cpuid_setup
22 .hidden OPENSSL_cpuid_setup
23 .extern illumos_locking_setup
24 .hidden illumos_locking_setup
25 .section .init
26 call illumos_locking_setup
27 call OPENSSL_cpuid_setup
28
29 .hidden OPENSSL_ia32cap_P
30 .comm OPENSSL_ia32cap_P,8,4
31
32 .text
33
34 .globl OPENSSL_atomic_add
35 .type OPENSSL_atomic_add,\@abi-omnipotent
36 .align 16
37 OPENSSL_atomic_add:
38 movl ($arg1),%eax
39 .Lspin: leaq ($arg2,%rax),%r8
40 .byte 0xf0 # lock
41 cmpxchgl %r8d,($arg1)
42 jne .Lspin
43 movl %r8d,%eax
44 .byte 0x48,0x98 # cltq/cdqe
45 ret
46 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
|