本文整理汇总了C#中Reko.Arch.X86.IntelArchitecture.CreateProcessorState方法的典型用法代码示例。如果您正苦于以下问题:C# IntelArchitecture.CreateProcessorState方法的具体用法?C# IntelArchitecture.CreateProcessorState怎么用?C# IntelArchitecture.CreateProcessorState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reko.Arch.X86.IntelArchitecture
的用法示例。
在下文中一共展示了IntelArchitecture.CreateProcessorState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MspRealModeServices
public void MspRealModeServices()
{
mr.ReplayAll();
IntelArchitecture arch = new IntelArchitecture(ProcessorMode.Real);
IPlatform platform = new MsdosPlatform(sc, arch);
var state = arch.CreateProcessorState();
state.SetRegister(Registers.ah, Constant.Byte(0x3E));
SystemService svc = platform.FindService(0x21, state);
Assert.AreEqual("msdos_close_file", svc.Name);
Assert.AreEqual(1, svc.Signature.Parameters.Length);
Assert.IsFalse(svc.Characteristics.Terminates, "close() shouldn't terminate program");
state.SetRegister(Registers.ah, Constant.Byte(0x4C));
svc = platform.FindService(0x21, state);
Assert.AreEqual("msdos_terminate", svc.Name);
Assert.AreEqual(1, svc.Signature.Parameters.Length);
Assert.IsTrue(svc.Characteristics.Terminates, "terminate() should terminate program");
state.SetRegister(Registers.ah, Constant.Byte(0x2F));
svc = platform.FindService(0x21, state);
Assert.AreEqual("msdos_get_disk_transfer_area_address", svc.Name);
Assert.AreEqual(0, svc.Signature.Parameters.Length);
SequenceStorage seq = (SequenceStorage) svc.Signature.ReturnValue.Storage;
Assert.AreEqual("es", seq.Head.Name);
Assert.AreEqual("bx", seq.Tail.Name);
}
示例2: Setup
public void Setup()
{
arch = new IntelArchitecture(ProcessorMode.Real);
var image = new LoadedImage(Address.Ptr32(0x10000), new byte[4]);
var prog = new Program(
image,
image.CreateImageMap(),
arch,
null);
var procAddress = Address.Ptr32(0x10000000);
instr = new X86Instruction(Opcode.nop, PrimitiveType.Word16, PrimitiveType.Word16)
{
Address = procAddress,
};
proc = Procedure.Create(procAddress, arch.CreateFrame());
orw = new OperandRewriter16(arch, proc.Frame, new FakeRewriterHost(prog));
state = (X86State)arch.CreateProcessorState();
}
示例3: Setup
public void Setup()
{
arch = new X86ArchitectureReal();
var mem = new MemoryArea(Address.Ptr32(0x10000), new byte[4]);
var prog = new Program(
new SegmentMap(
mem.BaseAddress,
new ImageSegment(
"code", mem, AccessMode.ReadWriteExecute)),
arch,
new DefaultPlatform(null, arch));
var procAddress = Address.Ptr32(0x10000000);
instr = new X86Instruction(Opcode.nop, PrimitiveType.Word16, PrimitiveType.Word16)
{
Address = procAddress,
};
proc = Procedure.Create(procAddress, arch.CreateFrame());
orw = new OperandRewriter16(arch, proc.Frame, new FakeRewriterHost(prog));
state = (X86State)arch.CreateProcessorState();
}
示例4: ReadCodeAddress_RealMode_SegOffset
public void ReadCodeAddress_RealMode_SegOffset()
{
arch = new IntelArchitecture(ProcessorMode.Real);
var rdr = CreateImageReader(0x78, 0x56, 0x34, 0x12);
var state = arch.CreateProcessorState();
state.SetRegister(Registers.cs, Constant.Word16(0x1111));
Address addr = arch.ReadCodeAddress(4, rdr, state);
Assert.AreEqual("1234:5678", addr.ToString());
}
示例5: BuildTest
private void BuildTest(IntelArchitecture arch, Address addr, IPlatform platform, Action<X86Assembler> m)
{
proc = new Procedure("test", arch.CreateFrame());
block = proc.AddBlock("testblock");
this.state = arch.CreateProcessorState();
var asm = new X86Assembler(sc, new DefaultPlatform(sc, arch), addr, new List<ImageSymbol>());
scanner = mr.StrictMock<IScanner>();
scanner.Stub(s => s.Services).Return(sc);
m(asm);
lr = asm.GetImage();
host = new RewriterHost(
asm.ImportReferences,
new Dictionary<string, FunctionType>
{
{
"GetDC",
new FunctionType(
new Identifier("", new Pointer(VoidType.Instance, 4), new RegisterStorage("eax", 0, 0, PrimitiveType.Word32)),
new [] {
new Identifier("arg",
new TypeReference(
"HWND",
new Pointer(VoidType.Instance, 4)),
new StackArgumentStorage(4, new TypeReference(
"HWND",
new Pointer(VoidType.Instance, 4))))
})
{
StackDelta = 4,
}
}
},
new Dictionary<string, DataType>());
var rw = arch.CreateRewriter(
lr.SegmentMap.Segments.Values.First().MemoryArea.CreateLeReader(addr),
this.state,
proc.Frame,
host);
this.program = new Program
{
Architecture = arch,
SegmentMap = lr.SegmentMap,
ImageMap = lr.ImageMap,
Platform = platform,
};
using (mr.Record())
{
scanner.Stub(x => x.FindContainingBlock(Arg<Address>.Is.Anything)).Return(block);
scanner.Stub(x => x.GetTrace(null, null, null)).IgnoreArguments().Return(rw);
scanner.Stub(x => x.Services).Return(sc);
}
wi = new BlockWorkitem(scanner, program, state, addr);
}
示例6: X86arch_ReadCodeAddress_ProtectedFlatMode32
public void X86arch_ReadCodeAddress_ProtectedFlatMode32()
{
arch = new X86ArchitectureFlat32();
var rdr = CreateImageReader(0x78, 0x56, 0x34, 0x12);
var state = arch.CreateProcessorState();
state.SetRegister(Registers.cs, Constant.Word16(0x1111));
Address addr = arch.ReadCodeAddress(4, rdr, state);
Assert.AreEqual("12345678", addr.ToString());
}
示例7: ReadCodeAddress_ProtectedMode16_Offset
public void ReadCodeAddress_ProtectedMode16_Offset()
{
arch = new X86ArchitectureProtected16();
var rdr = CreateImageReader(0x78, 0x56);
var state = arch.CreateProcessorState();
state.SetRegister(Registers.cs, Constant.Word16(0x1234));
Address addr = arch.ReadCodeAddress(2, rdr, state);
Assert.AreEqual("1234:5678", addr.ToString());
}
示例8: BuildTest
private void BuildTest(IntelArchitecture arch, Address addr, IPlatform platform, Action<X86Assembler> m)
{
this.arch = new IntelArchitecture(ProcessorMode.Protected32);
proc = new Procedure("test", arch.CreateFrame());
block = proc.AddBlock("testblock");
this.state = arch.CreateProcessorState();
var asm = new X86Assembler(sc, new DefaultPlatform(sc, arch), addr, new List<EntryPoint>());
scanner = mr.StrictMock<IScanner>();
m(asm);
lr = asm.GetImage();
host = new RewriterHost(asm.ImportReferences,
new Dictionary<string, ProcedureSignature>
{
{
"GetDC",
new ProcedureSignature(
new Identifier("", new Pointer(VoidType.Instance, 4), new RegisterStorage("eax", 0, 0, PrimitiveType.Word32)),
new Identifier("arg",
new TypeReference(
"HWND",
new Pointer(VoidType.Instance, 4)),
new StackArgumentStorage(0, new TypeReference(
"HWND",
new Pointer(VoidType.Instance, 4)))))
{
StackDelta = 4,
}
}
});
var rw = arch.CreateRewriter(lr.Image.CreateLeReader(addr), this.state, proc.Frame, host);
var prog = new Program
{
Architecture = arch,
Image = lr.Image,
ImageMap = lr.ImageMap,
Platform = platform,
};
using (mr.Record())
{
scanner.Stub(x => x.FindContainingBlock(Arg<Address>.Is.Anything)).Return(block);
scanner.Stub(x => x.GetTrace(null, null, null)).IgnoreArguments().Return(rw);
}
wi = new BlockWorkitem(scanner, prog, state, addr);
}