private IntelInstruction Disassemble64(params byte[] bytes) { var img = new LoadedImage(Address.Ptr64(0x10000), bytes); var rdr = img.CreateLeReader(img.BaseAddress); var dasm = new X86Disassembler(rdr, PrimitiveType.Word32, PrimitiveType.Word64, true); return dasm.First(); }
private IntelInstruction Disassemble16(params byte[] bytes) { LoadedImage img = new LoadedImage(Address.SegPtr(0xC00, 0), bytes); ImageReader rdr = img.CreateLeReader(img.BaseAddress); var dasm = new X86Disassembler(rdr, PrimitiveType.Word16, PrimitiveType.Word16, false); return dasm.First(); }
private void RunTest(AssemblerFragment fragment, string sExp) { Address addrBase= Address.SegPtr(0xC00, 0); X86Assembler asm = new X86Assembler(new IntelArchitecture(ProcessorMode.Real), addrBase, new List<EntryPoint>()); fragment.Build(asm); Program lr = asm.GetImage(); X86Disassembler dasm = new X86Disassembler( lr.Image.CreateLeReader(lr.Image.BaseAddress), PrimitiveType.Word16, PrimitiveType.Word16, false); StringBuilder sb = new StringBuilder(); try { foreach (var instr in dasm) { sb.AppendFormat("{0}\t{1}", instr.Address, instr); sb.AppendLine(); } Assert.AreEqual(sExp, sb.ToString()); } catch { Console.WriteLine(sb.ToString()); throw; } }
private void CreateDisassembler32(LoadedImage image) { dasm = new X86Disassembler( image.CreateLeReader(image.BaseAddress), PrimitiveType.Word32, PrimitiveType.Word32, false); }
private FstswChainMatcher GetMatcher() { Program lr = asm.GetImage(); X86Disassembler dasm = new X86Disassembler( lr.Image.CreateLeReader(0), PrimitiveType.Word32, PrimitiveType.Word32, false); instrs = new List<IntelInstruction>(); return new FstswChainMatcher(dasm.ToArray(), orw); }
private void CreateDisassembler16(ImageReader rdr) { dasm = new X86Disassembler( rdr, PrimitiveType.Word16, PrimitiveType.Word16, false); }
public void X86Dis_RelocatedOperand() { byte[] image = new byte[] { 0xB8, 0x78, 0x56, 0x34, 0x12 }; // mov eax,0x12345678 LoadedImage img = new LoadedImage(Address.Ptr32(0x00100000), image); img.Relocations.AddPointerReference(0x00100001ul - img.BaseAddress.ToLinear(), 0x12345678); ImageReader rdr = img.CreateLeReader(img.BaseAddress); X86Disassembler dasm = new X86Disassembler(rdr, PrimitiveType.Word32, PrimitiveType.Word32, false); IntelInstruction instr = dasm.First(); Assert.AreEqual("mov\teax,12345678", instr.ToString()); Assert.AreEqual("ptr32", instr.op2.Width.ToString()); }
public virtual MachineInstruction DisassembleEx(Address addr) { var rdr = loader.Architecture.CreateImageReader(loader.Image, addr); var dasm = new X86Disassembler(rdr, PrimitiveType.Word32, PrimitiveType.Word32, false); return dasm.DisassembleInstruction(); }
public void AsConstantStore() { Address addr = Address.SegPtr(0x0C00, 0); var program = asm.AssembleFragment(addr, "mov [0x400],0x1234\n"); var dasm = new X86Disassembler( program.Image.CreateLeReader(addr), PrimitiveType.Word16, PrimitiveType.Word16, false); Assert.AreEqual("mov\tword ptr [0400],1234", dasm.First().ToString()); }