Пример #1
0
 protected internal override int GetCondCode(MCInst i)
 {
     if (i.p == null || i.p.Length < 2 ||
         i.p[1].t != Opcode.vl_cc)
     {
         return(Opcode.cc_always);
     }
     return((int)i.p[1].v);
 }
Пример #2
0
 protected internal override bool IsCall(MCInst i)
 {
     if (i.p != null && i.p.Length > 0 &&
         i.p[0].t == Opcode.vl_str &&
         (i.p[0].v == x86_call_rel32))
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
 protected internal override bool IsBranch(MCInst i)
 {
     if (i.p != null && i.p.Length > 0 &&
         i.p[0].t == Opcode.vl_str &&
         (i.p[0].v == x86_jmp_rel32 ||
          i.p[0].v == x86_jcc_rel32))
     {
         return(true);
     }
     return(false);
 }
Пример #4
0
 protected internal override int GetBranchDest(MCInst i)
 {
     if (!IsBranch(i))
     {
         throw new NotSupportedException();
     }
     if (i.p[0].v == x86_jcc_rel32)
     {
         return((int)i.p[2].v);
     }
     else
     {
         return((int)i.p[1].v);
     }
 }
Пример #5
0
        protected internal override string MCInstToDebug(MCInst i)
        {
            StringBuilder sb = new StringBuilder();

            if (insts.TryGetValue((int)i.p[0].v, out string str))
            {
                sb.Append(str);
            }
            else
            {
                sb.Append("<unknown>");
            }

            return(sb.ToString());
        }
Пример #6
0
        protected internal override MCInst RestoreRegister(Reg r)
        {
            MCInst ret = new MCInst
            {
                p = new Param[]
                {
                    new Param {
                        t = Opcode.vl_str, str = "pop", v = x86_pop_r32
                    },
                    new Param {
                        t = Opcode.vl_mreg, mreg = r
                    }
                }
            };

            return(ret);
        }
Пример #7
0
        static MCInst inst(CilNode.IRNode parent,
                           int inst,
                           Param Rn = null,
                           Param Rd = null,
                           Param Rm = null,
                           Param Rt = null,

                           int imm = 0,

                           int W = 0,
                           int S = 0,

                           Param[] register_list = null,

                           string str_target = null,

                           bool is_tls = false)
        {
            string str = null;

            insts.TryGetValue(inst, out str);

            MCInst ret = new MCInst
            {
                parent = parent,
                p      = new Param[]
                {
                    new Param {
                        t = ir.Opcode.vl_str, v = inst, str = str, v2 = is_tls ? 1 : 0
                    },
                    Rn,
                    Rd,
                    Rm,
                    Rt,
                    imm,
                    W,
                    S,
                    RegListToInt(register_list),
                    str_target
                }
            };

            return(ret);
        }
Пример #8
0
 protected internal override void SetBranchDest(MCInst i, int d)
 {
     if (!IsBranch(i))
     {
         throw new NotSupportedException();
     }
     if (i.p[0].v == x86_jcc_rel32)
     {
         i.p[2] = new Param {
             t = Opcode.vl_br_target, v = d
         }
     }
     ;
     else
     {
         i.p[1] = new Param {
             t = Opcode.vl_br_target, v = d
         }
     };
 }
Пример #9
0
 protected internal override int GetCondCode(MCInst i)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 private int Rm(MCInst i)
 {
     return(i.p[3].mreg.id);
 }
Пример #11
0
 private int W(MCInst i)
 {
     return((int)i.p[6].v);
 }
Пример #12
0
 private int Rt(MCInst i)
 {
     return(i.p[4].mreg.id);
 }
Пример #13
0
 protected internal override Reg GetMoveSrc(MCInst i)
 {
     return(i.p[2].mreg);
 }
Пример #14
0
 private int Imm(MCInst i)
 {
     return((int)i.p[5].v);
 }
Пример #15
0
 protected internal override Reg GetMoveDest(MCInst i)
 {
     throw new NotImplementedException();
 }
Пример #16
0
 protected internal override Reg GetMoveDest(MCInst i)
 {
     return(i.p[1].mreg);
 }
Пример #17
0
 private int Rd(MCInst i)
 {
     return(i.p[2].mreg.id);
 }
Пример #18
0
 private int Rlist(MCInst i)
 {
     return((int)i.p[8].v);
 }
Пример #19
0
 protected internal override void SetBranchDest(MCInst i, int d)
 {
     throw new NotImplementedException();
 }
Пример #20
0
 protected internal override int GetBranchDest(MCInst i)
 {
     throw new NotImplementedException();
 }
Пример #21
0
 private string Str(MCInst i)
 {
     return(i.p[9]?.str);
 }
Пример #22
0
 protected internal override bool IsBranch(MCInst i)
 {
     throw new NotImplementedException();
 }
Пример #23
0
 private int Rn(MCInst i)
 {
     return(i.p[1].mreg.id);
 }