예제 #1
0
파일: I386.1.32.cs 프로젝트: 7shi/LLPML
 public static OpCode FromName1(string op, Reg32 op1)
 {
     switch (op)
     {
         case "push":
             return OpCode.NewBytes(Util.GetBytes1((byte)(0x50 + op1)));
         case "pop":
             return OpCode.NewBytes(Util.GetBytes1((byte)(0x58 + op1)));
         case "inc":
             return OpCode.NewBytes(Util.GetBytes1((byte)(0x40 + op1)));
         case "dec":
             return OpCode.NewBytes(Util.GetBytes1((byte)(0x48 + op1)));
         case "not":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xd0 + op1)));
         case "neg":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xd8 + op1)));
         case "mul":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xe0 + op1)));
         case "imul":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xe8 + op1)));
         case "div":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xf0 + op1)));
         case "idiv":
             return OpCode.NewBytes(Util.GetBytes2(0xf7, (byte)(0xf8 + op1)));
         default:
             throw new Exception("invalid operator: " + op);
     }
 }
예제 #2
0
파일: I386.1.32.cs 프로젝트: bencz/CoffLib
 public static OpCode FromName(string op, Reg32 op1)
 {
     switch (op)
     {
         case "push":
             return new OpCode(new byte[] { (byte)(0x50 + op1) });
         case "pop":
             return new OpCode(new byte[] { (byte)(0x58 + op1) });
         case "inc":
             return new OpCode(new byte[] { (byte)(0x40 + op1) });
         case "dec":
             return new OpCode(new byte[] { (byte)(0x48 + op1) });
         case "not":
             return new OpCode(new byte[] { 0xf7, (byte)(0xd0 + op1) });
         case "neg":
             return new OpCode(new byte[] { 0xf7, (byte)(0xd8 + op1) });
         case "mul":
             return new OpCode(new byte[] { 0xf7, (byte)(0xe0 + op1) });
         case "imul":
             return new OpCode(new byte[] { 0xf7, (byte)(0xe8 + op1) });
         case "div":
             return new OpCode(new byte[] { 0xf7, (byte)(0xf0 + op1) });
         case "idiv":
             return new OpCode(new byte[] { 0xf7, (byte)(0xf8 + op1) });
         default:
             throw new Exception("invalid operator: " + op);
     }
 }
예제 #3
0
파일: I386.Call.cs 프로젝트: 7shi/LLPML
 // Call
 public static OpCode Call(Reg32 op1)
 {
     switch (op1)
     {
         case Reg32.EAX:
             return OpCode.NewBytes(Util.GetBytes2(0xff, 0xd0));
     }
     throw new Exception("The method or operation is not implemented.");
 }
예제 #4
0
파일: I386.Call.cs 프로젝트: bencz/CoffLib
 // Call
 public static OpCode Call(Reg32 op1)
 {
     switch (op1)
     {
         case Reg32.EAX:
             return new OpCode(new byte[] { 0xff, 0xd0 });
     }
     throw new Exception("The method or operation is not implemented.");
 }
예제 #5
0
파일: SSE2.cs 프로젝트: bencz/CoffLib
 public static OpCode FromName(string op, Reg32 op1, Xmm op2)
 {
     byte b;
     switch (op)
     {
         case "movd":
             b = 0x7e;
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     return new OpCode(new byte[] { 0x66, 0x0f, b, (byte)(0xc0 + (((int)op2) << 3) + op1) });
 }
예제 #6
0
파일: I386.Movx.16.cs 프로젝트: 7shi/LLPML
 public static OpCode FromNameWA(string op, Reg32 op1, Addr32 op2)
 {
     byte b;
     switch (op)
     {
         case "movzx":
             b = 0xb7;
             break;
         case "movsx":
             b = 0xbf;
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     return OpCode.NewA(Util.GetBytes2(0x0f, b), Addr32.NewAdM(op2, (byte)op1));
 }
예제 #7
0
파일: I386.Movx.16.cs 프로젝트: 7shi/LLPML
 public static OpCode FromNameW(string op, Reg32 op1, Reg16 op2)
 {
     byte b;
     switch (op)
     {
         case "movzx":
             b = 0xb7;
             break;
         case "movsx":
             b = 0xbf;
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     return OpCode.NewBytes(Util.GetBytes3(0x0f, b, (byte)(0xc0 + (((int)op1) << 3) + op2)));
 }
예제 #8
0
 public static OpCode FromNameW(string op, Reg32 op1, Addr32 op2)
 {
     byte b;
     switch (op)
     {
         case "movzx":
             b = 0xb7;
             break;
         case "movsx":
             b = 0xbf;
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     return new OpCode(new byte[] { 0x0f, b }, null, new Addr32(op2, (byte)op1));
 }
예제 #9
0
 public static OpCode Shift(string op, Reg32 op1, Reg8 op2)
 {
     byte b;
     switch (op)
     {
         case "shl":
         case "sal":
             b = (byte)(0xe0 + op1);
             break;
         case "shr":
             b = (byte)(0xe8 + op1);
             break;
         case "sar":
             b = (byte)(0xf8 + op1);
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     if (op2 != Reg8.CL)
         throw new Exception("invalid register: " + op2);
     else
         return new OpCode(new byte[] { 0xd3, b });
 }
예제 #10
0
파일: I386.Shift.32.cs 프로젝트: 7shi/LLPML
 public static OpCode Shift(string op, Reg32 op1, byte op2)
 {
     byte b;
     switch (op)
     {
         case "shl":
         case "sal":
             b = (byte)(0xe0 + op1);
             break;
         case "shr":
             b = (byte)(0xe8 + op1);
             break;
         case "sar":
             b = (byte)(0xf8 + op1);
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     if (op2 == 1)
         return OpCode.NewBytes(Util.GetBytes2(0xd1, b));
     else
         return OpCode.NewB(Util.GetBytes2(0xc1, b), op2);
 }
예제 #11
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode Xchg(Reg32 op1, Reg32 op2)
 {
     return FromName2("xchg", op1, op2);
 }
예제 #12
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode XchgAR(Addr32 op1, Reg32 op2)
 {
     return XchgRA(op2, op1);
 }
예제 #13
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode TestRA(Reg32 op1, Addr32 op2)
 {
     return TestAR(op2, op1);
 }
예제 #14
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode Cmp(Reg32 op1, Reg32 op2)
 {
     return FromName2("cmp", op1, op2);
 }
예제 #15
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode AndR(Reg32 op1, Val32 op2)
 {
     return FromName2R("and", op1, op2);
 }
예제 #16
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode And(Reg32 op1, Reg32 op2)
 {
     return FromName2("and", op1, op2);
 }
예제 #17
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode XorR(Reg32 op1, Val32 op2)
 {
     return FromName2R("xor", op1, op2);
 }
예제 #18
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode Xor(Reg32 op1, Reg32 op2)
 {
     return FromName2("xor", op1, op2);
 }
예제 #19
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode XchgRA(Reg32 op1, Addr32 op2)
 {
     return FromName2RA("xchg", op1, op2);
 }
예제 #20
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode SubAR(Addr32 op1, Reg32 op2)
 {
     return FromName2AR("sub", op1, op2);
 }
예제 #21
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode XorAR(Addr32 op1, Reg32 op2)
 {
     return FromName2AR("xor", op1, op2);
 }
예제 #22
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode SubR(Reg32 op1, Val32 op2)
 {
     return FromName2R("sub", op1, op2);
 }
예제 #23
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode XorRA(Reg32 op1, Addr32 op2)
 {
     return FromName2RA("xor", op1, op2);
 }
예제 #24
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode SubRA(Reg32 op1, Addr32 op2)
 {
     return FromName2RA("sub", op1, op2);
 }
예제 #25
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode AndAR(Addr32 op1, Reg32 op2)
 {
     return FromName2AR("and", op1, op2);
 }
예제 #26
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode Test(Reg32 op1, Reg32 op2)
 {
     return FromName2("test", op1, op2);
 }
예제 #27
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode AndRA(Reg32 op1, Addr32 op2)
 {
     return FromName2RA("and", op1, op2);
 }
예제 #28
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode TestAR(Addr32 op1, Reg32 op2)
 {
     return FromName2AR("test", op1, op2);
 }
예제 #29
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode CmpAR(Addr32 op1, Reg32 op2)
 {
     return FromName2AR("cmp", op1, op2);
 }
예제 #30
0
파일: I386.2.32.cs 프로젝트: 7shi/LLPML
 public static OpCode TestR(Reg32 op1, Val32 op2)
 {
     return FromName2R("test", op1, op2);
 }