本文整理汇总了C#中Reko.Core.MemoryArea.CreateLeReader方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryArea.CreateLeReader方法的具体用法?C# MemoryArea.CreateLeReader怎么用?C# MemoryArea.CreateLeReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reko.Core.MemoryArea
的用法示例。
在下文中一共展示了MemoryArea.CreateLeReader方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Disassemble32
private X86Instruction Disassemble32(params byte[] bytes)
{
var img = new MemoryArea(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();
}
示例2: RunTest
private void RunTest(string sExp, params byte[] bytes)
{
var image = new MemoryArea(Address.Ptr32(0x0100000), bytes);
var dasm = new CilDisassembler(image.CreateLeReader(0)).GetEnumerator();
Assert.IsTrue(dasm.MoveNext());
var instr = dasm.Current;
Assert.AreEqual(sExp, instr.ToString());
}
示例3: Disassemble16
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();
}
示例4: DisassembleBits
protected MachineInstruction DisassembleBits(string bitPattern)
{
var image = new MemoryArea(Address.Ptr32(0x00100000), new byte[4]);
LeImageWriter w = new LeImageWriter(image.Bytes);
uint instr = ParseBitPattern(bitPattern);
w.WriteLeUInt32(0, instr);
var b = image.Bytes;
//Debug.Print("Instruction bytes: {0:X2} {1:X2} {2:X2} {3:X2}", b[0], b[1], b[2], b[3]); // Spews in the unit tests
var arch = CreateArchitecture();
var dasm = arch.CreateDisassembler(image.CreateLeReader(0));
return dasm.First();
}
示例5: Disassemble32
protected MachineInstruction Disassemble32(uint instr)
{
var image = new MemoryArea(Address.Ptr32(0x00100000), new byte[4]);
LeImageWriter w = new LeImageWriter(image.Bytes);
w.WriteLeUInt32(0, instr);
var arch = CreateArchitecture();
var dasm = CreateDisassembler(arch, image.CreateLeReader(0));
Assert.IsTrue(dasm.MoveNext());
var armInstr = dasm.Current;
dasm.Dispose();
return armInstr;
}
示例6: RewriteCode
protected override MemoryArea RewriteCode(uint[] words)
{
byte[] bytes = words.SelectMany(w => new byte[]
{
(byte) w,
(byte) (w >> 8),
(byte) (w >> 16),
(byte) (w >> 24)
}).ToArray();
this.image = new MemoryArea(LoadAddress, bytes);
var dasm = new XtensaDisassembler(arch, image.CreateLeReader(LoadAddress));
return image;
}
示例7: ThumbRw_regression
//[Test]
public void ThumbRw_regression()
{
var code = ThumbBlock
.Replace("\r\n", "\n")
.Split('\n')
.Select(s => s.Trim())
.Where(s => !string.IsNullOrEmpty(s))
.SelectMany(s =>
{
var ss = s.Split(':')[1]
.Trim()
.Remove(9)
.Replace(" ", "");
return ss.Length == 8
? new[] { ss.Substring(0, 4), ss.Substring(4, 4) }
: new[] { ss.Substring(0, 4) };
})
.Select(s => Convert.ToUInt16(s, 16))
.SelectMany(s => new byte[] {
(byte) s,
(byte) (s >> 8)
})
.ToArray();
var image = new MemoryArea(Address.Ptr32(0x00401000), code);
var rw = new ThumbRewriter(arch, image.CreateLeReader(0), new ArmProcessorState(arch), arch.CreateFrame(), new FakeRewriterHost());
{
foreach (var rtc in rw)
{
Console.WriteLine(rtc.Address);
foreach (var rtl in rtc.Instructions)
{
Console.WriteLine(" {0}", rtl);
}
}
}
}
示例8: Disassemble
protected static Arm32Instruction Disassemble(byte[] bytes)
{
var image = new MemoryArea(Address.Ptr32(0x00100000), bytes);
var dasm = new Arm32Disassembler(new Arm32ProcessorArchitecture(), image.CreateLeReader(0));
return dasm.First();
}
示例9: CreateDisassembler16
private void CreateDisassembler16(MemoryArea mem)
{
dasm = new X86Disassembler(
ProcessorMode.Real,
mem.CreateLeReader(mem.BaseAddress),
PrimitiveType.Word16,
PrimitiveType.Word16,
false);
if (options != null)
{
dasm.Emulate8087 = options.Emulate8087;
}
}
示例10: X86Dis_RelocatedSegment
public void X86Dis_RelocatedSegment()
{
byte[] image = new byte[] { 0x2E, 0xC7, 0x06, 0x01, 0x00, 0x00, 0x08 }; // mov cs:[0001],0800
MemoryArea img = new MemoryArea(Address.SegPtr(0x900, 0), image);
img.Relocations.AddSegmentReference(5, 0x0800);
ImageReader rdr = img.CreateLeReader(img.BaseAddress);
CreateDisassembler16(rdr);
X86Instruction instr = dasm.First();
Assert.AreEqual("mov\tword ptr cs:[0001],0800", instr.ToString());
Assert.AreEqual("selector", instr.op2.Width.ToString());
}
示例11: X86Dis_RelocatedOperand
public void X86Dis_RelocatedOperand()
{
byte[] image = new byte[] { 0xB8, 0x78, 0x56, 0x34, 0x12 }; // mov eax,0x12345678
MemoryArea img = new MemoryArea(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());
}
示例12: CreateDisassembler32
private void CreateDisassembler32(MemoryArea image)
{
dasm = new X86Disassembler(
ProcessorMode.Protected32,
image.CreateLeReader(image.BaseAddress),
PrimitiveType.Word32,
PrimitiveType.Word32,
false);
}