File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 3838 choice ! (
3939 def_add( ) ,
4040 def_and( ) ,
41+ def_or( ) ,
4142 def_buffer( ) ,
4243 def_concat( ) ,
4344 def_concat_res( ) ,
@@ -117,6 +118,32 @@ where
117118 . map ( |( ( ) , result) | Ok ( result) )
118119}
119120
121+ pub fn def_or < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
122+ where
123+ ' c : ' a ,
124+ {
125+ /*
126+ * DefOr := 0x7d Operand Operand Target
127+ * Operand := TermArg => Integer
128+ */
129+ opcode ( opcode:: DEF_OR_OP )
130+ . then ( comment_scope (
131+ DebugVerbosity :: AllScopes ,
132+ "DefOr" ,
133+ term_arg ( ) . then ( term_arg ( ) ) . then ( target ( ) ) . map_with_context (
134+ |( ( left_arg, right_arg) , target) , context| {
135+ let left = try_with_context ! ( context, left_arg. as_integer( context) ) ;
136+ let right = try_with_context ! ( context, right_arg. as_integer( context) ) ;
137+ let result = AmlValue :: Integer ( left | right) ;
138+
139+ try_with_context ! ( context, context. store( target, result. clone( ) ) ) ;
140+ ( Ok ( result) , context)
141+ } ,
142+ ) ,
143+ ) )
144+ . map ( |( ( ) , result) | Ok ( result) )
145+ }
146+
120147pub fn def_buffer < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
121148where
122149 ' c : ' a ,
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ pub const DEF_DECREMENT_OP: u8 = 0x76;
6969pub const DEF_SHIFT_LEFT : u8 = 0x79 ;
7070pub const DEF_SHIFT_RIGHT : u8 = 0x7a ;
7171pub const DEF_AND_OP : u8 = 0x7b ;
72+ pub const DEF_OR_OP : u8 = 0x7d ;
7273pub const DEF_CONCAT_RES_OP : u8 = 0x84 ;
7374pub const DEF_SIZE_OF_OP : u8 = 0x87 ;
7475pub const DEF_OBJECT_TYPE_OP : u8 = 0x8e ;
You can’t perform that action at this time.
0 commit comments