2
0
Эх сурвалжийг харах

Parse DefExternal

I don't think we actually need to do anything when we come across a DefExternal,
as hopefully they'll randomly appear at the correct points, but we don't
want to trip up if we encounter one.
Isaac Woods 3 жил өмнө
parent
commit
188d62fdab

+ 1 - 0
aml/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 DEF_EXTERNAL_OP: u8 = 0x15;
 pub const EXT_DEF_MUTEX_OP: u8 = 0x01;
 pub const EXT_REVISION_OP: u8 = 0x30;
 pub const EXT_DEF_OP_REGION_OP: u8 = 0x80;

+ 15 - 0
aml/src/term_object.rs

@@ -101,6 +101,7 @@ where
             def_op_region(),
             def_field(),
             def_method(),
+            def_external(),
             def_device(),
             def_processor(),
             def_power_res(),
@@ -389,6 +390,20 @@ where
         .discard_result()
 }
 
+pub fn def_external<'a, 'c>() -> impl Parser<'a, 'c, ()>
+where
+    'c: 'a,
+{
+    /*
+     * DefExternal = 0x15 NameString ObjectType ArgumentCount
+     * ObjectType := ByteData
+     * ArgumentCount := ByteData (0 to 7)
+     */
+    opcode(opcode::DEF_EXTERNAL_OP)
+        .then(comment_scope(DebugVerbosity::Scopes, "DefExternal", name_string().then(take()).then(take())))
+        .discard_result()
+}
+
 pub fn def_device<'a, 'c>() -> impl Parser<'a, 'c, ()>
 where
     'c: 'a,