本文整理汇总了C#中IRewriterHost类的典型用法代码示例。如果您正苦于以下问题:C# IRewriterHost类的具体用法?C# IRewriterHost怎么用?C# IRewriterHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRewriterHost类属于命名空间,在下文中一共展示了IRewriterHost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetTrampolineDestination
public override ProcedureBase GetTrampolineDestination(ImageReader rdr, IRewriterHost host)
{
var rw = Architecture.CreateRewriter(
rdr,
Architecture.CreateProcessorState(),
Architecture.CreateFrame(), host);
var rtlc = rw.FirstOrDefault();
if (rtlc == null || rtlc.Instructions.Count == 0)
return null;
var jump = rtlc.Instructions[0] as RtlGoto;
if (jump == null)
return null;
var pc = jump.Target as ProcedureConstant;
if (pc != null)
return pc.Procedure;
var access = jump.Target as MemoryAccess;
if (access == null)
return null;
var addrTarget = access.EffectiveAddress as Address;
if (addrTarget == null)
{
var wAddr = access.EffectiveAddress as Constant;
if (wAddr == null)
{
return null;
}
addrTarget = MakeAddressFromConstant(wAddr);
}
ProcedureBase proc = host.GetImportedProcedure(addrTarget, rtlc.Address);
if (proc != null)
return proc;
return host.GetInterceptedCall(addrTarget);
}
开发者ID:killbug2004,项目名称:reko,代码行数:33,代码来源:Win_x86_64_Platform.cs
示例2: OperandRewriter
public OperandRewriter(IntelArchitecture arch, ExpressionEmitter emitter, Frame frame, IRewriterHost host)
{
this.arch = arch;
this.m = emitter;
this.frame = frame;
this.host = host;
}
开发者ID:uxmal,项目名称:reko,代码行数:7,代码来源:OperandRewriter.cs
示例3: CreateRewriter
public IEnumerable<RtlInstructionCluster> CreateRewriter(ImageReader rdr, ProcessorState state, Frame frame, IRewriterHost host)
{
var linAddr = rdr.Address.ToLinear();
RtlTrace trace;
if (!rewriters.Traces.TryGetValue(rdr.Address, out trace))
NUnit.Framework.Assert.Fail(string.Format("Unexpected request for a rewriter at address {0}", rdr.Address));
return trace;
}
开发者ID:melbcat,项目名称:reko,代码行数:8,代码来源:FakeArchitecture.cs
示例4: GetInstructionStream
protected override IEnumerable<RtlInstructionCluster> GetInstructionStream(Frame frame, IRewriterHost host)
{
return new X86Rewriter(
arch,
host,
new X86State(arch),
asmResult.SegmentMap.Segments.Values.First().MemoryArea.CreateLeReader(0), frame);
}
开发者ID:relaxar,项目名称:reko,代码行数:8,代码来源:RewriteFpuInstructionTests.cs
示例5: CreateRewriter
public override IEnumerable<RtlInstructionCluster> CreateRewriter(ImageReader rdr, ProcessorState state, Frame frame, IRewriterHost host)
{
return new MipsRewriter(
this,
new MipsDisassembler(this, rdr, IsVersion6OrLater),
frame,
host);
}
开发者ID:uxmal,项目名称:reko,代码行数:8,代码来源:MipsProcessorArchitecture.cs
示例6: GetInstructionStream
protected override IEnumerable<RtlInstructionCluster> GetInstructionStream(Frame frame, IRewriterHost host)
{
return arch.CreateRewriter(
new LeImageReader(image, 0),
arch.CreateProcessorState(),
frame,
this.host);
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:8,代码来源:X86RewriterTests.cs
示例7: HeuristicDisassembler
public HeuristicDisassembler(
Program program,
HeuristicProcedure proc,
IRewriterHost host)
{
this.program = program;
this.proc = proc;
this.host = host;
blockMap = new Dictionary<Address, HeuristicBlock>();
}
开发者ID:relaxar,项目名称:reko,代码行数:10,代码来源:HeuristicDisassembler.cs
示例8: ShingledScanner
public ShingledScanner(Program program, IRewriterHost host, DecompilerEventListener eventListener)
{
this.program = program;
this.host = host;
this.eventListener = eventListener;
this.bad = program.Platform.MakeAddressFromLinear(~0ul);
this.possibleCallDestinationTallies = new Dictionary<Address,int>();
this.possiblePointerTargetTallies = new Dictionary<Address, int>();
this.instructions = new SortedList<Address, MachineInstruction>();
}
开发者ID:relaxar,项目名称:reko,代码行数:10,代码来源:ShingledScanner.cs
示例9: GetInstructionStream
protected override IEnumerable<RtlInstructionCluster> GetInstructionStream(Frame frame, IRewriterHost host)
{
var addr = Address.Ptr16(10);
var image = new LoadedImage(addr, new byte[1]);
return arch.CreateRewriter(
arch.CreateImageReader(image, addr),
arch.CreateProcessorState(),
frame,
host);
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:10,代码来源:C64BasicRewriterTests.cs
示例10: Given_RewriterHost
protected void Given_RewriterHost()
{
host = mr.Stub<IRewriterHost>();
host.Stub(h => h.EnsurePseudoProcedure(null, null, 0))
.IgnoreArguments()
.Do(new Func<string, DataType, int, PseudoProcedure>((n, dt, a) =>
{
return new PseudoProcedure(n, dt, a);
}));
}
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:HeuristicTestBase.cs
示例11: GetInstructionStream
protected override IEnumerable<RtlInstructionCluster> GetInstructionStream(Frame frame, IRewriterHost host)
{
return new XtensaRewriter(arch, new LeImageReader(image, 0), state, new Frame(arch.WordWidth), host);
}
开发者ID:relaxar,项目名称:reko,代码行数:4,代码来源:XtensaRewriterTests.cs
示例12: GetTrampolineDestination
public override ProcedureBase GetTrampolineDestination(ImageReader imageReader, IRewriterHost host)
{
throw new NotImplementedException();
}
开发者ID:relaxar,项目名称:reko,代码行数:4,代码来源:Trs80Platform.cs
示例13: GetTrampolineDestination
//public override ProcedureBase GetTrampolineDestination(ImageReader rdr, IRewriterHost host)
//{
// var dasm = new PowerPcDisassembler(this, rdr, WordWidth);
// return GetTrampolineDestination(dasm, host);
//}
/// <summary>
/// Detects the presence of a PowerPC trampoline and returns the imported function
/// that is actually being requested.
/// </summary>
/// <remarks>
/// A PowerPC trampoline looks like this:
/// addis rX,r0,XXXX (or oris rx,r0,XXXX)
/// lwz rY,YYYY(rX)
/// mtctr rY
/// bctr rY
/// When loading the ELF binary, we discovered the memory locations
/// that will contain pointers to imported functions. If the address
/// XXXXYYYY matches one of those memory locations, we have found a
/// trampoline.
/// </remarks>
/// <param name="rdr"></param>
/// <param name="host"></param>
/// <returns></returns>
public ProcedureBase GetTrampolineDestination(IEnumerable<PowerPcInstruction> rdr, IRewriterHost host)
{
var e = rdr.GetEnumerator();
if (!e.MoveNext() || (e.Current.Opcode != Opcode.addis && e.Current.Opcode != Opcode.oris))
return null;
var addrInstr = e.Current.Address;
var reg = ((RegisterOperand)e.Current.op1).Register;
var uAddr = ((ImmediateOperand)e.Current.op3).Value.ToUInt32() << 16;
if (!e.MoveNext() || e.Current.Opcode != Opcode.lwz)
return null;
var mem = e.Current.op2 as MemoryOperand;
if (mem == null)
return null;
if (mem.BaseRegister != reg)
return null;
uAddr = (uint)((int)uAddr + mem.Offset.ToInt32());
reg = ((RegisterOperand)e.Current.op1).Register;
if (!e.MoveNext() || e.Current.Opcode != Opcode.mtctr)
return null;
if (((RegisterOperand)e.Current.op1).Register != reg)
return null;
if (!e.MoveNext() || e.Current.Opcode != Opcode.bcctr)
return null;
// We saw a thunk! now try to resolve it.
var addr = Address.Ptr32(uAddr);
var ep = host.GetImportedProcedure(addr, addrInstr);
if (ep != null)
return ep;
return host.GetInterceptedCall(addr);
}
开发者ID:relaxar,项目名称:reko,代码行数:60,代码来源:PowerPcArchitecture.cs
示例14: CreateRewriter
public IEnumerable<RtlInstructionCluster> CreateRewriter(ImageReader rdr, ProcessorState state, Frame frame, IRewriterHost host)
{
return new Z80Rewriter(this, rdr, state, frame, host);
}
开发者ID:killbug2004,项目名称:reko,代码行数:4,代码来源:Z80ProcessorArchitecture.cs
示例15: CreateRewriter
public IEnumerable<RtlInstructionCluster> CreateRewriter(ImageReader rdr, ProcessorState state, Frame frame, IRewriterHost host)
{
throw new NotImplementedException();
}
开发者ID:uxmal,项目名称:reko,代码行数:4,代码来源:ProcedureStateTests.cs
示例16: GetTrampolineDestination
public override ProcedureBase GetTrampolineDestination(ImageReader rdr, IRewriterHost host)
{
var dasm = new PowerPcDisassembler(
(PowerPcArchitecture64) Architecture,
rdr,
PrimitiveType.Word64);
PowerPcInstruction instr;
ImmediateOperand immOp;
MemoryOperand memOp;
//addi r12,r0,0000
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.addi)
return null;
//oris r12,r12,0006
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.oris)
return null;
immOp = (ImmediateOperand) instr.op3;
uint aFuncDesc = immOp.Value.ToUInt32() << 16;
//lwz r12,nnnn(r12)
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.lwz)
return null;
memOp = (MemoryOperand)instr.op2;
int offset = memOp.Offset.ToInt32();
aFuncDesc = (uint)(aFuncDesc + offset);
//std r2,40(r1)
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.std)
return null;
//lwz r0,0(r12)
// Have a pointer to a trampoline
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.lwz)
return null;
//lwz r2,4(r12)
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.lwz)
return null;
// mtctr r0
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.mtctr)
return null;
// bcctr 14,00
instr = dasm.DisassembleInstruction();
if (instr.Opcode != Opcode.bcctr)
return null;
// Read the function pointer from the function descriptor.
offset = (int)aFuncDesc - (int)rdr.Address.ToUInt32();
rdr.Offset = rdr.Offset + offset;
var aFn = rdr.ReadUInt32();
return null;
}
开发者ID:relaxar,项目名称:reko,代码行数:63,代码来源:Ps3Platform.cs
示例17: CreateOperandRewriter
public abstract OperandRewriter CreateOperandRewriter(IntelArchitecture arch, Frame frame, IRewriterHost host);
开发者ID:gh0std4ncer,项目名称:reko,代码行数:1,代码来源:ProcessorMode.cs
示例18: HeuristicScanner
public HeuristicScanner(Program prog, IRewriterHost host)
{
this.program = prog;
this.host = host;
}
开发者ID:feelworld,项目名称:reko,代码行数:5,代码来源:HeuristicScanner.cs
示例19: GetInstructionStream
protected override IEnumerable<RtlInstructionCluster> GetInstructionStream(Frame frame, IRewriterHost host)
{
return new MipsRewriter(arch, dasm, frame, host);
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:4,代码来源:MipsRewriterTests.cs
示例20: OperandRewriter
public OperandRewriter(IntelArchitecture arch, Frame frame, IRewriterHost host)
{
this.arch = arch;
this.frame = frame;
this.host = host;
}
开发者ID:killbug2004,项目名称:reko,代码行数:6,代码来源:OperandRewriter.cs
注:本文中的IRewriterHost类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论