コード例 #1
0
 public void Acquire(AmlInterpreterThread thread)
 {
     if (owner == null)
     {
         owner = thread;
     }
     else
     {
         waitingThreads.Add(thread);
         thread.Block();
     }
 }
コード例 #2
0
        private static void LoadDeviceInfo(AcpiNamespace acpiNamespace,
                                           AcpiObject.IOperationRegionAccessor operationRegionAccessor)
        {
            AmlInterpreter interpreter = new AmlInterpreter(acpiNamespace, operationRegionAccessor);

            foreach (AcpiNamespace.Node crsNode in acpiNamespace.GetAllNodes())
            {
                if (crsNode.Name != "_CRS")
                {
                    continue;
                }

                Console.Write("Loading resource descriptors for ACPI device ");
                Console.WriteLine(crsNode.Path.RemoveSegment().ToString());

                AcpiNamespace.Node hidNode =
                    acpiNamespace.LookupNode(crsNode.Path.RemoveSegmentAbsolute().AddSegmentAbsolute("_HID"));
                if (hidNode == null)
                {
                    throw new Exception("Found device with _CRS property but no matching _HID property");
                }

                AcpiObject.AcpiObject hidObject = hidNode.Value;
                if (hidObject is AcpiObject.BytecodeMethod)
                {
                    AmlInterpreterThread thread =
                        interpreter.InvokeMethodOnNewThread(null, hidNode.Path, new AcpiObject.AcpiObject[] { });
                    interpreter.Run();
                    hidObject = thread.ExitValue;
                }
                string deviceId = HidObjectToDeviceId(hidObject);

                AcpiObject.AcpiObject crsObject = crsNode.Value;
                if (crsObject is AcpiObject.BytecodeMethod)
                {
                    AmlInterpreterThread thread =
                        interpreter.InvokeMethodOnNewThread(null, crsNode.Path, new AcpiObject.AcpiObject[] { });
                    interpreter.Run();
                    crsObject = thread.ExitValue;
                }
                if (crsObject is AcpiObject.Buffer)
                {
                    byte[] crsBuffer = crsObject.GetAsBuffer().Contents;
                    ResourceDescriptor[] resourceDescriptors = ResourceDescriptorParser.Parse(crsBuffer);

                    Console.WriteLine("Loaded resource descriptor for device " + deviceId);
                }
                else
                {
                    Console.WriteLine("No resource descriptor for device " + deviceId);
                }
            }
        }
コード例 #3
0
 public override void Invoke(AmlInterpreterThread thread, AcpiObject[] parameters, AcpiNamespace acpiNamespace)
 {
     if (body == null)
     {
         AcpiNamespace.Node node = acpiNamespace.FindValue(this);
         if (Parse(acpiNamespace, node.Path) == AmlParser.ParseSuccess.Failure)
         {
             throw new InterpretException("AML parser failure while just-in-time parsing AML method body");
         }
     }
     thread.PushFrame(new AmlStackFrame(body, parameters));
 }
コード例 #4
0
        public void Release(AmlInterpreterThread thread)
        {
            if (owner == null)
            {
                throw new InterpretException("Attempt to release unlocked mutex");
            }
            owner = null;

            foreach (AmlInterpreterThread waitingThread in waitingThreads)
            {
                waitingThread.Notify();
            }
            waitingThreads.Clear();
        }
コード例 #5
0
 public void Add(AmlInterpreterThread thread)
 {
     set.Add(thread);
 }
コード例 #6
0
 public override void Invoke(AmlInterpreterThread thread, AcpiObject[] parameters, AcpiNamespace acpiNamespace)
 {
     thread.Push(new ValueIoLocation(impl(parameters)));
 }
コード例 #7
0
 public abstract void Invoke(AmlInterpreterThread thread, AcpiObject[] parameters, AcpiNamespace acpiNamespace);