Isaac Woods 5 gadi atpakaļ
vecāks
revīzija
8bc45cf15f
2 mainītis faili ar 23 papildinājumiem un 0 dzēšanām
  1. 1 0
      aml_parser/src/opcode.rs
  2. 22 0
      aml_parser/src/term_object.rs

+ 1 - 0
aml_parser/src/opcode.rs

@@ -25,6 +25,7 @@ pub const DEF_SCOPE_OP: u8 = 0x10;
 pub const DEF_BUFFER_OP: u8 = 0x11;
 pub const DEF_PACKAGE_OP: u8 = 0x12;
 pub const DEF_METHOD_OP: u8 = 0x14;
+pub const EXT_DEF_MUTEX_OP: u8 = 0x01;
 pub const EXT_REVISION_OP: u8 = 0x30;
 pub const EXT_DEF_OP_REGION_OP: u8 = 0x80;
 pub const EXT_DEF_FIELD_OP: u8 = 0x81;

+ 22 - 0
aml_parser/src/term_object.rs

@@ -84,6 +84,7 @@ where
             def_method(),
             def_device(),
             def_processor(),
+            def_mutex()
         ),
     )
 }
@@ -406,6 +407,27 @@ where
         ))
         .discard_result()
 }
+
+pub fn def_mutex<'a, 'c>() -> impl Parser<'a, 'c, ()>
+where
+    'c: 'a,
+{
+    /*
+     * DefMutex := ExtOpPrefix 0x01 NameString SyncFlags
+     * SyncFlags := ByteData (where bits 0-3: SyncLevel
+     *                              bits 4-7: Reserved)
+     */
+    ext_opcode(opcode::EXT_DEF_MUTEX_OP)
+        .then(comment_scope(
+            "DefMutex",
+            name_string().then(take()).map(|(name, sync_flags)| {
+                trace!("Defined mutex with name {} and sync flags {:b}", name, sync_flags);
+                Ok(())
+            }),
+        ))
+        .discard_result()
+}
+
 pub fn term_arg<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
 where
     'c: 'a,