public TranslatedFunction(GuestFunction func, ulong guestSize, bool highCq) { _func = func; GuestSize = guestSize; HighCq = highCq; FuncPtr = Marshal.GetFunctionPointerForDelegate(func); }
public TranslatedFunction(GuestFunction func, bool highCq) { _func = func; HighCq = highCq; FuncPtr = Marshal.GetFunctionPointerForDelegate <GuestFunction>(func); }
private static TranslatedFunction FastTranslate(byte[] code, ulong guestSize, UnwindInfo unwindInfo, bool highCq) { CompiledFunction cFunc = new CompiledFunction(code, unwindInfo); IntPtr codePtr = JitCache.Map(cFunc); GuestFunction gFunc = Marshal.GetDelegateForFunctionPointer <GuestFunction>(codePtr); TranslatedFunction tFunc = new TranslatedFunction(gFunc, guestSize, highCq); return(tFunc); }
private static TranslatedFunction FastTranslate(ReadOnlySpan <byte> code, Counter callCounter, ulong guestSize, UnwindInfo unwindInfo, bool highCq) { CompiledFunction cFunc = new CompiledFunction(code.ToArray(), unwindInfo); IntPtr codePtr = JitCache.Map(cFunc); GuestFunction gFunc = Marshal.GetDelegateForFunctionPointer <GuestFunction>(codePtr); TranslatedFunction tFunc = new TranslatedFunction(gFunc, callCounter, guestSize, highCq); return(tFunc); }
private TranslatedFunction Translate(ulong address, ExecutionMode mode, bool highCq) { ArmEmitterContext context = new ArmEmitterContext(_memory, _jumpTable, (long)address, highCq, Aarch32Mode.User); OperandHelper.PrepareOperandPool(highCq); OperationHelper.PrepareOperationPool(highCq); Logger.StartPass(PassName.Decoding); Block[] blocks = AlwaysTranslateFunctions ? Decoder.DecodeFunction(_memory, address, mode, highCq) : Decoder.DecodeBasicBlock(_memory, address, mode); Logger.EndPass(PassName.Decoding); Logger.StartPass(PassName.Translation); EmitSynchronization(context); if (blocks[0].Address != address) { context.Branch(context.GetLabel(address)); } ControlFlowGraph cfg = EmitAndGetCFG(context, blocks); Logger.EndPass(PassName.Translation); Logger.StartPass(PassName.RegisterUsage); RegisterUsage.RunPass(cfg, mode, isCompleteFunction: false); Logger.EndPass(PassName.RegisterUsage); OperandType[] argTypes = new OperandType[] { OperandType.I64 }; CompilerOptions options = highCq ? CompilerOptions.HighCq : CompilerOptions.None; GuestFunction func = Compiler.Compile <GuestFunction>(cfg, argTypes, OperandType.I64, options); OperandHelper.ResetOperandPool(highCq); OperationHelper.ResetOperationPool(highCq); return(new TranslatedFunction(func, rejit: !highCq)); }
public static void InitializeStubs() { if (_initialized) { return; } lock (_lock) { if (_initialized) { return; } _directCallStub = GenerateDirectCallStub(false); _directTailCallStub = GenerateDirectCallStub(true); _indirectCallStub = GenerateIndirectCallStub(false); _indirectTailCallStub = GenerateIndirectCallStub(true); _initialized = true; } }
public TranslatedFunction(GuestFunction func, bool rejit) { _func = func; _rejit = rejit; }