public override void InjectProcedureEntryStatements(Procedure proc, Address addr, CodeEmitter m) { switch (Architecture.Name) { case "mips-be-32": case "mips-le-32": // MIPS ELF ABI: r25 is _always_ set to the address of a procedure on entry. m.Assign(proc.Frame.EnsureRegister(Architecture.GetRegister("r25")), Constant.Word32((uint)addr.ToLinear())); break; case "mips-be-64": case "mips-le-64": // MIPS ELF ABI: r25 is _always_ set to the address of a procedure on entry. m.Assign(proc.Frame.EnsureRegister(Architecture.GetRegister("r25")), Constant.Word64((uint)addr.ToLinear())); break; case "zSeries": // Stack parameters are passed in starting at offset +160 from the // stack; everything at lower addresses is local to the called procedure's // frame. m.Assign( proc.Frame.EnsureRegister(Architecture.GetRegister("r15")), m.ISub( proc.Frame.FramePointer, Constant.Int(proc.Frame.FramePointer.DataType, 160))); break; } }
public override void InjectProcedureEntryStatements( Procedure proc, Address addr, CodeEmitter m) { m.Assign(proc.Frame.EnsureRegister(Registers.Top), 0); }
public override void InjectProcedureEntryStatements(Procedure proc, Address addr, CodeEmitter m) { var ptrA5World = EnsureA5Pointer(); var a5 = proc.Frame.EnsureRegister(Registers.a5); m.Assign(a5, ptrA5World); }
public override void InjectProcedureEntryStatements(Procedure proc, Address addr, CodeEmitter m) { switch (Architecture.Name) { case "mips-be-32": // MIPS ELF ABI: r25 is _always_ set to the address of a procedure on entry. m.Assign(proc.Frame.EnsureRegister(Architecture.GetRegister(25)), Constant.Word32((uint)addr.ToLinear())); break; } }
public void EmitStringInstruction(X86Instruction instr, CodeEmitter emitter) { this.emitter = emitter; bool incSi = false; bool incDi = false; this.instrCur = instr; switch (instrCur.code) { default: throw new ApplicationException("NYI"); case Mnemonic.cmps: case Mnemonic.cmpsb: emitter.Assign( orw.FlagGroup(X86Instruction.DefCc(Mnemonic.cmp)), new ConditionOf( new BinaryExpression(Operator.ISub, instrCur.dataWidth, MemSi(), MemDi()))); incSi = true; incDi = true; break; case Mnemonic.lods: case Mnemonic.lodsb: emitter.Assign(RegAl, MemSi()); incSi = true; break; case Mnemonic.movs: case Mnemonic.movsb: { Identifier tmp = frame.CreateTemporary(instrCur.dataWidth); emitter.Assign(tmp, MemSi()); emitter.Store(MemDi(), tmp); incSi = true; incDi = true; break; } case Mnemonic.ins: case Mnemonic.insb: { Identifier regDX = orw.AluRegister(Registers.edx, instrCur.addrWidth); emitter.Store(MemDi(), emitter.PseudoProc("__in", instrCur.dataWidth, regDX)); incDi = true; break; } case Mnemonic.outs: case Mnemonic.outsb: { Identifier regDX = orw.AluRegister(Registers.edx, instrCur.addrWidth); emitter.SideEffect("__out" + RegAl.DataType.Prefix, regDX, RegAl); incSi = true; break; } case Mnemonic.scas: case Mnemonic.scasb: emitter.Assign( orw.FlagGroup(X86Instruction.DefCc(Mnemonic.cmp)), new ConditionOf( new BinaryExpression(Operator.ISub, instrCur.dataWidth, RegAl, MemDi()))); incDi = true; break; case Mnemonic.stos: case Mnemonic.stosb: emitter.Store(MemDi(), RegAl); incDi = true; break; } if (incSi) { emitter.Assign(RegSi, new BinaryExpression(Operator.IAdd, instrCur.addrWidth, RegSi, Constant.Create(instrCur.addrWidth, instrCur.dataWidth.Size))); } if (incDi) { emitter.Assign(RegDi, new BinaryExpression(Operator.IAdd, instrCur.addrWidth, RegDi, Constant.Create(instrCur.addrWidth, instrCur.dataWidth.Size))); } }