def is_func_prolog(ea, reg_check=True): if ea % 2 != 0: return NONE # function prolog requires at least four bytes if any(not ida_bytes.is_mapped(ea + i) for i in range(4)): return NONE word = ida_bytes.get_word(ea) next_word = ida_bytes.get_word(ea + 2) # check thumb PUSH.W if word == 0xE92D: # PUSH LR if not reg_check or is_valid_reglist(next_word, False): return THUMB # check thumb PUSH elif (word >> 8) == 0xB5: if not reg_check or is_valid_reglist(word, True): return THUMB # check arm PUSH elif next_word == 0xE92D: if ea % 4 == 0: # PUSH LR if not reg_check or is_valid_reglist(word, False): return ARM return NONE
def is_mapped(ea=None): """ Static method which allow to know if an address is mapped or not. :param ea: The address to test for being mapped or not. If ``None`` the screen address will be used. :return: True if the address is mapped, False otherwise. """ if ea is None: ea = ida_kernwin.get_screen_ea() return ida_bytes.is_mapped(ea)
def isEnabled(ea): return ida_bytes.is_mapped(ea)
def is_mapped(self, address): return ida_bytes.is_mapped(address)