Class: SeccompTools::Instruction::MISC

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

Overview

Instruction misc.

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_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

Methods inherited from Base

#initialize, #invalid

Constructor Details

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

Instance Method Details

#branch(context) ⇒ Array<(Integer, Context)>

Parameters:

  • context (Context)

    Current context.

Returns:

  • (Array<(Integer, Context)>)


27
28
29
30
31
32
33
34
# File 'lib/seccomp-tools/instruction/misc.rb', line 27

def branch(context)
  ctx = context.dup
  case op
  when :txa then ctx['A'] = ctx['X']
  when :tax then ctx['X'] = ctx['A']
  end
  [[line + 1, ctx]]
end

#decompileObject

Decompile instruction.



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

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

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

Returns:

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


19
20
21
# File 'lib/seccomp-tools/instruction/misc.rb', line 19

def symbolize
  [:misc, op]
end