@@ -4,7 +4,7 @@ use crate::{
44 opcode:: { self , opcode} ,
55 parser:: { choice, comment_scope, n_of, take, take_to_end_of_pkglength, try_with_context, Parser , Propagate } ,
66 pkg_length:: pkg_length,
7- term_object:: { data_ref_object, term_arg , def_cond_ref_of } ,
7+ term_object:: { data_ref_object, def_cond_ref_of , term_arg } ,
88 value:: { AmlType , AmlValue , Args } ,
99 AmlError ,
1010 DebugVerbosity ,
5959 def_store( ) ,
6060 def_to_integer( ) ,
6161 def_cond_ref_of( ) ,
62+ def_size_of( ) ,
6263 method_invocation( ) // XXX: this must always appear last. See how we have to parse it to see why.
6364 ) ,
6465 )
@@ -758,6 +759,26 @@ where
758759 } )
759760}
760761
762+ fn def_size_of < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
763+ where
764+ ' c : ' a ,
765+ {
766+ /*
767+ * SizeOf := 0x87 SuperName
768+ */
769+ opcode ( opcode:: DEF_SIZE_OF_OP )
770+ . then ( comment_scope (
771+ DebugVerbosity :: AllScopes ,
772+ "DefSizeOf" ,
773+ super_name ( ) . map_with_context ( |target, context| {
774+ let value = try_with_context ! ( context, context. read_target( & target) ) ;
775+ let size_of = try_with_context ! ( context, value. size_of( ) ) ;
776+ ( Ok ( AmlValue :: Integer ( size_of) ) , context)
777+ } ) ,
778+ ) )
779+ . map ( |( ( ) , value) | Ok ( value) )
780+ }
781+
761782fn method_invocation < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
762783where
763784 ' c : ' a ,
0 commit comments