Browse Source

Parse DefNoop

Isaac Woods 4 years ago
parent
commit
8b5b45795b
2 changed files with 13 additions and 2 deletions
  1. 1 0
      aml/src/opcode.rs
  2. 12 2
      aml/src/type1.rs

+ 1 - 0
aml/src/opcode.rs

@@ -37,6 +37,7 @@ pub const EXT_DEF_PROCESSOR_OP: u8 = 0x83;
  */
 pub const DEF_IF_ELSE_OP: u8 = 0xa0;
 pub const DEF_ELSE_OP: u8 = 0xa1;
+pub const DEF_NOOP_OP: u8 = 0xa3;
 pub const DEF_RETURN_OP: u8 = 0xa4;
 
 /*

+ 12 - 2
aml/src/type1.rs

@@ -1,6 +1,6 @@
 use crate::{
     opcode::{self, opcode},
-    parser::{choice, comment_scope, take_to_end_of_pkglength, ParseResult, Parser},
+    parser::{choice, comment_scope, id, take_to_end_of_pkglength, ParseResult, Parser},
     pkg_length::{pkg_length, PkgLength},
     term_object::{term_arg, term_list},
     AmlError,
@@ -17,7 +17,7 @@ where
      *                DefNotify | DefRelease | DefReset | DefReturn | DefSignal | DefSleep | DefStall |
      *                DefWhile
      */
-    comment_scope(DebugVerbosity::AllScopes, "Type1Opcode", choice!(def_if_else(), def_return()))
+    comment_scope(DebugVerbosity::AllScopes, "Type1Opcode", choice!(def_if_else(), def_noop(), def_return()))
 }
 
 fn def_if_else<'a, 'c>() -> impl Parser<'a, 'c, ()>
@@ -70,6 +70,16 @@ where
         .discard_result()
 }
 
+fn def_noop<'a, 'c>() -> impl Parser<'a, 'c, ()>
+where
+    'c: 'a,
+{
+    /*
+     * DefNoop := 0xa3
+     */
+    opcode(opcode::DEF_NOOP_OP).then(comment_scope(DebugVerbosity::AllScopes, "DefNoop", id())).discard_result()
+}
+
 fn def_return<'a, 'c>() -> impl Parser<'a, 'c, ()>
 where
     'c: 'a,