Everything here is mostly stolen from vlad's perl sparc stuff
Encodes an OR instruction with the value 'constant' being OR'ed with the 'src' register into the 'dst' register
# File lib/rex/arch/sparc.rb, line 40 def self.ori(src, constant, dst) [ (2 << 30) | (RegisterNumber[dst] << 25) | (2 << 19) | (RegisterNumber[src] << 14) | (1 << 13) | (constant & 0x1fff) ].pack('N') end
Puts 'constant' into the 'dst' register using as few instructions as possible by checking the size of the value. XXX: signedness support
# File lib/rex/arch/sparc.rb, line 55 def self.set(constant, dst) if (constant <= 4095 and constant >= 0) ori('g0', constant, dst) elsif (constant & 0x3ff != 0) set_dword(constant, dst) else sethi(constant, dst) end end
Puts 'constant' into the 'dst' register using both sethi and ori (necessary to use both uncessarily in some cases with encoders)
# File lib/rex/arch/sparc.rb, line 68 def self.set_dword(constant, dst) sethi(constant, dst) + ori(dst, constant & 0x3ff, dst) end
Generated with the Darkfish Rdoc Generator 2.