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 X86Instruction Disassemble32(params byte[] bytes) { var img = new LoadedImage(Address.Ptr32(0x10000), bytes); var rdr = img.CreateLeReader(img.BaseAddress); var dasm = new X86Disassembler(ProcessorMode.Protected32, rdr, PrimitiveType.Word32, PrimitiveType.Word32, false); return dasm.First(); }
private X86Instruction Disassemble16(params byte[] bytes) { MemoryArea img = new MemoryArea(Address.SegPtr(0xC00, 0), bytes); ImageReader rdr = img.CreateLeReader(img.BaseAddress); var dasm = new X86Disassembler(ProcessorMode.Real, rdr, PrimitiveType.Word16, PrimitiveType.Word16, false); if (options != null) { dasm.Emulate8087 = options.Emulate8087; } return dasm.First(); }
private X86Instruction Disassemble64(params byte[] bytes) { var img = new MemoryArea(Address.Ptr64(0x10000), bytes); var rdr = img.CreateLeReader(img.BaseAddress); var dasm = new X86Disassembler( ProcessorMode.Protected64, rdr, PrimitiveType.Word32, PrimitiveType.Word64, true); return dasm.First(); }
public void AsConstantStore() { Address addr = Address.SegPtr(0x0C00, 0); var program = asm.AssembleFragment(addr, "mov [0x400],0x1234\n"); var dasm = new X86Disassembler( ProcessorMode.Real, program.Image.CreateLeReader(addr), PrimitiveType.Word16, PrimitiveType.Word16, false); Assert.AreEqual("mov\tword ptr [0400],1234", dasm.First().ToString()); }
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( ProcessorMode.Protected32, rdr, PrimitiveType.Word32, PrimitiveType.Word32, false); X86Instruction instr = dasm.First(); Assert.AreEqual("mov\teax,12345678", instr.ToString()); Assert.AreEqual("ptr32", instr.op2.Width.ToString()); }