angr_platforms/msp430/instrs_msp430.py
def decorate_src(self, src_bits, mode_bits, imm_bits):
        """
        Computes the decorated source operand for disassembly
        """
        src = ArchMSP430.register_index[int(src_bits, 2)]
        src_mode = int(mode_bits, 2)
        # Load the immediate word
        src_imm = None
        if imm_bits:
            src_imm = bits_to_signed_int(imm_bits)
        # Symbolic and Immediate modes use the PC as the source.
        if src == 'pc':
            if src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.SYMBOLIC_MODE
            elif src_mode == ArchMSP430.Mode.INDIRECT_AUTOINCREMENT_MODE:
                src_mode = ArchMSP430.Mode.IMMEDIATE_MODE
        # Resolve the constant generator stuff.
        elif src == 'cg':
            if src_mode == ArchMSP430.Mode.REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE0
            elif src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE1
            elif src_mode == ArchMSP430.Mode.INDIRECT_REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE2
            else:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE_NEG1
        # If you use the SR as the source. things get weird.
        elif src == 'sr':
            if src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.ABSOLUTE_MODE
            elif src_mode == ArchMSP430.Mode.INDIRECT_REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE4
            elif src_mode == ArchMSP430.Mode.INDIRECT_AUTOINCREMENT_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE8
        # Fetch constants
        if src_mode == ArchMSP430.Mode.CONSTANT_MODE0:
            src_str = "#0"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE1:
            src_str = "#1"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE2:
            src_str = "#2"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE4:
            src_str = "#4"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE8:
            src_str = "#8"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE_NEG1:
            src_str = "#-1"
        # Fetch immediate.
        elif src_mode == ArchMSP430.Mode.IMMEDIATE_MODE:
            src_str = str(bits_to_signed_int(imm_bits))
        # Symbolic mode: Add the immediate to the PC
        elif src_mode == ArchMSP430.Mode.SYMBOLIC_MODE:
            src_str = "%s+%d" % (src, bits_to_signed_int(imm_bits))
        else:
            # Register mode can write-out to the source for one-operand, so set the writeout
            src_str = self.decorate_reg(src, src_mode, src_imm)
        return src_str

        Computes the decorated source operand for disassembly
        
Computes the decorated source operand for disassembly
Computes the decorated source operand for disassembly
def decorate_src(self, src_bits, mode_bits, imm_bits):
        src = ArchMSP430.register_index[int(src_bits, 2)]
        src_mode = int(mode_bits, 2)
        src_imm = None
        if imm_bits:
            src_imm = bits_to_signed_int(imm_bits)
        if src == 'pc':
            if src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.SYMBOLIC_MODE
            elif src_mode == ArchMSP430.Mode.INDIRECT_AUTOINCREMENT_MODE:
                src_mode = ArchMSP430.Mode.IMMEDIATE_MODE
        elif src == 'cg':
            if src_mode == ArchMSP430.Mode.REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE0
            elif src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE1
            elif src_mode == ArchMSP430.Mode.INDIRECT_REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE2
            else:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE_NEG1
        elif src == 'sr':
            if src_mode == ArchMSP430.Mode.INDEXED_MODE:
                src_mode = ArchMSP430.Mode.ABSOLUTE_MODE
            elif src_mode == ArchMSP430.Mode.INDIRECT_REGISTER_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE4
            elif src_mode == ArchMSP430.Mode.INDIRECT_AUTOINCREMENT_MODE:
                src_mode = ArchMSP430.Mode.CONSTANT_MODE8
        if src_mode == ArchMSP430.Mode.CONSTANT_MODE0:
            src_str = "#0"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE1:
            src_str = "#1"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE2:
            src_str = "#2"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE4:
            src_str = "#4"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE8:
            src_str = "#8"
        elif src_mode == ArchMSP430.Mode.CONSTANT_MODE_NEG1:
            src_str = "#-1"
        elif src_mode == ArchMSP430.Mode.IMMEDIATE_MODE:
            src_str = str(bits_to_signed_int(imm_bits))
        elif src_mode == ArchMSP430.Mode.SYMBOLIC_MODE:
            src_str = "%s+%d" % (src, bits_to_signed_int(imm_bits))
        else:
            src_str = self.decorate_reg(src, src_mode, src_imm)
        return src_str
def decorate_src ( self , src_bits , mode_bits , imm_bits ) : src = ArchMSP430 . register_index [ int ( src_bits , 2 ) ] src_mode = int ( mode_bits , 2 ) src_imm = None if imm_bits : src_imm = bits_to_signed_int ( imm_bits ) if src == 'pc' : if src_mode == ArchMSP430 . Mode . INDEXED_MODE : src_mode = ArchMSP430 . Mode . SYMBOLIC_MODE elif src_mode == ArchMSP430 . Mode . INDIRECT_AUTOINCREMENT_MODE : src_mode = ArchMSP430 . Mode . IMMEDIATE_MODE elif src == 'cg' : if src_mode == ArchMSP430 . Mode . REGISTER_MODE : src_mode = ArchMSP430 . Mode . CONSTANT_MODE0 elif src_mode == ArchMSP430 . Mode . INDEXED_MODE : src_mode = ArchMSP430 . Mode . CONSTANT_MODE1 elif src_mode == ArchMSP430 . Mode . INDIRECT_REGISTER_MODE : src_mode = ArchMSP430 . Mode . CONSTANT_MODE2 else : src_mode = ArchMSP430 . Mode . CONSTANT_MODE_NEG1 elif src == 'sr' : if src_mode == ArchMSP430 . Mode . INDEXED_MODE : src_mode = ArchMSP430 . Mode . ABSOLUTE_MODE elif src_mode == ArchMSP430 . Mode . INDIRECT_REGISTER_MODE : src_mode = ArchMSP430 . Mode . CONSTANT_MODE4 elif src_mode == ArchMSP430 . Mode . INDIRECT_AUTOINCREMENT_MODE : src_mode = ArchMSP430 . Mode . CONSTANT_MODE8 if src_mode == ArchMSP430 . Mode . CONSTANT_MODE0 : src_str = "#0" elif src_mode == ArchMSP430 . Mode . CONSTANT_MODE1 : src_str = "#1" elif src_mode == ArchMSP430 . Mode . CONSTANT_MODE2 : src_str = "#2" elif src_mode == ArchMSP430 . Mode . CONSTANT_MODE4 : src_str = "#4" elif src_mode == ArchMSP430 . Mode . CONSTANT_MODE8 : src_str = "#8" elif src_mode == ArchMSP430 . Mode . CONSTANT_MODE_NEG1 : src_str = "#-1" elif src_mode == ArchMSP430 . Mode . IMMEDIATE_MODE : src_str = str ( bits_to_signed_int ( imm_bits ) ) elif src_mode == ArchMSP430 . Mode . SYMBOLIC_MODE : src_str = "%s+%d" % ( src , bits_to_signed_int ( imm_bits ) ) else : src_str = self . decorate_reg ( src , src_mode , src_imm ) return src_str
Computes the decorated source operand for disassembly
Computes the decorated source operand for disassembly
"""
        Computes the decorated source operand for disassembly
        """ # Load the immediate word # Symbolic and Immediate modes use the PC as the source. # Resolve the constant generator stuff. # If you use the SR as the source. things get weird. # Fetch constants # Fetch immediate. # Symbolic mode: Add the immediate to the PC # Register mode can write-out to the source for one-operand, so set the writeout
self
src_bits
mode_bits
imm_bits