public RegisterArgument(PythonBoss pyBoss, Context context, PythonDictionary spec, Process process, Arguments parent, string namePrefix) { NamePrefix = namePrefix; this.process = process; // Parse the spec for this argument // regspec: [{"name": "socket", // "register": "rcx", // "type": None, // "fuzz": NOFUZZ},] Register = ((string)spec.get("register")).ToLower(); Fuzz = (bool)spec.get("fuzz"); Name = (string)spec.get("name"); _argumentType = (object)spec.get("type"); if (spec.ContainsKey("type_args")) { _typeArgs = spec.get("type_args"); } // Validate required fields if (Name == null) { throw new Exception("ERROR: Argument specification must include 'name' attribute. Failed when parsing name prefix '" + namePrefix + "'."); } else if (Fuzz == null) { throw new Exception("ERROR: Argument specification must include 'fuzz' attribute. Failed when parsing type '" + namePrefix + Name + "'."); } this.process = process; _pyBoss = pyBoss; _parent = parent; // Read the data var tmpData = context.GetMember(Register); if (tmpData is UInt32) { Data = BitConverter.GetBytes((UInt32)tmpData); } else if (tmpData is UInt64) { Data = BitConverter.GetBytes((UInt64)tmpData); } else { throw new Exception("Register argument type definition problem. The register must be of type 'int' or 'long'. The is likely an engine bug. Argument name: " + Name + ". The unsupported register type is: " + tmpData.ToString()); } Size = Data.Length; PointerTarget = null; }
public override UInt64 GetValue(ref Context context) { return((UInt64)context.GetMember(_register)); }