Browse Source

Implement DefLGreater

Isaac Woods 4 years ago
parent
commit
6424f48a0f
2 changed files with 18 additions and 0 deletions
  1. 1 0
      aml/src/opcode.rs
  2. 17 0
      aml/src/type2.rs

+ 1 - 0
aml/src/opcode.rs

@@ -48,6 +48,7 @@ pub const DEF_SHIFT_RIGHT: u8 = 0x7a;
 pub const DEF_AND_OP: u8 = 0x7b;
 pub const DEF_L_OR_OP: u8 = 0x91;
 pub const DEF_L_EQUAL_OP: u8 = 0x93;
+pub const DEF_L_GREATER_OP: u8 = 0x94;
 
 /*
  * Miscellaneous objects

+ 17 - 0
aml/src/type2.rs

@@ -45,6 +45,7 @@ where
             def_and(),
             def_buffer(),
             def_l_equal(),
+            def_l_greater(),
             def_l_or(),
             def_package(),
             def_shift_left(),
@@ -143,6 +144,22 @@ where
             }),
         ))
         .map(|((), result)| Ok(result))
+}
+
+fn def_l_greater<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
+where
+    'c: 'a,
+{
+    /*
+     * DefLGreater := 0x94 Operand Operand
+     */
+    opcode(opcode::DEF_L_GREATER_OP)
+        .then(comment_scope(
+            DebugVerbosity::AllScopes,
+            "DefLGreater",
+            term_arg().then(term_arg()).map_with_context(|(left_arg, right_arg), context| {
+                let ord = try_with_context!(context, left_arg.cmp(right_arg, context));
+                (Ok(AmlValue::Boolean(ord == Ordering::Greater)), context)
             }),
         ))
         .map(|((), result)| Ok(result))