Class: Haxor::Compiler::Component::Jumps

Inherits:
Base
  • Object
show all
Defined in:
lib/haxor/compiler/component/jumps.rb

Instance Attribute Summary

Attributes inherited from Base

#compiler

Instance Method Summary collapse

Methods inherited from Base

#add, #bind_cmd, #offset?, #offset_flags, #parse_value, #strip_offset

Instance Method Details

#cmd_call(a) ⇒ Object



25
26
27
28
# File 'lib/haxor/compiler/component/jumps.rb', line 25

def cmd_call(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_CALL | offset_flags(a))
  parse_value a
end

#cmd_iret(*_args) ⇒ Object



34
35
36
# File 'lib/haxor/compiler/component/jumps.rb', line 34

def cmd_iret(*_args)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_IRET)
end

#cmd_je(a) ⇒ Object



43
44
45
46
# File 'lib/haxor/compiler/component/jumps.rb', line 43

def cmd_je(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JE)
  parse_value a
end

#cmd_jg(a) ⇒ Object



48
49
50
51
# File 'lib/haxor/compiler/component/jumps.rb', line 48

def cmd_jg(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JG)
  parse_value a
end

#cmd_jge(a) ⇒ Object



53
54
55
56
# File 'lib/haxor/compiler/component/jumps.rb', line 53

def cmd_jge(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JGE)
  parse_value a
end

#cmd_jl(a) ⇒ Object



58
59
60
61
# File 'lib/haxor/compiler/component/jumps.rb', line 58

def cmd_jl(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JL)
  parse_value a
end

#cmd_jle(a) ⇒ Object



63
64
65
66
# File 'lib/haxor/compiler/component/jumps.rb', line 63

def cmd_jle(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JLE)
  parse_value a
end

#cmd_jmp(a) ⇒ Object



38
39
40
41
# File 'lib/haxor/compiler/component/jumps.rb', line 38

def cmd_jmp(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JMP | offset_flags(a))
  parse_value a
end

#cmd_jne(a) ⇒ Object



68
69
70
71
# File 'lib/haxor/compiler/component/jumps.rb', line 68

def cmd_jne(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JNE)
  parse_value a
end

#cmd_jng(a) ⇒ Object



73
74
75
76
# File 'lib/haxor/compiler/component/jumps.rb', line 73

def cmd_jng(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JNG)
  parse_value a
end

#cmd_jnge(a) ⇒ Object



78
79
80
81
# File 'lib/haxor/compiler/component/jumps.rb', line 78

def cmd_jnge(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JNGE)
  parse_value a
end

#cmd_jnl(a) ⇒ Object



83
84
85
86
# File 'lib/haxor/compiler/component/jumps.rb', line 83

def cmd_jnl(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JNL)
  parse_value a
end

#cmd_jnle(a) ⇒ Object



88
89
90
91
# File 'lib/haxor/compiler/component/jumps.rb', line 88

def cmd_jnle(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_JNLE)
  parse_value a
end

#cmd_ret(*_args) ⇒ Object



30
31
32
# File 'lib/haxor/compiler/component/jumps.rb', line 30

def cmd_ret(*_args)
  add Token::Cmd.new(Vm::Cpu::Unit::Jumps::OP_RET)
end

#register ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/haxor/compiler/component/jumps.rb', line 5

def register
  bind_cmd 'call', :cmd_call
  bind_cmd 'ret', :cmd_ret
  bind_cmd 'iret', :cmd_iret

  bind_cmd 'jmp', :cmd_jmp

  bind_cmd 'je',  :cmd_je
  bind_cmd 'jg',  :cmd_jg
  bind_cmd 'jge', :cmd_jge
  bind_cmd 'jl',  :cmd_jl
  bind_cmd 'jle', :cmd_jle

  bind_cmd 'jne',  :cmd_jne
  bind_cmd 'jng',  :cmd_jng
  bind_cmd 'jnge', :cmd_jnge
  bind_cmd 'jnl',  :cmd_jnl
  bind_cmd 'jnle', :cmd_jnle
end