7 $::lbdecor="\@L"; # local label decoration
8 $nmdecor=$::netware?"":"_"; # external name decoration
9 $drdecor=$::mwerks?".":""; # directive decoration
18 { if ($opcode =~ m/^j/o && $#_==0) # optimize jumps
19 { $_[0] = "NEAR $_[0]"; }
20 elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea
21 { $_[1] =~ s/^[^\[]*\[/\[/o; }
27 # opcodes not covered by ::generic above, mostly inconsistent namings...
29 sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
30 sub ::call_ptr { &::emit("call",@_); }
31 sub ::jmp_ptr { &::emit("jmp",@_); }
34 { my($size,$addr,$reg1,$reg2,$idx)=@_;
39 $ret .= " PTR" if ($::mwerks);
45 # prepend global references with optional underscore
46 $addr =~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige;
47 # put address arithmetic expression in parenthesis
48 $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/);
50 if (($addr ne "") && ($addr ne 0))
51 { if ($addr !~ /^-/) { $ret .= "$addr+"; }
58 $ret .= "+$reg1" if ($reg1 ne "");
64 $ret =~ s/\+\]/]/; # in case $addr was the only argument
68 sub ::BP { &get_mem("BYTE",@_); }
69 sub ::DWP { &get_mem("DWORD",@_); }
70 sub ::QWP { &get_mem("",@_); }
71 sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; }
72 sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; }
75 { if ($::mwerks) { push(@out,".section\t.text,64\n"); }
79 section code use32 class=code align=64
83 section .text code align=64
90 sub ::function_begin_B
92 my $global=($func !~ /^_/);
93 my $begin="${::lbdecor}_${func}_begin";
95 $begin =~ s/^\@/./ if ($::mwerks); # the torture never stops
97 &::LABEL($func,$global?"$begin":"$nmdecor$func");
100 push(@out,"${drdecor}global $func\n") if ($global);
101 push(@out,"${drdecor}align 16\n");
102 push(@out,"$func:\n");
103 push(@out,"$begin:\n") if ($global);
113 { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
115 ${drdecor}segment .bss
116 ${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 4
118 # comment out OPENSSL_ia32cap_P declarations
119 grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
122 push (@out,$initseg) if ($initseg);
125 sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
129 { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); }
133 { push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
136 { push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); }
139 { push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); }
142 { push(@out,"${drdecor}align\t$_[0]\n"); }
146 &::lea($dst,&::DWP($sym));
150 { my $f=$nmdecor.shift;
153 segment .CRT\$XCU data align=4