public void Setup() { this.sc = new ServiceContainer(); sc.AddService <IFileSystemService>(new FileSystemServiceImpl()); this.arch = new X86ArchitectureReal("x86-real-16"); this.platform = new MsdosPlatform(sc, arch); ArgumentSerializer argSer = new ArgumentSerializer(arch); svc = new SerializedService { Name = "msdos_ioctl_get_device_info", SyscallInfo = new SyscallInfo_v1 { 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))) } }; }
public SystemService LoadService(SerializedService ssvc) { var svc = ssvc.Build(platform, this.library); LoadService(svc.SyscallInfo.Vector, svc); return(svc); }
/// <summary> /// This hack loops through all the registers in a <see cref="SerializedService"/> loaded /// from the realmodeintservices.xml file and replaces sequences that look like segmented /// 32-bit pointers with their flat 32-bit equivalents. /// It's a placeholder and should be replaced by a "protectedmodeintservices.xml" that should /// generated from realmodeintservices.xml. /// </summary> private SerializedService ExtendRegisters(SerializedService svc) { if (svc.Signature != null && svc.Signature.Arguments != null) { var args = new List <Argument_v1>(); foreach (var arg in svc.Signature.Arguments) { if (arg.Type is PointerType_v1 ptr && arg.Kind is SerializedSequence seq && seq.Registers != null && seq.Registers.Length == 2 && seq.Registers[1].Name != null) { var off = seq.Registers[1].Name; var eoff = "e" + off; var argNew = new Argument_v1 { Name = arg.Name, Kind = new Register_v1 { Name = eoff }, OutParameter = arg.OutParameter, Type = arg.Type, }; args.Add(argNew); } else { args.Add(arg); } }
public void SserEmptyRegs() { var ssvc = new SerializedService { Ordinal = 3, }; var svc = ssvc.Build(platform, new TypeLibrary()); Assert.AreEqual(3, svc.SyscallInfo.Vector); Assert.AreEqual(0, svc.SyscallInfo.RegisterValues.Length); }
public void Setup() { 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))); }
private void LoadProcedures(SerializedLibrary serializedLibrary) { if (serializedLibrary.Procedures != null) { foreach (object o in serializedLibrary.Procedures) { Procedure_v1 sp = o as Procedure_v1; if (sp != null) { LoadProcedure(sp); } SerializedService svc = o as SerializedService; if (svc != null) { LoadService(svc); } } } }
public void LoadService(SerializedService ssvc) { var svc = ssvc.Build(platform); servicesByOrdinal[svc.SyscallInfo.Vector] = svc; }