public void Ps3p_GetTrampoline() { var arch = new PowerPcBe64Architecture(new ServiceContainer(), "ppc-be-64", new Dictionary <string, object>()); var m = new InstructionBuilder(arch, Address.Ptr32(0x10030000)); m.Lis(m.r11, 0x1006); m.Lwz(m.r11, 0x1234, m.r11); m.Mtctr(m.r11); m.Bctr(); var host = new Mock <IRewriterHost>(); host.Setup(h => h.GetImportedProcedure( It.IsNotNull <IProcessorArchitecture>(), It.Is <Address>(a => a.ToLinear() == 0x10061234), It.IsAny <Address>())) .Returns(new ExternalProcedure("foo", new FunctionType())); ProcedureBase proc = arch.GetTrampolineDestination(m.Instructions, host.Object); Assert.IsNotNull(proc); Assert.AreEqual("foo", proc.Name); }
public void Ps3p_GetTrampoline() { var arch = new PowerPcBe64Architecture("ppc-be-64"); var m = new InstructionBuilder(arch, Address.Ptr32(0x10030000)); m.Lis(m.r11, 0x1006); m.Lwz(m.r11, 0x1234, m.r11); m.Mtctr(m.r11); m.Bctr(); var host = mr.Stub <IRewriterHost>(); host.Stub(h => h.GetImportedProcedure( Arg <Address> .Matches(a => a.ToLinear() == 0x10061234), Arg <Address> .Is.Anything)) .Return(new ExternalProcedure("foo", new FunctionType())); mr.ReplayAll(); ProcedureBase proc = arch.GetTrampolineDestination(m.Instructions, host); Assert.IsNotNull(proc); Assert.AreEqual("foo", proc.Name); }