示例#1
0
        public SerializedSignatureTests()
		{
            this.sc = new ServiceContainer();
            this.sc.AddService<IFileSystemService>(new FileSystemServiceImpl());
			this.arch = new X86ArchitectureReal();
            this.platform = new MsdosPlatform(sc, arch);
		}
示例#2
0
		public void Setup()
		{
            this.sc = new ServiceContainer();
            sc.AddService<IFileSystemService>(new FileSystemServiceImpl());
            this.arch = new X86ArchitectureReal();
            this.platform = new MsdosPlatform(sc, arch);

            ArgumentSerializer argSer = new ArgumentSerializer(arch);

            svc = new SerializedService
            {
                Name = "msdos_ioctl_get_device_info",
                SyscallInfo = new SerializedSyscallInfo
                {
                    Vector = "21",
                    RegisterValues = new[] {
                        new SerializedRegValue("ah", "44"),
                        new SerializedRegValue("al", "00"),
                    }
                },
                Signature = new SerializedSignature
                {
                    ReturnValue = argSer.Serialize(
                        new Identifier("C", PrimitiveType.Bool,
                        new FlagGroupStorage(Registers.eflags, (uint)FlagM.CF, "C", PrimitiveType.Byte)))
                }
            };
		}
示例#3
0
		public void MspRealModeServices()
		{
            mr.ReplayAll();
			IntelArchitecture arch = new IntelArchitecture(ProcessorMode.Real);
			IPlatform platform = new MsdosPlatform(sc, arch);

			var state = arch.CreateProcessorState();
			state.SetRegister(Registers.ah, Constant.Byte(0x3E));
			SystemService svc = platform.FindService(0x21, state);
			Assert.AreEqual("msdos_close_file", svc.Name);
			Assert.AreEqual(1, svc.Signature.Parameters.Length);
			Assert.IsFalse(svc.Characteristics.Terminates, "close() shouldn't terminate program");

			state.SetRegister(Registers.ah, Constant.Byte(0x4C));
			svc = platform.FindService(0x21, state);
			Assert.AreEqual("msdos_terminate", svc.Name);
			Assert.AreEqual(1, svc.Signature.Parameters.Length);
			Assert.IsTrue(svc.Characteristics.Terminates, "terminate() should terminate program");

			state.SetRegister(Registers.ah, Constant.Byte(0x2F));
			svc = platform.FindService(0x21, state);
			Assert.AreEqual("msdos_get_disk_transfer_area_address", svc.Name);
			Assert.AreEqual(0, svc.Signature.Parameters.Length);
			SequenceStorage seq = (SequenceStorage) svc.Signature.ReturnValue.Storage;
			Assert.AreEqual("es", seq.Head.Name);
			Assert.AreEqual("bx", seq.Tail.Name);
		}
		public void Setup()
		{
            var sc = new ServiceContainer();
            sc.AddService<IFileSystemService>(new FileSystemServiceImpl());
			arch = new IntelArchitecture(ProcessorMode.Real);
            platform = new MsdosPlatform(sc, arch);
			sigser = new X86ProcedureSerializer(
                arch, 
                new TypeLibraryDeserializer(platform, true, new TypeLibrary()),
                "stdapi");
            argser = new ArgumentSerializer(sigser, arch, arch.CreateFrame(), null);
		}
示例#5
0
        public void Setup()
        {
            this.arch = new IntelArchitecture(ProcessorMode.Real);
            this.platform = new MsdosPlatform(null, arch);

            svc = new SerializedService();
            svc.Name = "msdos_ioctl_get_device_info";
            svc.SyscallInfo = new SerializedSyscallInfo();
            svc.SyscallInfo.Vector = "21";
            svc.SyscallInfo.RegisterValues = new SerializedRegValue[2];
            svc.SyscallInfo.RegisterValues[0] = new SerializedRegValue("ah", "44");
            svc.SyscallInfo.RegisterValues[1] = new SerializedRegValue("al", "00");
            svc.Signature = new SerializedSignature();
            ArgumentSerializer argSer = new ArgumentSerializer(null, arch, null, null);
            svc.Signature.ReturnValue = argSer.Serialize(new Identifier("C", PrimitiveType.Bool,
                new FlagGroupStorage((uint) FlagM.CF, "C", PrimitiveType.Byte)));
        }
示例#6
0
 public void Setup()
 {
     mr = new MockRepository();
     var sc = new ServiceContainer();
     sc.AddService<IFileSystemService>(new FileSystemServiceImpl());
     arch = new X86ArchitectureReal();
     platform = new MsdosPlatform(sc, arch);
     sigser = mr.Stub<ProcedureSerializer>(
         arch,
         new TypeLibraryDeserializer(platform, true, new TypeLibrary()),
         "stdapi");
     argser = new ArgumentDeserializer(
         sigser,
         arch,
         arch.CreateFrame(),
         // It's possible that old, hand-written assembler passes
         // arguments on unaligned offsets
         13,
         4);
     mr.ReplayAll();
 }
示例#7
0
 public void i86()
 {
     arch = new IntelArchitecture(ProcessorMode.Real);
     Platform = new MsdosPlatform(services, arch);
     SetDefaultWordWidth(PrimitiveType.Word16);
 }
示例#8
0
 public SerializedSignatureTests()
 {
     this.arch = new IntelArchitecture(ProcessorMode.Real);
     this.platform = new MsdosPlatform(null, arch);
 }
示例#9
0
 public void i86()
 {
     arch = new X86ArchitectureReal();
     Platform = new MsdosPlatform(services, arch);
     SetDefaultWordWidth(PrimitiveType.Word16);
 }
示例#10
0
 private void Given_MsdosPlatform()
 {
     this.arch = new X86ArchitectureReal();
     this.platform = new MsdosPlatform(sc, arch);
 }