Exemplo n.º 1
0
        static Registers()
        {
            eax = new Intel32AccRegister("eax", 0, 8, 16, 20);
            ecx = new Intel32AccRegister("ecx", 1, 9, 17, 21);
            edx = new Intel32AccRegister("edx", 2, 10, 18, 22);
            ebx = new Intel32AccRegister("ebx", 3, 11, 19, 23);
            esp = new Intel32Register("esp", 4, 12, -1, -1);
            ebp = new Intel32Register("ebp", 5, 13, -1, -1);
            esi = new Intel32Register("esi", 6, 14, -1, -1);
            edi = new Intel32Register("edi", 7, 15, -1, -1);
            ax = new Intel16AccRegister("ax", 8, 0, 16, 20);
            cx = new Intel16AccRegister("cx", 9, 1, 17, 21);
            dx = new Intel16AccRegister("dx", 10, 2, 18, 22);
            bx = new Intel16AccRegister("bx", 11, 3, 19, 23);
            sp = new Intel16Register("sp", 12, 4, -1, -1);
            bp = new Intel16Register("bp", 13, 5, -1, -1);
            si = new Intel16Register("si", 14, 6, -1, -1);
            di = new Intel16Register("di", 15, 7, -1, -1);
            al = new IntelLoByteRegister("al", 16, 0, 8, 16, 20);
            cl = new IntelLoByteRegister("cl", 17, 1, 9, 17, 21);
            dl = new IntelLoByteRegister("dl", 18, 2, 10, 18, 22);
            bl = new IntelLoByteRegister("bl", 19, 3, 11, 19, 23);
            ah = new IntelHiByteRegister("ah", 20, 0, 8, 16, 20);
            ch = new IntelHiByteRegister("ch", 21, 1, 9, 17, 21);
            dh = new IntelHiByteRegister("dh", 22, 2, 10, 18, 22);
            bh = new IntelHiByteRegister("bh", 23, 3, 11, 19, 23);
            es = new SegmentRegister("es", 24);
            cs = new SegmentRegister("cs", 25);
            ss = new SegmentRegister("ss", 26);
            ds = new SegmentRegister("ds", 27);
            fs = new SegmentRegister("fs", 28);
            gs = new SegmentRegister("gs", 29);
            S = new FlagRegister("S", 32);
            C = new FlagRegister("C", 33);
            Z = new FlagRegister("Z", 34);
            D = new FlagRegister("D", 35);
            O = new FlagRegister("O", 36);
            P = new FlagRegister("P", 37);
            FPUF = new RegisterStorage("FPUF", 38, PrimitiveType.Byte);
            FPST = new RegisterStorage("FPST", 38, PrimitiveType.Byte); 

            rax = new Intel64AccRegister("rax", 0, 0, 8, 16, 20);
            rcx = new Intel64AccRegister("rcx", 1, 1, 9, 17, 21);
            rdx = new Intel64AccRegister("rdx", 2, 2, 10, 18, 22);
            rbx = new Intel64AccRegister("rbx", 3, 3, 11, 19, 23);
            rsp = new Intel64Register("rsp", 4, 12, -1, -1);
            rbp = new Intel64Register("rbp",  5, 13, -1, -1);
            rsi = new Intel64Register("rsi",  6, 14, -1, -1);
            rdi = new Intel64Register("rdi",  7, 15, -1, -1);
            r8 = new Intel64Register("r8",  8, 12, -1, -1);
            r9 = new Intel64Register("r9", 9, 13, -1, -1);
            r10 = new Intel64Register("r10", 10, 14, -1, -1);
            r11 = new Intel64Register("r11", 11, 15, -1, -1);
            r12 = new Intel64Register("r12", 12, 15, -1, -1);
            r13 = new Intel64Register("r13", 13, 15, -1, -1);
            r14 = new Intel64Register("r14", 14, 15, -1, -1);
            r15 = new Intel64Register("r15", 15, 15, -1, -1);
            r8d = new Intel64Register("r8d", 8, 12, -1, -1);
            r9d = new Intel64Register("r9d", 9, 13, -1, -1);
            r10d = new Intel64Register("r10d", 10, 14, -1, -1);
            r11d = new Intel64Register("r11d", 11, 15, -1, -1);
            r12d = new Intel64Register("r12d", 12, 15, -1, -1);
            r13d = new Intel64Register("r13d", 13, 15, -1, -1);
            r14d = new Intel64Register("r14d", 14, 15, -1, -1);
            r15d = new Intel64Register("r15d", 15, 15, -1, -1);
            r8w = new Intel32Register("r8w", 8, 12, -1, -1);
            r9w = new Intel32Register("r9w", 9, 13, -1, -1);
            r10w = new Intel32Register("r10w", 10, 14, -1, -1);
            r11w = new Intel32Register("r11w", 11, 15, -1, -1);
            r12w = new Intel32Register("r12w", 12, 15, -1, -1);
            r13w = new Intel32Register("r13w", 13, 15, -1, -1);
            r14w = new Intel32Register("r14w", 14, 15, -1, -1);
            r15w = new Intel32Register("r15w", 15, 15, -1, -1);

            spl = new IntelLoByteRegister("spl", 8, 4, 12, -1, -1);
            bpl = new IntelLoByteRegister("bpl", 9, 5, 13, -1, -1);
            sil = new IntelLoByteRegister("sil", 8, 6, 14, -1, -1);
            dil = new IntelLoByteRegister("dil", 9, 7, 15, -1, -1);

            r8b = new IntelLoByteRegister("r8b", 8, 12, -1, -1, -1);
            r9b = new IntelLoByteRegister("r9b", 9, 13, -1, -1, -1);
            r10b = new IntelLoByteRegister("r10b", 10, 14, -1, -1, -1);
            r11b = new IntelLoByteRegister("r11b", 11, 15, -1, -1, -1);
            r12b = new IntelLoByteRegister("r12b", 12, 15, -1, -1, -1);
            r13b = new IntelLoByteRegister("r13b", 13, 15, -1, -1, -1);
            r14b = new IntelLoByteRegister("r14b", 14, 15, -1, -1, -1);
            r15b = new IntelLoByteRegister("r15b", 15, 15, -1, -1, -1);

            mm0 = new  RegisterStorage("mm0", 0, PrimitiveType.Word64);
            mm1 = new  RegisterStorage("mm1", 1, PrimitiveType.Word64);
            mm2 = new  RegisterStorage("mm2", 2, PrimitiveType.Word64);
            mm3 = new  RegisterStorage("mm3", 3, PrimitiveType.Word64);
            mm4 = new  RegisterStorage("mm4", 4, PrimitiveType.Word64);
            mm5 = new  RegisterStorage("mm5", 5, PrimitiveType.Word64);
            mm6 = new  RegisterStorage("mm6", 6, PrimitiveType.Word64);
            mm7 = new  RegisterStorage("mm7", 7, PrimitiveType.Word64);
            mm8 = new  RegisterStorage("mm8", 8, PrimitiveType.Word64);
            mm9 = new  RegisterStorage("mm9", 9, PrimitiveType.Word64);
            mm10 = new RegisterStorage("mm10", 10, PrimitiveType.Word64);
            mm11 = new RegisterStorage("mm11", 11, PrimitiveType.Word64);
            mm12 = new RegisterStorage("mm12", 12, PrimitiveType.Word64);
            mm13 = new RegisterStorage("mm13", 13, PrimitiveType.Word64);
            mm14 = new RegisterStorage("mm14", 14, PrimitiveType.Word64);
            mm15 = new RegisterStorage("mm15", 15, PrimitiveType.Word64);
                       
            xmm0 = new RegisterStorage("xmm0", 0, PrimitiveType.Word128);
            xmm1 = new RegisterStorage("xmm1", 1, PrimitiveType.Word128);
            xmm2 = new RegisterStorage("xmm2", 2, PrimitiveType.Word128);
            xmm3 = new RegisterStorage("xmm3", 3, PrimitiveType.Word128);
            xmm4 = new RegisterStorage("xmm4", 4, PrimitiveType.Word128);
            xmm5 = new RegisterStorage("xmm5", 5, PrimitiveType.Word128);
            xmm6 = new RegisterStorage("xmm6", 6, PrimitiveType.Word128);
            xmm7 = new RegisterStorage("xmm7", 7, PrimitiveType.Word128);
            xmm8 = new RegisterStorage("xmm8", 8, PrimitiveType.Word128);
            xmm9 = new RegisterStorage("xmm9", 9, PrimitiveType.Word128);
            xmm10 = new RegisterStorage("xmm10", 10, PrimitiveType.Word128);
            xmm11 = new RegisterStorage("xmm11", 11, PrimitiveType.Word128);
            xmm12 = new RegisterStorage("xmm12", 12, PrimitiveType.Word128);
            xmm13 = new RegisterStorage("xmm13", 13, PrimitiveType.Word128);
            xmm14 = new RegisterStorage("xmm14", 14, PrimitiveType.Word128);
            xmm15 = new RegisterStorage("xmm15", 15, PrimitiveType.Word128);

            rip = new RegisterStorage("rip", 23, PrimitiveType.Pointer64);

            regs = new RegisterStorage[] {
				eax,
				ecx,
				edx,
				ebx, 
				esp,
				ebp,
				esi,
				edi,

				ax ,
				cx ,
				dx ,
				bx ,
				sp ,
				bp ,
				si ,
				di ,

                // 16
				al ,
				cl ,
				dl ,
				bl ,
				ah ,
				ch ,
				dh ,
				bh ,

				es ,
				cs ,
				ss ,
				ds ,
				fs ,
				gs ,
				null,
				null,

                // 32
				S ,
				C ,
				Z ,
				D ,

				O ,
                P,
                FPUF,
                null,

                // 40
                rax,
                rcx,
                rdx,
                rbx,
                rsp,
                rbp,
                rsi,
                rdi,
                r8,
                r9,
                r10,
                r11,
                r12,
                r13,
                r14,
                r15,
                r8d,
                r9d,
                r10d,
                r11d,
                r12d,
                r13d,
                r14d,
                r15d,

                r8w,
                r9w,
                r10w,
                r11w,
                r12w,
                r13w,
                r14w,
                r15w,

                spl,
                bpl,
                sil,
                dil,

                r8b,
                r9b,
                r10b,
                r11b,
                r12b,
                r13b,
                r14b,
                r15b,

			};
        }
Exemplo n.º 2
0
 public ParsedOperand MemW(SegmentRegister seg, RegisterStorage @base, string offset)
 {
     return Mem(PrimitiveType.Word16, seg, @base, null, 1, offset);
 }
Exemplo n.º 3
0
 private ParsedOperand Mem(
     PrimitiveType width, 
     SegmentRegister seg, 
     RegisterStorage @base,  
     RegisterStorage index, 
     int scale, 
     string offset)
 {
     int val;
     MemoryOperand mem;
     Symbol sym = null;
     if (offset != null)
     {
         if (symtab.Equates.TryGetValue(offset, out val))
         {
             mem = new MemoryOperand(width, @base, IntegralConstant(val, @base.DataType));
             sym = null;
         }
         else
         {
             sym = symtab.CreateSymbol(offset);
             val = (int)this.addrBase.Offset;
             Constant off = Constant.Create(@base == null
                 ? seg != null ? PrimitiveType.Word16 : PrimitiveType.Word32
                 : @base.DataType,
                 val);
             mem = new MemoryOperand(width, @base ?? RegisterStorage.None, off);
         }
     }
     else
     {
         mem = new MemoryOperand(width)
         {
         };
     }
     if (seg != null)
     {
         mem.SegOverride = seg;
         this.SegmentOverride = seg;
     }
     mem.Scale = (byte)scale;
     if (scale > 1)
     {
         if (index == null)
         {
             mem.Index = mem.Base;
             mem.Base = RegisterStorage.None;
         }
         else
         {
             mem.Index = index;
             mem.Base = @base;
         }
     }
     return new ParsedOperand(mem, sym);
 }
Exemplo n.º 4
0
 public ParsedOperand MemW(SegmentRegister seg, RegisterStorage @base, int offset)
 {
     var mem = new MemoryOperand(PrimitiveType.Word16);
     mem.Base = @base;
     mem.Offset = IntegralConstant(offset);
     mem.SegOverride = seg;
     return new ParsedOperand(mem);
 }