public void Setup() { mr = new MockRepository(); mockFactory = new MockFactory(mr); arch = new X86ArchitectureFlat64(); platform = new SysVPlatform(null, arch); }
public void Setup() { mr = new MockRepository(); mockFactory = new MockFactory(mr); arch = new PowerPcArchitecture32(); platform = new SysVPlatform(null, arch); }
public void SlLookupType() { var slib = new SerializedLibrary { Types = new SerializedType[] { new SerializedTypedef { Name="int", DataType=new PrimitiveType_v1 { Domain = Reko.Core.Types.Domain.SignedInt, ByteSize = 4 } } } }; var arch = new IntelArchitecture(ProcessorMode.Protected32); var platform = new SysVPlatform(null, arch); var lib = TypeLibrary.Load(platform, slib); Assert.AreEqual(PrimitiveType.Int32, lib.LookupType("int")); }
public void SlLookupType() { var slib = new SerializedLibrary { Types = new SerializedType[] { new SerializedTypedef { Name="int", DataType=new PrimitiveType_v1 { Domain = Reko.Core.Types.Domain.SignedInt, ByteSize = 4 } } } }; var arch = new X86ArchitectureFlat32(); var platform = new SysVPlatform(null, arch); var tldser = new TypeLibraryDeserializer(platform, true, new TypeLibrary()); var lib = tldser.Load(slib); Assert.AreEqual(PrimitiveType.Int32, lib.LookupType("int")); }
public void SysV_TerminatingFunction() { cfgSvc.Stub(c => c.GetInstallationRelativePath("libc.xml")) .Return("libc.xml"); var env = new OperatingEnvironmentElement { TypeLibraries = { new TypeLibraryElement { Name="libc.xml" } }, CharacteristicsLibraries = { new TypeLibraryElement { Name="libcharacteristics.xml", } } }; Given_EnvironmentConfiguration(env); tlSvc.Stub(t => t.LoadCharacteristics(null)) .IgnoreArguments() .Return(new CharacteristicsLibrary { Entries = { { "exit", new ProcedureCharacteristics { Terminates = true } } } }); tlSvc.Stub(t => t.LoadMetadataIntoLibrary(null, null, null)) .IgnoreArguments() .Return(new TypeLibrary { Signatures = { { "exit", new FunctionType() } } }); mr.ReplayAll(); var sysv = new SysVPlatform(sc, arch); var proc = sysv.LookupProcedureByName(null, "exit"); Assert.IsTrue(proc.Characteristics.Terminates, "exit should have been marked as terminating."); }
public void SysV_LoadTrashedRegisters() { arch.Stub(a => a.GetRegister((string)null)).IgnoreArguments() .Do(new Func<string, RegisterStorage>(r => new RegisterStorage(r, (int)r[1], 0, PrimitiveType.Word32))); var env = new OperatingEnvironmentElement { Architectures = { new PlatformArchitectureElement { TrashedRegisters = { "r2", "r3" } } } }; Given_EnvironmentConfiguration(env); mr.ReplayAll(); var sysv = new SysVPlatform(sc, arch); var regs = sysv.CreateTrashedRegisters(); Assert.AreEqual(2, regs.Count); Assert.AreEqual("r2,r3", string.Join(",", regs.Select(r => r.Name))); }
public void SysV_TerminatingFunction() { var mr = new MockRepository(); var sc = new ServiceContainer(); var arch = mr.Stub<IProcessorArchitecture>(); var tlSvc = mr.Stub<ITypeLibraryLoaderService>(); var cfgSvc = mr.Stub<IConfigurationService>(); sc.AddService<IConfigurationService>(cfgSvc); sc.AddService<ITypeLibraryLoaderService>(tlSvc); cfgSvc.Stub(c => c.GetEnvironment(null)) .IgnoreArguments() .Return(new OperatingEnvironmentElement { TypeLibraries = { new TypeLibraryElement { Name="libc.xml" } }, CharacteristicsLibraries = { new TypeLibraryElement { Name="libcharacteristics.xml", } } }); tlSvc.Stub(t => t.LoadCharacteristics(null)) .IgnoreArguments() .Return(new CharacteristicsLibrary { Entries = { { "exit", new ProcedureCharacteristics { Terminates = true } } } }); tlSvc.Stub(t => t.LoadLibrary(null, null)) .IgnoreArguments() .Return(new TypeLibrary { Signatures = { { "exit", new ProcedureSignature(null) } } }); mr.ReplayAll(); var sysv = new SysVPlatform(sc, arch); var proc = sysv.LookupProcedureByName(null, "exit"); Assert.IsTrue(proc.Characteristics.Terminates, "exit should have been marked as terminating."); }
public void Setup() { arch = new PowerPcArchitecture32(); platform = new SysVPlatform(null, arch); }
public void Setup() { arch = new X86ArchitectureFlat64(); platform = new SysVPlatform(null, arch); }