714 lines
77 KiB
HTML
Executable File
714 lines
77 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>InstEntriesCompare</span><span class=cF0>(</span><span class=cF9>CInst</span><span class=cF0> *tmpins1,</span><span class=cF9>CInst</span><span class=cF0> *tmpins2)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> i1,i2,j=0,res=0,oc_cnt1=tmpins1->opcode_cnt,oc_cnt2=tmpins2->opcode_cnt;
|
|
<a name="l4"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins1->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>)
|
|
<a name="l5"></a> oc_cnt1--;
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins2->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>)
|
|
<a name="l7"></a> oc_cnt2--;
|
|
<a name="l8"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (j<oc_cnt1 && j<oc_cnt2) {
|
|
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (res=tmpins1->opcode[j]-tmpins2->opcode[j])
|
|
<a name="l11"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l12"></a> j++;
|
|
<a name="l13"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (res=oc_cnt1-oc_cnt2)
|
|
<a name="l15"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l16"></a>
|
|
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins1->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0> && tmpins2->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>)
|
|
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0> tmpins1->opcode[j]-tmpins2->opcode[j];
|
|
<a name="l19"></a>
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (res=tmpins1->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0> - tmpins2->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>)
|
|
<a name="l21"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l22"></a>
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (res=tmpins1->slash_val-tmpins2->slash_val)
|
|
<a name="l24"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l25"></a>
|
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (res=tmpins1->flags&</span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0> - tmpins2->flags&</span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0>)
|
|
<a name="l27"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l28"></a>
|
|
<a name="l29"></a> i1=</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,tmpins1->arg1) ||
|
|
<a name="l30"></a> </span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,tmpins1->arg2);
|
|
<a name="l31"></a> i2=</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,tmpins2->arg1) ||
|
|
<a name="l32"></a> </span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,tmpins2->arg2);
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (res=i1-i2)
|
|
<a name="l34"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> </span><span class=cF1>if</span><span class=cF0> (res=tmpins1->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF0> - tmpins2->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF0>)
|
|
<a name="l37"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l38"></a>
|
|
<a name="l39"></a> i1=tmpins1->arg2==</span><span class=cF3>ARGT_IMM64</span><span class=cF0> || tmpins1->arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>;
|
|
<a name="l40"></a> i2=tmpins2->arg2==</span><span class=cF3>ARGT_IMM64</span><span class=cF0> || tmpins2->arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>;
|
|
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> i1-i2;
|
|
<a name="l42"></a> }
|
|
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l44"></a>}
|
|
<a name="l45"></a>
|
|
<a name="l46"></a></span><span class=cF2>/*</span><span class=cF0>
|
|
<a name="l47"></a></span><span class=cF2>U0 DumpUAsmIns(CInst *tmpins)</span><span class=cF0>
|
|
<a name="l48"></a></span><span class=cF2>{</span><span class=cF0>
|
|
<a name="l49"></a></span><span class=cF2> CHashOpcode *tmpo=tmpins(U8 *)-tmpins->ins_entry_num*sizeof(CInst)</span><span class=cF0>
|
|
<a name="l50"></a></span><span class=cF2> -offset(CHashOpcode.ins);</span><span class=cF0>
|
|
<a name="l51"></a></span><span class=cF2> "%10s:%02d,%02d SV:%02d\n",tmpo->str,</span><span class=cF0>
|
|
<a name="l52"></a> </span><span class=cF2>tmpins->arg1,tmpins->arg2,tmpins->slash_val;</span><span class=cF0>
|
|
<a name="l53"></a></span><span class=cF2>}</span><span class=cF0>
|
|
<a name="l54"></a></span><span class=cF2>U0 DumpUAsmTables()</span><span class=cF0>
|
|
<a name="l55"></a></span><span class=cF2>{</span><span class=cF0>
|
|
<a name="l56"></a></span><span class=cF2> I64 k;</span><span class=cF0>
|
|
<a name="l57"></a></span><span class=cF2> "16/32 Bit Table\n";</span><span class=cF0>
|
|
<a name="l58"></a></span><span class=cF2> for (k=0;k<uasm.table_16_32_entries;k++)</span><span class=cF0>
|
|
<a name="l59"></a></span><span class=cF2> DumpUAsmIns(uasm.table_16_32[k]);</span><span class=cF0>
|
|
<a name="l60"></a></span><span class=cF2> "\n\n\n\n64 Bit Table\n";</span><span class=cF0>
|
|
<a name="l61"></a></span><span class=cF2> for (k=0;k<uasm.table_64_entries;k++)</span><span class=cF0>
|
|
<a name="l62"></a></span><span class=cF2> DumpUAsmIns(uasm.table_64[k]);</span><span class=cF0>
|
|
<a name="l63"></a></span><span class=cF2>}</span><span class=cF0>
|
|
<a name="l64"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l65"></a>
|
|
<a name="l66"></a></span><span class=cF9>CInst</span><span class=cF0> *</span><span class=cFD>InstEntryFind</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *rip,</span><span class=cF9>I64</span><span class=cF0> opsize,</span><span class=cF9>I64</span><span class=cF0> seg_size)
|
|
<a name="l67"></a>{</span><span class=cF2>//Binary Search</span><span class=cF0>
|
|
<a name="l68"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,n,m,k,arg1,arg2,o1,o2,oc_cnt;
|
|
<a name="l69"></a> </span><span class=cF9>CInst</span><span class=cF0> *tmpins,**table;
|
|
<a name="l70"></a> i=0;
|
|
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==64) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l72"></a> table=</span><span class=cFB>uasm</span><span class=cF0>.table_64;
|
|
<a name="l73"></a> j=</span><span class=cFB>uasm</span><span class=cF0>.table_64_entries-1;
|
|
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l75"></a> table=</span><span class=cFB>uasm</span><span class=cF0>.table_16_32;
|
|
<a name="l76"></a> j=</span><span class=cFB>uasm</span><span class=cF0>.table_16_32_entries-1;
|
|
<a name="l77"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> k=(i+j)>>1; </span><span class=cF2>//binary search</span><span class=cF0>
|
|
<a name="l80"></a> tmpins=table[k];
|
|
<a name="l81"></a></span><span class=cF2>//DumpUAsmIns(tmpins);</span><span class=cF0>
|
|
<a name="l82"></a> m=0;
|
|
<a name="l83"></a> n=0;
|
|
<a name="l84"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) { </span><span class=cF2>//ief_compare_start</span><span class=cF0>
|
|
<a name="l85"></a> arg1=tmpins->arg1;
|
|
<a name="l86"></a> arg2=tmpins->arg2;
|
|
<a name="l87"></a> oc_cnt=tmpins->opcode_cnt;
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags&</span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>)
|
|
<a name="l89"></a> oc_cnt--;
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (n<oc_cnt) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l91"></a> o1=rip[n];
|
|
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (n==tmpins->opcode_cnt-1 && tmpins->flags & </span><span class=cF3>IEF_PLUS_OPCODE</span><span class=cF0>)
|
|
<a name="l93"></a> o1&=-8;
|
|
<a name="l94"></a> o2=tmpins->opcode[n++];
|
|
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (m=o1-o2)
|
|
<a name="l96"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpins->uasm_slash_val] </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l99"></a> </span><span class=cF1>case</span><span class=cF0> 0...7:
|
|
<a name="l100"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>m=rip[n]>>3&7-tmpins->slash_val</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.mem_arg_mask,arg1) ||
|
|
<a name="l102"></a> </span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.mem_arg_mask,arg2)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l103"></a> rip[n]&0xC0==0xC0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l104"></a> m=1;
|
|
<a name="l105"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l106"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==16) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0>) {
|
|
<a name="l109"></a> m=-1;
|
|
<a name="l110"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l111"></a> }
|
|
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_OP_SIZE16</span><span class=cF0>) {
|
|
<a name="l114"></a> m=1;
|
|
<a name="l115"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l116"></a> }
|
|
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==64||arg1==</span><span class=cF3>ARGT_M64</span><span class=cF0>||arg2==</span><span class=cF3>ARGT_M64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg1</span><span class=cF7>)</span><span class=cF0>&&
|
|
<a name="l120"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg2</span><span class=cF7>)</span><span class=cF0>&&
|
|
<a name="l121"></a> !</span><span class=cF7>(</span><span class=cF0>tmpins->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l122"></a> m=1;
|
|
<a name="l123"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg1</span><span class=cF7>)</span><span class=cF0>||
|
|
<a name="l125"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg2</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l126"></a> tmpins->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF0>)
|
|
<a name="l127"></a> m=-1;
|
|
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l129"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.mem_arg_mask,arg1)||
|
|
<a name="l130"></a> </span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cFB>uasm</span><span class=cF0>.mem_arg_mask,arg2)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l131"></a> rip[n]&0xC0==0xC0)
|
|
<a name="l132"></a> m=1;
|
|
<a name="l133"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l134"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SV_I_REG</span><span class=cF0>:
|
|
<a name="l135"></a> m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3;
|
|
<a name="l136"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l137"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SV_STI_LIKE</span><span class=cF0>:
|
|
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l139"></a> m=rip[n]-tmpins->opcode[tmpins->opcode_cnt-1];
|
|
<a name="l140"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l141"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SV_R_REG</span><span class=cF0>:
|
|
<a name="l142"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SV_NONE</span><span class=cF0>:
|
|
<a name="l143"></a> m=0;
|
|
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==16) {
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l146"></a> m=-1;
|
|
<a name="l147"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l149"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l150"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_OP_SIZE16</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l151"></a> m=1;
|
|
<a name="l152"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l154"></a> }
|
|
<a name="l155"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==64 || arg1==</span><span class=cF3>ARGT_M64</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_M64</span><span class=cF0>) {
|
|
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg1</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l157"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg2</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l158"></a> !</span><span class=cF7>(</span><span class=cF0>tmpins->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF7>)</span><span class=cF0>&& !</span><span class=cF7>(</span><span class=cF0>arg2==</span><span class=cF3>ARGT_NONE</span><span class=cF0> &&
|
|
<a name="l159"></a> (</span><span class=cF3>ARGT_UIMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_UIMM64</span><span class=cF0> ||
|
|
<a name="l160"></a> </span><span class=cF3>ARGT_IMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_IMM64</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l161"></a> m=1;
|
|
<a name="l162"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpins->arg2==</span><span class=cF3>ARGT_IMM64</span><span class=cF0> || tmpins->arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (arg2!=</span><span class=cF3>ARGT_IMM64</span><span class=cF0>&&arg2!=</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>)
|
|
<a name="l164"></a> m=1;
|
|
<a name="l165"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2==</span><span class=cF3>ARGT_IMM64</span><span class=cF0>||arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>)
|
|
<a name="l166"></a> m=-1;
|
|
<a name="l167"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg1</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l169"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask,arg2</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l170"></a> tmpins->flags&</span><span class=cF3>IEF_48_REX</span><span class=cF0>)
|
|
<a name="l171"></a> m=-1;
|
|
<a name="l172"></a> }
|
|
<a name="l173"></a> </span><span class=cF1>goto</span><span class=cF0> ief_compare_done;
|
|
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l175"></a> }
|
|
<a name="l176"></a>ief_compare_done:
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (m>0) {
|
|
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (k==i) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l179"></a> k=j;
|
|
<a name="l180"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l182"></a> i=k;
|
|
<a name="l183"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (m<0) {
|
|
<a name="l184"></a> </span><span class=cF1>if</span><span class=cF0> (k-i<=1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l185"></a> k=i;
|
|
<a name="l186"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l187"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l188"></a> j=k;
|
|
<a name="l189"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l190"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l192"></a> </span><span class=cF1>return</span><span class=cF0> table[k];
|
|
<a name="l193"></a>}
|
|
<a name="l194"></a>
|
|
<a name="l195"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>UAsmHashLoad</span><span class=cF0>()
|
|
<a name="l196"></a>{
|
|
<a name="l197"></a> </span><span class=cF9>CHashOpcode</span><span class=cF0> *tmph;
|
|
<a name="l198"></a> </span><span class=cF9>CInst</span><span class=cF0> *tmpins;
|
|
<a name="l199"></a> </span><span class=cF9>I64</span><span class=cF0> i,j1,j2,k;
|
|
<a name="l200"></a>
|
|
<a name="l201"></a> </span><span class=cFB>uasm</span><span class=cF0>.ins64_arg_mask=0x0880888880+1<<</span><span class=cF3>ARGT_ST0</span><span class=cF0>+1<<</span><span class=cF3>ARGT_STI</span><span class=cF0>;
|
|
<a name="l202"></a> </span><span class=cFB>uasm</span><span class=cF0>.signed_arg_mask=1<<</span><span class=cF3>ARGT_REL8</span><span class=cF0>+1<<</span><span class=cF3>ARGT_REL16</span><span class=cF0>+1<<</span><span class=cF3>ARGT_REL32</span><span class=cF0>+
|
|
<a name="l203"></a> 1<<</span><span class=cF3>ARGT_IMM8</span><span class=cF0>+1<<</span><span class=cF3>ARGT_IMM16</span><span class=cF0>+1<<</span><span class=cF3>ARGT_IMM32</span><span class=cF0>+1<<</span><span class=cF3>ARGT_IMM64</span><span class=cF0>;
|
|
<a name="l204"></a> </span><span class=cFB>uasm</span><span class=cF0>.mem_arg_mask=1<<</span><span class=cF3>ARGT_M8</span><span class=cF0>+1<<</span><span class=cF3>ARGT_M16</span><span class=cF0>+1<<</span><span class=cF3>ARGT_M32</span><span class=cF0>+1<<</span><span class=cF3>ARGT_M64</span><span class=cF0>;
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_16_32_entries=</span><span class=cFB>uasm</span><span class=cF0>.table_64_entries=0;
|
|
<a name="l207"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<=</span><span class=cFB>cmp</span><span class=cF0>.asm_hash->mask;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l208"></a> tmph=</span><span class=cFB>cmp</span><span class=cF0>.asm_hash->body[i];
|
|
<a name="l209"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
|
|
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type==</span><span class=cF3>HTT_OPCODE</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>tmph->oc_flags&</span><span class=cF3>OCF_ALIAS</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l211"></a> tmpins=&tmph->ins;
|
|
<a name="l212"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<tmph->inst_entry_cnt;k++) {
|
|
<a name="l213"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_16_32_entries++;
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpins->flags&</span><span class=cF3>IEF_NOT_IN_64_BIT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l215"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_64_entries++;
|
|
<a name="l216"></a> tmpins++;
|
|
<a name="l217"></a> }
|
|
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l219"></a> tmph=tmph->next;
|
|
<a name="l220"></a> }
|
|
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l222"></a>
|
|
<a name="l223"></a> j1=j2=0;
|
|
<a name="l224"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_16_32=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFB>uasm</span><span class=cF0>.table_16_32_entries*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l225"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_64 =</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFB>uasm</span><span class=cF0>.table_64_entries *</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l226"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<=</span><span class=cFB>cmp</span><span class=cF0>.asm_hash->mask;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l227"></a> tmph=</span><span class=cFB>cmp</span><span class=cF0>.asm_hash->body[i];
|
|
<a name="l228"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
|
|
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type==</span><span class=cF3>HTT_OPCODE</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>tmph->oc_flags&</span><span class=cF3>OCF_ALIAS</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l230"></a> tmpins=&tmph->ins;
|
|
<a name="l231"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<tmph->inst_entry_cnt;k++) {
|
|
<a name="l232"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_16_32[j1++]=tmpins;
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpins->flags&</span><span class=cF3>IEF_NOT_IN_64_BIT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l234"></a> </span><span class=cFB>uasm</span><span class=cF0>.table_64[j2++]=tmpins;
|
|
<a name="l235"></a> tmpins++;
|
|
<a name="l236"></a> }
|
|
<a name="l237"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l238"></a> tmph=tmph->next;
|
|
<a name="l239"></a> }
|
|
<a name="l240"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l241"></a> </span><span class=cF5>QSortI64</span><span class=cF0>(</span><span class=cFB>uasm</span><span class=cF0>.table_16_32,</span><span class=cFB>uasm</span><span class=cF0>.table_16_32_entries,&</span><span class=cFD>InstEntriesCompare</span><span class=cF0>);
|
|
<a name="l242"></a> </span><span class=cF5>QSortI64</span><span class=cF0>(</span><span class=cFB>uasm</span><span class=cF0>.table_64 ,</span><span class=cFB>uasm</span><span class=cF0>.table_64_entries ,&</span><span class=cFD>InstEntriesCompare</span><span class=cF0>);
|
|
<a name="l243"></a>}
|
|
<a name="l244"></a>
|
|
<a name="l245"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Ui</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf,</span><span class=cF1>U8</span><span class=cF0> **_rip,</span><span class=cF9>I64</span><span class=cF0> seg_size=64,</span><span class=cF9>I64</span><span class=cF0> *_jmp_dst=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> just_ins=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
<a name="l246"></a>{</span><span class=cF2>//Unassembles one inst</span><span class=cF0>
|
|
<a name="l247"></a> </span><span class=cF9>I64</span><span class=cF0> i,disp,imm,opsize,opadd,
|
|
<a name="l248"></a> arg1,arg2,reloced_arg1,reloced_arg2,
|
|
<a name="l249"></a> arg1_size=0,arg2_size=0,reloced_arg1_size,reloced_arg2_size,
|
|
<a name="l250"></a> ModrM=-1,SIB=-1,scale,r1,r2,
|
|
<a name="l251"></a> Mod=-1,RM1=-1,RM2=-1,</span><span class=cF1>REX</span><span class=cF0>=-1,REX_r=0,REX_x=0,REX_b=0;
|
|
<a name="l252"></a> </span><span class=cF1>Bool</span><span class=cF0> cont;
|
|
<a name="l253"></a> </span><span class=cF9>CInst</span><span class=cF0> *tmpins,*tmpins2;
|
|
<a name="l254"></a> </span><span class=cF9>CHashOpcode</span><span class=cF0> *tmpo;
|
|
<a name="l255"></a> </span><span class=cF1>U8</span><span class=cF0> *rip=*_rip,*ptr,*reloced_arg1_st,*reloced_arg2_st,
|
|
<a name="l256"></a> *bin_data_area1,*bin_data_area2,
|
|
<a name="l257"></a> line1[512],line2[512],buf2[512],arg1_st[512],
|
|
<a name="l258"></a> arg2_st[512],seg_overrides[32];
|
|
<a name="l259"></a>
|
|
<a name="l260"></a> </span><span class=cF1>if</span><span class=cF0> (_jmp_dst) *_jmp_dst=-1;
|
|
<a name="l261"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==16) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l262"></a> opsize=16;
|
|
<a name="l263"></a> opadd=16;
|
|
<a name="l264"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (seg_size==32) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l265"></a> opsize=32;
|
|
<a name="l266"></a> opadd=32;
|
|
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l268"></a> opsize=32;
|
|
<a name="l269"></a> opadd=64;
|
|
<a name="l270"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l271"></a> *arg1_st=0;
|
|
<a name="l272"></a> *arg2_st=0;
|
|
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0> && </span><span class=cF5>PutSrcLink</span><span class=cF7>(</span><span class=cF0>rip,1,line1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l274"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>"\n"</span><span class=cF0>);
|
|
<a name="l275"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l276"></a> *line1=0;
|
|
<a name="l277"></a>
|
|
<a name="l278"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(line1+</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>line1</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF6>"%24tp "</span><span class=cF0>,rip);
|
|
<a name="l279"></a> bin_data_area1=line1+</span><span class=cF5>StrLen</span><span class=cF0>(line1);
|
|
<a name="l280"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<6;i++)
|
|
<a name="l281"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>"%02X"</span><span class=cF0>,rip[i]);
|
|
<a name="l282"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>" "</span><span class=cF0>);
|
|
<a name="l283"></a>
|
|
<a name="l284"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(line2,</span><span class=cF6>"%24tp "</span><span class=cF0>,rip+6);
|
|
<a name="l285"></a> bin_data_area2=line2+</span><span class=cF5>StrLen</span><span class=cF0>(line2);
|
|
<a name="l286"></a> </span><span class=cF1>for</span><span class=cF0> (i=6;i<12;i++)
|
|
<a name="l287"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line2,</span><span class=cF6>"%02X"</span><span class=cF0>,rip[i]);
|
|
<a name="l288"></a>
|
|
<a name="l289"></a> *seg_overrides=0;
|
|
<a name="l290"></a> cont=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l291"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l292"></a> </span><span class=cF1>switch</span><span class=cF0> (*rip) {
|
|
<a name="l293"></a> </span><span class=cF1>case</span><span class=cF0> 0x2E: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l294"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"CS:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l295"></a> </span><span class=cF1>case</span><span class=cF0> 0x36: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l296"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"SS:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l297"></a> </span><span class=cF1>case</span><span class=cF0> 0x3E: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l298"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"DS:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cF1>case</span><span class=cF0> 0x26: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l300"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"ES:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l301"></a> </span><span class=cF1>case</span><span class=cF0> 0x64: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l302"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"FS:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l303"></a> </span><span class=cF1>case</span><span class=cF0> 0x65: </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>seg_overrides</span><span class=cF7>)</span><span class=cF0><24)
|
|
<a name="l304"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(seg_overrides,</span><span class=cF6>"GS:"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l305"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>OC_OP_SIZE_PREFIX</span><span class=cF0>:
|
|
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==16)
|
|
<a name="l307"></a> opsize=32;
|
|
<a name="l308"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l309"></a> opsize=16;
|
|
<a name="l310"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l311"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>OC_ADDR_SIZE_PREFIX</span><span class=cF0>:
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (opadd==16)
|
|
<a name="l313"></a> opadd=32;
|
|
<a name="l314"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l315"></a> opadd=16;
|
|
<a name="l316"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l317"></a> </span><span class=cF1>case</span><span class=cF0> 0x40...0x4F:
|
|
<a name="l318"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==64) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l319"></a> </span><span class=cF1>REX</span><span class=cF0>=*rip;
|
|
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>REX</span><span class=cF0>>=0x48)
|
|
<a name="l321"></a> opsize=64;
|
|
<a name="l322"></a> REX_b=</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cF1>REX</span><span class=cF0>,0)<<3;
|
|
<a name="l323"></a> REX_x=</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cF1>REX</span><span class=cF0>,1)<<3;
|
|
<a name="l324"></a> REX_r=</span><span class=cF5>Bt</span><span class=cF0>(&</span><span class=cF1>REX</span><span class=cF0>,2)<<3;
|
|
<a name="l325"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l326"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF2>//Fall thru if !64</span><span class=cF0>
|
|
<a name="l327"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l328"></a> cont=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l329"></a> }
|
|
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (cont)
|
|
<a name="l331"></a> rip++;
|
|
<a name="l332"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l333"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l334"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l335"></a>
|
|
<a name="l336"></a> tmpins=</span><span class=cFD>InstEntryFind</span><span class=cF0>(rip,opsize,seg_size);
|
|
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (opsize==32 && seg_size==64) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l338"></a> tmpins2=</span><span class=cFD>InstEntryFind</span><span class=cF0>(rip,64,seg_size);
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins2!=tmpins && tmpins2->flags&</span><span class=cF3>IEF_REX_ONLY_R8_R15</span><span class=cF0> ||
|
|
<a name="l340"></a> tmpins2->flags&</span><span class=cF3>IEF_REX_XOR_LIKE</span><span class=cF0>&& rip[1]>>3&7==rip[1]&7)
|
|
<a name="l341"></a> tmpins=tmpins2;
|
|
<a name="l342"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l343"></a>
|
|
<a name="l344"></a> rip+=tmpins->opcode_cnt;
|
|
<a name="l345"></a> tmpo=tmpins(</span><span class=cF1>U8</span><span class=cF0> *)-tmpins->ins_entry_num*</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CInst</span><span class=cF0>)
|
|
<a name="l346"></a> -</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CHashOpcode</span><span class=cF0>.ins);
|
|
<a name="l347"></a> </span><span class=cF1>if</span><span class=cF0> (just_ins)
|
|
<a name="l348"></a> *line1=0;
|
|
<a name="l349"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,tmpo->str);
|
|
<a name="l350"></a>
|
|
<a name="l351"></a> arg1=tmpins->arg1;
|
|
<a name="l352"></a> arg2=tmpins->arg2;
|
|
<a name="l353"></a>
|
|
<a name="l354"></a> </span><span class=cF1>if</span><span class=cF0> (arg1_size=tmpins->size1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l355"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.signed_arg_mask,arg1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l356"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"I%d "</span><span class=cF0>,arg1_size);
|
|
<a name="l357"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"U%d "</span><span class=cF0>,arg1_size);
|
|
<a name="l359"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l360"></a>
|
|
<a name="l361"></a> </span><span class=cF1>if</span><span class=cF0> (arg2_size=tmpins->size2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>uasm</span><span class=cF0>.signed_arg_mask,arg2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l363"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"I%d "</span><span class=cF0>,arg2_size);
|
|
<a name="l364"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"U%d "</span><span class=cF0>,arg2_size);
|
|
<a name="l366"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l367"></a>
|
|
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_PLUS_OPCODE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l369"></a> rip--;
|
|
<a name="l370"></a> RM1=*rip++ - tmpins->opcode[tmpins->opcode_cnt-1]+REX_b;
|
|
<a name="l371"></a> ptr=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l372"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_R8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_R64</span><span class=cF0>) {
|
|
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (arg1_size==8) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l374"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>REX</span><span class=cF0>!=-1)
|
|
<a name="l375"></a> ptr=</span><span class=cF6>"ST_U8_REX_REGS"</span><span class=cF0>;
|
|
<a name="l376"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l377"></a> ptr=</span><span class=cF6>"ST_U8_REGS"</span><span class=cF0>;
|
|
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1_size==16)
|
|
<a name="l379"></a> ptr=</span><span class=cF6>"ST_U16_REGS"</span><span class=cF0>;
|
|
<a name="l380"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1_size==32)
|
|
<a name="l381"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l382"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1_size==64)
|
|
<a name="l383"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (ptr)
|
|
<a name="l385"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%Z"</span><span class=cF0>,RM1,ptr);
|
|
<a name="l386"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l387"></a> </span><span class=cF1>if</span><span class=cF0> (arg2_size==8) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>REX</span><span class=cF0>!=-1)
|
|
<a name="l389"></a> ptr=</span><span class=cF6>"ST_U8_REX_REGS"</span><span class=cF0>;
|
|
<a name="l390"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l391"></a> ptr=</span><span class=cF6>"ST_U8_REGS"</span><span class=cF0>;
|
|
<a name="l392"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2_size==16)
|
|
<a name="l393"></a> ptr=</span><span class=cF6>"ST_U16_REGS"</span><span class=cF0>;
|
|
<a name="l394"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2_size==32)
|
|
<a name="l395"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l396"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2_size==64)
|
|
<a name="l397"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l398"></a> </span><span class=cF1>if</span><span class=cF0> (ptr)
|
|
<a name="l399"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%Z"</span><span class=cF0>,RM1,ptr);
|
|
<a name="l400"></a> }
|
|
<a name="l401"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l402"></a>
|
|
<a name="l403"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_M64</span><span class=cF0> ||
|
|
<a name="l404"></a> </span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_M64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l405"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_M64</span><span class=cF0>) {
|
|
<a name="l406"></a> reloced_arg1=arg2;
|
|
<a name="l407"></a> reloced_arg2=arg1;
|
|
<a name="l408"></a> reloced_arg1_size=arg2_size;
|
|
<a name="l409"></a> reloced_arg2_size=arg1_size;
|
|
<a name="l410"></a> reloced_arg1_st=arg2_st;
|
|
<a name="l411"></a> reloced_arg2_st=arg1_st;
|
|
<a name="l412"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l413"></a> reloced_arg1=arg1;
|
|
<a name="l414"></a> reloced_arg2=arg2;
|
|
<a name="l415"></a> reloced_arg1_size=arg1_size;
|
|
<a name="l416"></a> reloced_arg2_size=arg2_size;
|
|
<a name="l417"></a> reloced_arg1_st=arg1_st;
|
|
<a name="l418"></a> reloced_arg2_st=arg2_st;
|
|
<a name="l419"></a> }
|
|
<a name="l420"></a>
|
|
<a name="l421"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,seg_overrides);
|
|
<a name="l422"></a> ModrM=*rip++;
|
|
<a name="l423"></a> Mod=ModrM>>6 & 3;
|
|
<a name="l424"></a> RM1=ModrM & 7+REX_b;
|
|
<a name="l425"></a> RM2=ModrM>>3 & 7+REX_r;
|
|
<a name="l426"></a> </span><span class=cF1>if</span><span class=cF0> (Mod<3 && RM1&7==4)
|
|
<a name="l427"></a> SIB=*rip++;
|
|
<a name="l428"></a> </span><span class=cF1>if</span><span class=cF0> (Mod==1) {
|
|
<a name="l429"></a> disp=*rip(</span><span class=cF1>U8</span><span class=cF0> *)++;
|
|
<a name="l430"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"%02X"</span><span class=cF0>,disp);
|
|
<a name="l431"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (Mod==2) {
|
|
<a name="l432"></a> disp=*rip(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l433"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"%08X"</span><span class=cF0>,disp);
|
|
<a name="l434"></a> }
|
|
<a name="l435"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->slash_val<8)
|
|
<a name="l436"></a> RM2=-1;
|
|
<a name="l437"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l438"></a> ptr=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l439"></a> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2==</span><span class=cF3>ARGT_SREG</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l440"></a> </span><span class=cF1>if</span><span class=cF0> (RM2<=5)
|
|
<a name="l441"></a> ptr=</span><span class=cF6>"ST_SEG_REGS"</span><span class=cF0>;
|
|
<a name="l442"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>ARGT_IMM8</span><span class=cF0><=reloced_arg2<=</span><span class=cF3>ARGT_IMM64</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l443"></a> !</span><span class=cF7>(</span><span class=cF3>ARGT_UIMM8</span><span class=cF0><=reloced_arg2<=</span><span class=cF3>ARGT_UIMM64</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l444"></a> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2_size==8) {
|
|
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>REX</span><span class=cF0>!=-1)
|
|
<a name="l446"></a> ptr=</span><span class=cF6>"ST_U8_REX_REGS"</span><span class=cF0>;
|
|
<a name="l447"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l448"></a> ptr=</span><span class=cF6>"ST_U8_REGS"</span><span class=cF0>;
|
|
<a name="l449"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2_size==16)
|
|
<a name="l450"></a> ptr=</span><span class=cF6>"ST_U16_REGS"</span><span class=cF0>;
|
|
<a name="l451"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2_size==32)
|
|
<a name="l452"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l453"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2_size==64)
|
|
<a name="l454"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l455"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l456"></a> </span><span class=cF1>if</span><span class=cF0> (ptr)
|
|
<a name="l457"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg2_st,</span><span class=cF6>"%Z"</span><span class=cF0>,RM2,ptr);
|
|
<a name="l458"></a> }
|
|
<a name="l459"></a> </span><span class=cF1>if</span><span class=cF0> (RM1&7==5 && !Mod) {
|
|
<a name="l460"></a> disp=*rip(</span><span class=cF9>I32</span><span class=cF0> *)++;
|
|
<a name="l461"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==64) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l462"></a> disp+=rip;
|
|
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2==</span><span class=cF3>ARGT_IMM8</span><span class=cF0> || reloced_arg2==</span><span class=cF3>ARGT_UIMM8</span><span class=cF0>)
|
|
<a name="l464"></a> disp++;
|
|
<a name="l465"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2==</span><span class=cF3>ARGT_IMM16</span><span class=cF0> || reloced_arg2==</span><span class=cF3>ARGT_UIMM16</span><span class=cF0>)
|
|
<a name="l466"></a> disp+=2;
|
|
<a name="l467"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2==</span><span class=cF3>ARGT_IMM32</span><span class=cF0> || reloced_arg2==</span><span class=cF3>ARGT_UIMM32</span><span class=cF0>)
|
|
<a name="l468"></a> disp+=4;
|
|
<a name="l469"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg2==</span><span class=cF3>ARGT_IMM64</span><span class=cF0> || reloced_arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>)
|
|
<a name="l470"></a> disp+=8;
|
|
<a name="l471"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l472"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"[%X]"</span><span class=cF0>,disp);
|
|
<a name="l473"></a> RM1=-1;
|
|
<a name="l474"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (Mod<3) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l476"></a> </span><span class=cF1>if</span><span class=cF0> (RM1&7==4) {
|
|
<a name="l477"></a> RM1=-1;
|
|
<a name="l478"></a> r1=SIB & 7+REX_b;
|
|
<a name="l479"></a> r2=SIB>>3 & 7+REX_x;
|
|
<a name="l480"></a> scale=SIB>>6 &3;
|
|
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (scale==3)
|
|
<a name="l482"></a> scale=8;
|
|
<a name="l483"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (scale==2)
|
|
<a name="l484"></a> scale=4;
|
|
<a name="l485"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (scale==1)
|
|
<a name="l486"></a> scale=2;
|
|
<a name="l487"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l488"></a> scale=1;
|
|
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==64)
|
|
<a name="l490"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l491"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l492"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l493"></a> </span><span class=cF1>if</span><span class=cF0> (r1==</span><span class=cF3>REG_RBP</span><span class=cF0> && !Mod) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l494"></a> disp=*rip(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l495"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"%08X[%Z*%d]"</span><span class=cF0>,disp,r2,ptr,scale);
|
|
<a name="l496"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (r2==4)
|
|
<a name="l497"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"[%Z]"</span><span class=cF0>,r1,ptr);
|
|
<a name="l498"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l499"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"[%Z+%Z*%d]"</span><span class=cF0>,r1,ptr,r2,ptr,scale);
|
|
<a name="l500"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (opadd==16)
|
|
<a name="l502"></a> ptr=</span><span class=cF6>"ST_U16_REGS"</span><span class=cF0>;
|
|
<a name="l503"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (opadd==32)
|
|
<a name="l504"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l505"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l506"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l507"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF6>"[%Z]"</span><span class=cF0>,RM1,ptr);
|
|
<a name="l508"></a> }
|
|
<a name="l509"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l510"></a> ptr=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l511"></a> </span><span class=cF1>if</span><span class=cF0> (reloced_arg1_size==8) {
|
|
<a name="l512"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>REX</span><span class=cF0>!=-1)
|
|
<a name="l513"></a> ptr=</span><span class=cF6>"ST_U8_REX_REGS"</span><span class=cF0>;
|
|
<a name="l514"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l515"></a> ptr=</span><span class=cF6>"ST_U8_REGS"</span><span class=cF0>;
|
|
<a name="l516"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg1_size==16)
|
|
<a name="l517"></a> ptr=</span><span class=cF6>"ST_U16_REGS"</span><span class=cF0>;
|
|
<a name="l518"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg1_size==32)
|
|
<a name="l519"></a> ptr=</span><span class=cF6>"ST_U32_REGS"</span><span class=cF0>;
|
|
<a name="l520"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (reloced_arg1_size==64)
|
|
<a name="l521"></a> ptr=</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>;
|
|
<a name="l522"></a> </span><span class=cF1>if</span><span class=cF0> (ptr)
|
|
<a name="l523"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(reloced_arg1_st,</span><span class=cF5>DefineSub</span><span class=cF7>(</span><span class=cF0>RM1,ptr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l524"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l525"></a> }
|
|
<a name="l526"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l527"></a>
|
|
<a name="l528"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l529"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM8</span><span class=cF0>:
|
|
<a name="l530"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM8</span><span class=cF0>:
|
|
<a name="l531"></a> imm=*rip(</span><span class=cF1>U8</span><span class=cF0> *)++;
|
|
<a name="l532"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%02X"</span><span class=cF0>,imm);
|
|
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->opcode[0]==0xCD && </span><span class=cF7>(</span><span class=cF0>ptr=</span><span class=cF5>DefineSub</span><span class=cF0>(imm,</span><span class=cF6>"ST_INT_NAMES"</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l534"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>" %s"</span><span class=cF0>,ptr);
|
|
<a name="l535"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l536"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM16</span><span class=cF0>:
|
|
<a name="l537"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM16</span><span class=cF0>:
|
|
<a name="l538"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%04X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l539"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l540"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM32</span><span class=cF0>:
|
|
<a name="l541"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM32</span><span class=cF0>:
|
|
<a name="l542"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%08X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>U32</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l543"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l544"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM64</span><span class=cF0>:
|
|
<a name="l545"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM64</span><span class=cF0>:
|
|
<a name="l546"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%016X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l547"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l548"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l549"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_REL8</span><span class=cF0>:
|
|
<a name="l550"></a> disp=*rip(</span><span class=cF1>I8</span><span class=cF0> *)++;
|
|
<a name="l551"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l552"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_REL16</span><span class=cF0>:
|
|
<a name="l553"></a> disp=*rip(</span><span class=cF9>I16</span><span class=cF0> *)++;
|
|
<a name="l554"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l555"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_REL32</span><span class=cF0>:
|
|
<a name="l556"></a> disp=*rip(</span><span class=cF9>I32</span><span class=cF0> *)++;
|
|
<a name="l557"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l558"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l559"></a> disp+=rip;
|
|
<a name="l560"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsDbgMode</span><span class=cF0>)
|
|
<a name="l561"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%p "</span><span class=cF0>,disp);
|
|
<a name="l562"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PutSrcLink</span><span class=cF7>(</span><span class=cF0>disp,512,buf2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l563"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%s "</span><span class=cF0>,buf2);
|
|
<a name="l564"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l565"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%P "</span><span class=cF0>,disp);
|
|
<a name="l566"></a> </span><span class=cF1>if</span><span class=cF0> (_jmp_dst) *_jmp_dst=disp;
|
|
<a name="l567"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l568"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_MOFFS8</span><span class=cF0>...</span><span class=cF3>ARGT_MOFFS64</span><span class=cF0>:
|
|
<a name="l569"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,seg_overrides);
|
|
<a name="l570"></a> </span><span class=cF1>if</span><span class=cF0> (arg1_size==8)
|
|
<a name="l571"></a> disp=*rip(</span><span class=cF1>U8</span><span class=cF0> *)++;
|
|
<a name="l572"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (opadd==16)
|
|
<a name="l573"></a> disp=*rip(</span><span class=cF9>U16</span><span class=cF0> *)++;
|
|
<a name="l574"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l575"></a> disp=*rip(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l576"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"[%X]"</span><span class=cF0>,disp);
|
|
<a name="l577"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l578"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_AL</span><span class=cF0> ... </span><span class=cF3>ARGT_DX</span><span class=cF0>:
|
|
<a name="l579"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_SS</span><span class=cF0> ... </span><span class=cF3>ARGT_ST0</span><span class=cF0>:
|
|
<a name="l580"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%z"</span><span class=cF0>,arg1-</span><span class=cF3>ARGT_AL</span><span class=cF0>,
|
|
<a name="l581"></a> </span><span class=cF6>"AL\0AX\0EAX\0RAX\0CL\0DX\0 \0 \0SS\0DS\0ES\0FS\0GS\0CS\0ST0\0"</span><span class=cF0>);
|
|
<a name="l582"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l583"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_STI</span><span class=cF0>:
|
|
<a name="l584"></a> rip--;
|
|
<a name="l585"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg1_st,</span><span class=cF6>"%Z"</span><span class=cF0>,*rip++ - tmpins->opcode[tmpins->opcode_cnt-1],
|
|
<a name="l586"></a> </span><span class=cF6>"ST_FSTK_REGS"</span><span class=cF0>);
|
|
<a name="l587"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l588"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l589"></a>
|
|
<a name="l590"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l591"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM8</span><span class=cF0>:
|
|
<a name="l592"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM8</span><span class=cF0>:
|
|
<a name="l593"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%02X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l594"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l595"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM16</span><span class=cF0>:
|
|
<a name="l596"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM16</span><span class=cF0>:
|
|
<a name="l597"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%04X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>U16</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l598"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l599"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM32</span><span class=cF0>:
|
|
<a name="l600"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM32</span><span class=cF0>:
|
|
<a name="l601"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%08X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>U32</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l602"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l603"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_IMM64</span><span class=cF0>:
|
|
<a name="l604"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_UIMM64</span><span class=cF0>:
|
|
<a name="l605"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%016X"</span><span class=cF0>,*rip</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>++);
|
|
<a name="l606"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l607"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_MOFFS8</span><span class=cF0>...</span><span class=cF3>ARGT_MOFFS64</span><span class=cF0>:
|
|
<a name="l608"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,seg_overrides);
|
|
<a name="l609"></a> </span><span class=cF1>if</span><span class=cF0> (arg2_size==8)
|
|
<a name="l610"></a> disp=*rip(</span><span class=cF1>U8</span><span class=cF0> *)++;
|
|
<a name="l611"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (opadd==16)
|
|
<a name="l612"></a> disp=*rip(</span><span class=cF9>U16</span><span class=cF0> *)++;
|
|
<a name="l613"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l614"></a> disp=*rip(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l615"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"[%X]"</span><span class=cF0>,disp);
|
|
<a name="l616"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l617"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_AL</span><span class=cF0> ... </span><span class=cF3>ARGT_DX</span><span class=cF0>:
|
|
<a name="l618"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_SS</span><span class=cF0> ... </span><span class=cF3>ARGT_ST0</span><span class=cF0>:
|
|
<a name="l619"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%z"</span><span class=cF0>,arg2-</span><span class=cF3>ARGT_AL</span><span class=cF0>,
|
|
<a name="l620"></a> </span><span class=cF6>"AL\0AX\0EAX\0RAX\0CL\0DX\0 \0 \0SS\0DS\0ES\0FS\0GS\0CS\0ST0\0"</span><span class=cF0>);
|
|
<a name="l621"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l622"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>ARGT_STI</span><span class=cF0>:
|
|
<a name="l623"></a> rip--;
|
|
<a name="l624"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(arg2_st,</span><span class=cF6>"%Z"</span><span class=cF0>,*rip++ -tmpins->opcode[tmpins->opcode_cnt-1],
|
|
<a name="l625"></a> </span><span class=cF6>"ST_FSTK_REGS"</span><span class=cF0>);
|
|
<a name="l626"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l627"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l628"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags&</span><span class=cF3>IEF_ENDING_ZERO</span><span class=cF0>)
|
|
<a name="l629"></a> rip++;
|
|
<a name="l630"></a>
|
|
<a name="l631"></a> </span><span class=cF1>if</span><span class=cF0> (*arg1_st)
|
|
<a name="l632"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>"\t%s"</span><span class=cF0>,arg1_st);
|
|
<a name="l633"></a> </span><span class=cF1>if</span><span class=cF0> (*arg2_st)
|
|
<a name="l634"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>",%s"</span><span class=cF0>,arg2_st);
|
|
<a name="l635"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line1,</span><span class=cF6>"\n"</span><span class=cF0>);
|
|
<a name="l636"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(line2,</span><span class=cF6>"\n"</span><span class=cF0>);
|
|
<a name="l637"></a> </span><span class=cF1>if</span><span class=cF0> (!just_ins) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l638"></a> </span><span class=cF1>for</span><span class=cF0> (i=rip-</span><span class=cF7>(</span><span class=cF0>*_rip</span><span class=cF7>)(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>;i<6;i++) {
|
|
<a name="l639"></a> bin_data_area1[i<<1]=</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
|
<a name="l640"></a> bin_data_area1[i<<1+1]=</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
|
<a name="l641"></a> }
|
|
<a name="l642"></a> </span><span class=cF1>for</span><span class=cF0> (i=rip-</span><span class=cF7>(</span><span class=cF0>*_rip</span><span class=cF7>)(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>;i<12;i++) {
|
|
<a name="l643"></a> bin_data_area2[(i-6)<<1]=</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
|
<a name="l644"></a> bin_data_area2[(i-6)<<1+1]=</span><span class=cF3>CH_SPACE</span><span class=cF0>;
|
|
<a name="l645"></a> }
|
|
<a name="l646"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l647"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(buf,line1);
|
|
<a name="l648"></a> </span><span class=cF1>if</span><span class=cF0> (!just_ins && rip-</span><span class=cF7>(</span><span class=cF0>*_rip</span><span class=cF7>)(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>>6)
|
|
<a name="l649"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,line2);
|
|
<a name="l650"></a> *_rip=rip;
|
|
<a name="l651"></a>}
|
|
<a name="l652"></a>
|
|
<a name="l653"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>U</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *rip,</span><span class=cF9>I64</span><span class=cF0> cnt=20,</span><span class=cF9>I64</span><span class=cF0> seg_size=64)
|
|
<a name="l654"></a>{</span><span class=cF2>//Unassembles a num of insts.</span><span class=cF0>
|
|
<a name="l655"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l656"></a> </span><span class=cF1>U8</span><span class=cF0> buf[1024];
|
|
<a name="l657"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==16)
|
|
<a name="l658"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"16-bit unassembly is not well supported.\n"</span><span class=cF0>);
|
|
<a name="l659"></a> </span><span class=cF6>"$HL,1$"</span><span class=cF0>;
|
|
<a name="l660"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<cnt;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l661"></a> </span><span class=cF5>Ui</span><span class=cF0>(buf,&rip,seg_size);
|
|
<a name="l662"></a> </span><span class=cF6>"%s"</span><span class=cF0>,buf;
|
|
<a name="l663"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l664"></a> </span><span class=cF6>"$HL,0$"</span><span class=cF0>;
|
|
<a name="l665"></a> </span><span class=cF1>return</span><span class=cF0> rip;
|
|
<a name="l666"></a>}
|
|
<a name="l667"></a>
|
|
<a name="l668"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Un</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *rip,</span><span class=cF9>I64</span><span class=cF0> cnt=0x80,</span><span class=cF9>I64</span><span class=cF0> seg_size=64)
|
|
<a name="l669"></a>{</span><span class=cF2>//Unassembles a num of bytes</span><span class=cF0>
|
|
<a name="l670"></a> </span><span class=cF9>I64</span><span class=cF0> i=0;
|
|
<a name="l671"></a> </span><span class=cF1>U8</span><span class=cF0> buf[1024],*end_rip=rip(</span><span class=cF9>I64</span><span class=cF0>)+cnt;
|
|
<a name="l672"></a> </span><span class=cF1>if</span><span class=cF0> (seg_size==16)
|
|
<a name="l673"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"16-bit unassembly is not well supported.\n"</span><span class=cF0>);
|
|
<a name="l674"></a> </span><span class=cF6>"$HL,1$"</span><span class=cF0>;
|
|
<a name="l675"></a> </span><span class=cF1>while</span><span class=cF0> (rip<end_rip) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l676"></a> </span><span class=cF5>Ui</span><span class=cF0>(buf,&rip,seg_size);
|
|
<a name="l677"></a> </span><span class=cF6>"%s"</span><span class=cF0>,buf;
|
|
<a name="l678"></a> i++;
|
|
<a name="l679"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l680"></a> </span><span class=cF6>"$HL,0$"</span><span class=cF0>;
|
|
<a name="l681"></a> </span><span class=cF1>return</span><span class=cF0> i;
|
|
<a name="l682"></a>}
|
|
</span></pre></body>
|
|
</html>
|