class Metasm::Sh4::Memref

Attributes

action[RW]

action: pre/post (inc/dec)rement

base[RW]

action: pre/post (inc/dec)rement

disp[RW]

action: pre/post (inc/dec)rement

Public Class Methods

new(base, offset, action = nil) click to toggle source
# File metasm/cpu/sh4/main.rb, line 251
def initialize(base, offset, action = nil)
        base = Expression[base] if base.kind_of? Integer
        @base, @disp, @action = base, offset, action
end

Public Instance Methods

render() click to toggle source
# File metasm/cpu/sh4/main.rb, line 277
def render
        if @disp
                #['@(', @base, ',', @disp, ')']
                ['[', @base, '+', @disp, ']']
        else
                case @action
                when :pre then ['[--', @base, ']']
                when :post then ['[', @base, '++]']
                else ['[', @base, ']']
                #when :pre then ['@-', @base]
                #when :post then ['@', @base, '+']
                #else ['@', @base]
                end
        end
end
symbolic(di=nil) click to toggle source
# File metasm/cpu/sh4/main.rb, line 256
def symbolic(di=nil)
        sz = 32
        sz = di.opcode.props[:memsz] if di
        b = @base
        b = b.symbolic if b.kind_of? Reg

        b = Expression[b, :-, sz/8] if @action == :pre

        if disp
                o = @disp
                o = o.symbolic if o.kind_of? Reg
                e = Expression[b, :+, o].reduce
        else
                e = Expression[b].reduce
        end

        Indirection[e, sz, (di.address if di)]
end