Class: SeccompTools::Instruction::MISC

Inherits:
Base
  • Object
show all
Defined in:
lib/seccomp-tools/instruction/misc.rb

Overview

Instruction misc, copies a value between the A and X registers.

Constant Summary

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_MODE_STRICT, Const::BPF::SECCOMP_RET_ACTION_FULL, Const::BPF::SECCOMP_RET_DATA, Const::BPF::SECCOMP_SET_MODE_FILTER, Const::BPF::SECCOMP_SET_MODE_STRICT, Const::BPF::SIZEOF_SECCOMP_DATA, Const::BPF::SRC

Instance Method Summary collapse

Methods inherited from Base

#initialize, #invalid

Methods included from Const::BPF

action_label

Constructor Details

This class inherits a constructor from SeccompTools::Instruction::Base

Instance Method Details

#branch(state) ⇒ Array<(Integer, Symbolic::State)>

Parameters:

Returns:

  • (Array<(Integer, Symbolic::State)>)

    Always the next line, with the copied value recorded in the register.



31
32
33
34
35
36
# File 'lib/seccomp-tools/instruction/misc.rb', line 31

def branch(state)
  case op
  when :txa then [[line + 1, state.with(a: state.x)]]
  when :tax then [[line + 1, state.with(x: state.a)]]
  end
end

#decompileString

Decompile instruction.

Returns:

  • (String)

    Either "A = X" or "X = A".



12
13
14
15
16
17
# File 'lib/seccomp-tools/instruction/misc.rb', line 12

def decompile
  case op
  when :txa then 'A = X'
  when :tax then 'X = A'
  end
end

#symbolize[:misc, (:tax, :txa)]

Returns:

  • ([:misc, (:tax, :txa)])

    :tax copies A into X, :txa copies X into A.



22
23
24
# File 'lib/seccomp-tools/instruction/misc.rb', line 22

def symbolize
  [:misc, op]
end