Пример #1
0
        private void AddMethod(string name, byte numArgs, ReservedMethod.AcpiMethodImpl impl)
        {
            AbsoluteNodePath root = AbsoluteNodePath.CreateRoot();
            Node             node = acpiNamespace.CreateNodeAt(new AbsoluteNodePath(new string[] { name }), root);

            node.Value = new ReservedMethod(numArgs, SerializeFlag.NotSerialized, 0 /*syncLevel*/, impl);;
        }
Пример #2
0
            public override void Visit(AmlParser.DefDevice defDevice)
            {
                AbsoluteNodePath oldPath = currentPath;

                Node node = acpiNamespace.LookupNode(defDevice.nameString.nodePath, currentPath);

                string[] segments = new string[currentPath.NameSegments.Length
                                               + defDevice.nameString.nodePath.NameSegments.Length];

                int index = 0;

                foreach (string segment in currentPath.NameSegments)
                {
                    segments[index++] = segment;
                }

                foreach (string segment in defDevice.nameString.nodePath.NameSegments)
                {
                    segments[index++] = segment;
                }

                AbsoluteNodePath devPath = new AbsoluteNodePath(segments);

                node.Value = new AcpiObject.Device(devPath);

                currentPath = node.Path;
                foreach (AmlObject amlObject in defDevice.amlObjectList)
                {
                    amlObject.Accept(this);
                }

                currentPath = oldPath;
            }
Пример #3
0
 public AmlInterpreterThread(AcpiNamespace acpiNamespace, MethodResultCallback callback,
                             IOperationRegionAccessor operationRegionAccessor)
 {
     this.acpiNamespace           = acpiNamespace;
     this.currentPath             = AbsoluteNodePath.CreateRoot();
     this.callback                = callback;
     this.operationRegionAccessor = operationRegionAccessor;
 }
Пример #4
0
        public AmlInterpreterThread InvokeMethodOnNewThread(MethodResultCallback callback,
                                                            AbsoluteNodePath nodePath, AcpiObject.AcpiObject[] parameters)
        {
            AmlInterpreterThread thread = new AmlInterpreterThread(acpiNamespace, callback, operationRegionAccessor);

            thread.InvokeMethod(nodePath, parameters);
            threadsReadyToRun.Enqueue(thread);
            return(thread);
        }
Пример #5
0
            public override void Visit(AmlParser.DefScope defScope)
            {
                AbsoluteNodePath oldPath = currentPath;

                currentPath = acpiNamespace.LookupNode(defScope.nameString.nodePath, currentPath).Path;
                foreach (TermObj termObj in defScope.termList)
                {
                    termObj.Accept(this);
                }
                currentPath = oldPath;
            }
Пример #6
0
            public override void Visit(AmlParser.DefThermalZone defThermalZone)
            {
                AbsoluteNodePath oldPath = currentPath;

                Node node = acpiNamespace.CreateNodeAt(defThermalZone.nameString.nodePath, currentPath);

                currentPath = node.Path;
                foreach (AmlObject amlObject in defThermalZone.amlObjectList)
                {
                    amlObject.Accept(this);
                }

                currentPath = oldPath;
            }
Пример #7
0
        public void InvokeMethod(AbsoluteNodePath nodePath, AcpiObject.AcpiObject[] parameters)
        {
            Node methodNode = acpiNamespace.LookupNode(nodePath);

            if (methodNode == null)
            {
                throw new MethodNotFoundInterpretException();
            }
            if (!(methodNode.Value is AcpiObject.BytecodeMethod))
            {
                throw new AmlTypeException();
            }
            this.currentPath = methodNode.Path;
            ((AcpiObject.Method)(methodNode.Value)).Invoke(this, parameters, acpiNamespace);
        }
Пример #8
0
            public override void Visit(AmlParser.DefPowerRes defPowerRes)
            {
                AbsoluteNodePath oldPath = currentPath;

                Node node = acpiNamespace.LookupNode(defPowerRes.nameString.nodePath, currentPath);

                node.Value = new AcpiObject.PowerResource(defPowerRes.systemLevel.byteData,
                                                          defPowerRes.resourceOrder.wordData);

                currentPath = node.Path;
                foreach (AmlObject amlObject in defPowerRes.amlObjectList)
                {
                    amlObject.Accept(this);
                }

                currentPath = oldPath;
            }
Пример #9
0
            public override void Visit(AmlParser.DefProcessor defProcessor)
            {
                AbsoluteNodePath oldPath = currentPath;

                Node node = acpiNamespace.LookupNode(defProcessor.nameString.nodePath, currentPath);

                node.Value = new AcpiObject.Processor(defProcessor.procID.byteData,
                                                      defProcessor.pblkAddr.dWordData,
                                                      defProcessor.pblkLen.byteData);

                currentPath = node.Path;
                foreach (AmlObject amlObject in defProcessor.amlObjectList)
                {
                    amlObject.Accept(this);
                }

                currentPath = oldPath;
            }
Пример #10
0
 public NamesVisitor(AcpiNamespace acpiNamespace)
 {
     this.acpiNamespace = acpiNamespace;
     this.currentPath   = AbsoluteNodePath.CreateRoot();
 }
Пример #11
0
 public LoadTimeEvaluateVisitor(AcpiNamespace acpiNamespace, AbsoluteNodePath currentPath)
 {
     this.acpiNamespace = acpiNamespace;
     this.currentPath   = currentPath;
 }
Пример #12
0
 public ValuesVisitor(AmlLoader loader, AcpiNamespace acpiNamespace)
 {
     this.acpiNamespace = acpiNamespace;
     this.currentPath   = AbsoluteNodePath.CreateRoot();
     this.loader        = loader;
 }
Пример #13
0
        private void AddNamespace(string name)
        {
            AbsoluteNodePath root = AbsoluteNodePath.CreateRoot();

            acpiNamespace.CreateNodeAt(new AbsoluteNodePath(new string[] { name }), root);
        }