node/lib/metasm/metasm/cpu/bpf/decode.rb
# populate the @backtrace_binding hash with default values
populate the @backtrace_binding hash with default values
populate the @backtrace_binding hash with default values
def init_backtrace_binding
		@backtrace_binding ||= {}
		opcode_list.map { |ol| ol.basename }.uniq.sort.each { |op|
			binding = case op
			when 'mov'; lambda { |di, a0, a1| { a0 => Expression[a1] } }
			when 'add'; lambda { |di, a0, a1| { a0 => Expression[a0, :+, a1] } }
			when 'sub'; lambda { |di, a0, a1| { a0 => Expression[a0, :-, a1] } }
			when 'mul'; lambda { |di, a0, a1| { a0 => Expression[a0, :*, a1] } }
			when 'div'; lambda { |di, a0, a1| { a0 => Expression[a0, :/, a1] } }
			when 'shl'; lambda { |di, a0, a1| { a0 => Expression[a0, :<<, a1] } }
			when 'shr'; lambda { |di, a0, a1| { a0 => Expression[a0, :>>, a1] } }
			when 'neg'; lambda { |di, a0| { a0 => Expression[:-, a0] } }
			when 'msh'; lambda { |di, a0, a1| { a0 => Expression[[a1, :&, 0xf], :<<, 2] } }
			when 'jmp', 'jg', 'jge', 'je', 'jtest', 'ret'; lambda { |di, *a| { } }
			end
			@backtrace_binding[op] ||= binding if binding
		}
		@backtrace_binding
	end
def init_backtrace_binding @backtrace_binding ||= { } opcode_list . map { | ol | ol . basename } . uniq . sort . each { | op | binding = case op when 'mov' ; lambda { | di , a0 , a1 | { a0 => Expression [ a1 ] } } when 'add' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :+ , a1 ] } } when 'sub' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :- , a1 ] } } when 'mul' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :* , a1 ] } } when 'div' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :/ , a1 ] } } when 'shl' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :<< , a1 ] } } when 'shr' ; lambda { | di , a0 , a1 | { a0 => Expression [ a0 , :>> , a1 ] } } when 'neg' ; lambda { | di , a0 | { a0 => Expression [ :- , a0 ] } } when 'msh' ; lambda { | di , a0 , a1 | { a0 => Expression [ [ a1 , :& , 0xf ] , :<< , 2 ] } } when 'jmp' , 'jg' , 'jge' , 'je' , 'jtest' , 'ret' ; lambda { | di , * a | { } } end @backtrace_binding [ op ] ||= binding if binding } @backtrace_binding end
populate the @backtrace_binding hash with default values
populate the @backtrace_binding hash with default values