]>
git.ipfire.org Git - people/ms/strongswan.git/blob - src/libfreeswan/libcrypto/oldlibdes/des/asm/perlasm/x86ms.pl
0681ea18cf1447287ed37a4e50f83753786cca04
27 sub main
'asm_init_output { @out=(); }
28 sub main'asm_get_output
{ return(@out); }
29 sub main
'get_labels { return(@labels); }
30 sub main'external_label
{ push(@labels,@_); }
34 (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte
'\n";
40 (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
58 &main'sub("esp",$num*4);
65 &main'add
("esp",$num*4);
70 local($size,$addr,$reg1,$reg2,$idx)=@_;
72 local($ret)="$size PTR ";
75 if ($addr =~ /^(.+)\+(.+)$/)
80 elsif ($addr =~ /^[_a-zA-Z]/)
85 $reg1="$regs{$reg1}" if defined($regs{$reg1});
86 $reg2="$regs{$reg2}" if defined($regs{$reg2});
87 if (($addr ne "") && ($addr ne 0))
96 $t="*$idx" if ($idx != 0);
97 $reg1="+".$reg1 if ("$reg1$post" ne "");
98 $ret.="[$reg2$t$reg1$post]";
107 sub main
'mov { &out2("mov",@_); }
108 sub main'movb
{ &out2
("mov",@_); }
109 sub main
'and { &out2("and",@_); }
110 sub main'or { &out2
("or",@_); }
111 sub main
'shl { &out2("shl",@_); }
112 sub main'shr
{ &out2
("shr",@_); }
113 sub main
'xor { &out2("xor",@_); }
114 sub main'xorb
{ &out2
("xor",@_); }
115 sub main
'add { &out2("add",@_); }
116 sub main'adc
{ &out2
("adc",@_); }
117 sub main
'sub { &out2("sub",@_); }
118 sub main'rotl
{ &out2
("rol",@_); }
119 sub main
'rotr { &out2("ror",@_); }
120 sub main'exch
{ &out2
("xchg",@_); }
121 sub main
'cmp { &out2("cmp",@_); }
122 sub main'lea
{ &out2
("lea",@_); }
123 sub main
'mul { &out1("mul",@_); }
124 sub main'div
{ &out1
("div",@_); }
125 sub main
'dec { &out1("dec",@_); }
126 sub main'inc
{ &out1
("inc",@_); }
127 sub main
'jmp { &out1("jmp",@_); }
128 sub main'jmp_ptr
{ &out1p
("jmp",@_); }
129 sub main
'je { &out1("je",@_); }
130 sub main'jle
{ &out1
("jle",@_); }
131 sub main
'jz { &out1("jz",@_); }
132 sub main'jge
{ &out1
("jge",@_); }
133 sub main
'jl { &out1("jl",@_); }
134 sub main'jb
{ &out1
("jb",@_); }
135 sub main
'jnz { &out1("jnz",@_); }
136 sub main'jne
{ &out1
("jne",@_); }
137 sub main
'push { &out1("push",@_); $stack+=4; }
138 sub main'pop { &out1
("pop",@_); $stack-=4; }
139 sub main
'bswap { &out1("bswap",@_); &using486(); }
140 sub main'not { &out1
("not",@_); }
141 sub main
'call { &out1("call",'_
'.$_[0]); }
142 sub main'ret
{ &out0
("ret"); }
143 sub main
'nop { &out0("nop"); }
147 local($name,$p1,$p2)=@_;
150 push(@out,"\t$name\t");
155 push(@out,"\t" x $l);
156 push(@out,&conv($p2));
164 push(@out,"\t$name\n");
172 push(@out,"\t$name\t".&conv($p1)."\n");
179 $p =~ s/0x([0-9A-Fa-f]+)/0$1h/;
187 grep(s/\.386/\.486/,@out);
202 sub main
'function_begin
204 local($func,$extra)=@_;
222 sub main
'function_begin_B
224 local($func,$extra)=@_;
236 sub main
'function_end
254 sub main
'function_end_B
267 sub main
'function_end_A
290 return(&main
'DWP($stack+$num*4,"esp","",0));
295 return(&main
'DWP($_[0]*4,"esp","",0));
298 # Should use swtmp, which is above esp. Linix can trash the stack above esp
303 # return(&main'DWP(-(($num+1)*4),"esp","",0));
310 push(@out,"\t; $_\n");
316 if (!defined($label{$_[0]}))
318 $label{$_[0]}="\$${label}${_[0]}";
321 return($label{$_[0]});
326 if (!defined($label{$_[0]}))
328 $label{$_[0]}="${label}${_[0]}";
331 push(@out,"$label{$_[0]}:\n");
336 push(@out,"\tDD\t$_[0]\n");
344 push(@out,"\t$name\t ".&conv
($p1)."\n");