Class: SeccompTools::Instruction::ALU
- Defined in:
- lib/seccomp-tools/instruction/alu.rb
Overview
Instruction alu.
Constant Summary collapse
- OP_SYM =
Mapping from name to operator.
{ add: :+, sub: :-, mul: :*, div: :/, or: :|, and: :&, lsh: :<<, rsh: :>>, # neg: :-, # should not be invoked # mod: :%, # unsupported xor: :^ }.freeze
Constants included from Const::BPF
Const::BPF::ACTION, Const::BPF::COMMAND, Const::BPF::JMP, Const::BPF::MISCOP, Const::BPF::MODE, Const::BPF::OP, Const::BPF::PR_SET_SECCOMP, Const::BPF::SECCOMP_MODE_FILTER, Const::BPF::SECCOMP_RET_ACTION_FULL, Const::BPF::SECCOMP_RET_DATA, Const::BPF::SECCOMP_SET_MODE_FILTER, Const::BPF::SIZEOF_SECCOMP_DATA, Const::BPF::SRC
Instance Method Summary collapse
-
#branch(context) ⇒ Array<(Integer, Context)>
See Base#branch.
-
#decompile ⇒ Object
Decompile instruction.
-
#symbolize ⇒ [:alu, Symbol, (:x, Integer, nil)]
See Base#symbolize.
Methods inherited from Base
Constructor Details
This class inherits a constructor from SeccompTools::Instruction::Base
Instance Method Details
#branch(context) ⇒ Array<(Integer, Context)>
See Base#branch.
42 43 44 45 46 |
# File 'lib/seccomp-tools/instruction/alu.rb', line 42 def branch(context) ctx = context.dup ctx[:a] = Disasm::Context::Value.new [[line + 1, ctx]] end |
#decompile ⇒ Object
Decompile instruction.
24 25 26 27 28 |
# File 'lib/seccomp-tools/instruction/alu.rb', line 24 def decompile return 'A = -A' if op == :neg "A #{op_sym}= #{src_str}" end |
#symbolize ⇒ [:alu, Symbol, (:x, Integer, nil)]
See Base#symbolize.
32 33 34 35 36 |
# File 'lib/seccomp-tools/instruction/alu.rb', line 32 def symbolize return [:alu, :neg, nil] if op == :neg [:alu, op_sym, src] end |