Ejemplo n.º 1
0
        public void AddMethodCollect(byte[] amlCode)
        {
            if (amlCode == null)
            {
                return;
            }
            AmlDisassemble disassemble = new AmlDisassemble();

            disassemble.MethodCollector = MethodCollector;
            string aslCode = disassemble.DecodeAml(amlCode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// internal to acpi table string
        /// </summary>
        /// <returns>string</returns>
        private string AcpiTableToString()
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load("acpi.xml");
            string  content = "";
            XmlNode root    = xmlDocument.SelectSingleNode("AcpiTable");

            if (root == null)
            {
                return("Invalid Acpi Table Description XML File");
            }

            XmlNodeList nodeList = root.SelectNodes("Table");

            foreach (XmlNode xmlNode in nodeList)
            {
                try
                {
                    if (xmlNode.Attributes[0].Value == TableName)
                    {
                        // match

                        try
                        {
                            XmlNode Head = xmlNode.SelectSingleNode("header");
                            if (Head != null && Head.Attributes["type"].Value == "Header")
                            {
                                XmlNode stdheader = root.SelectSingleNode("Header");
                                content = "/*\nStandard Table Header:\n" + AcpiFieldsDecode(root, stdheader, _TableBinary) + "*/\n";
                                // c# aml decode for tables.
                                if (Head.Attributes["aml"] != null && Head.Attributes["aml"].Value == "true")
                                {
                                    // parse the table then
                                    AmlDisassemble amlDisassemble = new AmlDisassemble();
                                    content += "\n";
                                    amlDisassemble.SetAmlMethodBuilder(_amlMethodBuilder);
                                    // make a define..
                                    string Header     = Util.StringFromBytes(_TableBinary.Take(4).ToArray());
                                    string OemId      = Util.StringFromBytes(_TableBinary.Skip(10).Take(6).ToArray());
                                    string OemTableId = Util.StringFromBytes(_TableBinary.Skip(16).Take(8).ToArray());
                                    UInt32 OemRev     = BitConverter.ToUInt32(_TableBinary, 24);
                                    content += string.Format("DefinitionBlock(\"\", \"{0}\", {1}, \"{2}\", \"{3}\", 0x{4:X8})\n", Header, _TableBinary[8], OemId, OemTableId, OemRev) + "{\n";
                                    content += amlDisassemble.DecodeAmlFromTable(_TableBinary);
                                    content += "}";
                                    return(content);
                                }
                            }
                            content += "\n";
                            content += AcpiFieldsDecode(root, xmlNode, _TableBinary);
                        } catch (Exception e)
                        {
                            Log.Logs(e.Message);
                            System.Diagnostics.Debug.WriteLine(e.Message);
                            return("");
                        }
                        //content = AcpiStandardHeader(root);
                        return(content);
                    }
                }
                catch (Exception e)
                {
                    Log.Logs(e.Message);
                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
            }
            // no matching just follow standard tables
            XmlNode header = root.SelectSingleNode("Header");

            return(AcpiFieldsDecode(root, header, _TableBinary));
        }