def get_flag_write_low_level_il(self, op, size, write_type, flag, operands, il):
        if flag == 'CY':
            if op == LowLevelILOperation.LLIL_RRC:
                return il.and_expr(1, il.reg(1, operands[0]), il.const(1, 0x01))
            elif op == LowLevelILOperation.LLIL_RLC:
                return il.and_expr(1, il.reg(1, operands[0]), il.const(1, 0x80))
 
        return Architecture.perform_get_flag_write_low_level_il(self, op, size, write_type, flag, operands, il)
Exemple #2
0
    def get_flag_write_low_level_il(self, op, size, write_type, flag, operands,
                                    il):
        flag_il = Z80IL.gen_flag_il(op, size, write_type, flag, operands, il)
        if flag_il:
            return flag_il

        return Architecture.get_flag_write_low_level_il(
            self, op, size, write_type, flag, operands, il)
Exemple #3
0
	def perform_get_flag_write_low_level_il(self, op, size, write_type, flag, operands, il):
		if flag == 'c':
			if (op == LowLevelILOperation.LLIL_SUB) or (op == LowLevelILOperation.LLIL_SBB):
				# Subtraction carry flag is inverted from the commom implementation
				return il.not_expr(0, self.get_default_flag_write_low_level_il(op, size, FlagRole.CarryFlagRole, operands, il))
			# Other operations use a normal carry flag
			return self.get_default_flag_write_low_level_il(op, size, FlagRole.CarryFlagRole, operands, il)
		return Architecture.perform_get_flag_write_low_level_il(self, op, size, write_type, flag, operands, il)
 def get_flag_write_low_level_il(self, op, size, write_type, flag, operands,
                                 il):
     return Architecture.get_flag_write_low_level_il(
         self, op, size, write_type, flag, operands, il)
Exemple #5
0
    def __init__(self):
        Architecture.__init__(self)

        basepath = os.path.dirname(os.path.realpath(__file__))
        with open(os.path.join(basepath, 'opcodes.json')) as fin:
            self.opcodes = json.load(fin)