bool is_call() const { return is_bl() || is_far_call() || is_ic_call(); }
bool is_branch() const { return is_b() || is_bl(); }
//-------------------------------------------------------------------------- // // load file into the database. // void idaapi load_file(linput_t *li, ushort /*neflag*/, const char * /*fileformatname*/) { // int i; aif_header_t hd; if ( ph.id != PLFM_ARM ) set_processor_type("arm", SETPROC_ALL|SETPROC_FATAL); lread(li,&hd,sizeof(hd)); mf = uchar(match_zero_code(hd) - 1); if ( (hd.address_mode & 0xFF) != 32 ) { if ( (hd.address_mode & 0xFF) != 0 ) loader_failure("26-bit modules are not supported"); msg("Old AIF format file..."); } if ( hd.decompress_code != NOP ) loader_failure("Compressed modules are not supported"); if ( hd.self_reloc_code != NOP ) loader_failure("Self-relocating modules are not supported"); inf.baseaddr = 0; int isexec = is_bl(hd.entry_point); uint32 offset = sizeof(aif_header_t); uint32 start = hd.image_base; if ( isexec ) { start += sizeof(aif_header_t); hd.readonly_size -= sizeof(aif_header_t); } uint32 end = start + hd.readonly_size; file2base(li, offset, start, end, FILEREG_PATCHABLE); offset += hd.readonly_size; create_section(1, start, end, NAME_CODE, CLASS_CODE); if ( hd.readwrite_size != 0 ) { start = (hd.address_mode & AIF_SEP_DATA) ? hd.data_base : end; end = start + hd.readwrite_size; file2base(li, offset, start, end, FILEREG_PATCHABLE); offset += hd.readwrite_size; create_section(2, start, end, NAME_DATA, CLASS_DATA); } if ( hd.zero_init_size != 0 ) { start = end; end = start + hd.zero_init_size; create_section(3, start, end, NAME_BSS, CLASS_BSS); } create_filename_cmt(); if ( isexec ) hd.entry_point = hd.image_base + offsetof(aif_header_t,entry_point) + ((hd.entry_point & ~BLMASK) << 2) + 8; inf.start_cs = 1; inf.startIP = hd.entry_point; inf.beginEA = hd.entry_point; if ( hd.debug_size != 0 ) { msg("Debugging information is present (%u bytes at file offset 0x%X)...\n", hd.debug_size, offset); uchar *di = qalloc_array<uchar>(size_t(hd.debug_size)); if ( di == NULL ) nomem("AIF debugging info"); qlseek(li,offset); lread(li, di, size_t(hd.debug_size)); uchar *ptr = di; uchar *end = di + size_t(hd.debug_size); section_t *sect = NULL; while ( ptr < end ) { size_t len = process_item(ptr, end-ptr, sect); if ( len == 0 ) { warning("Corrupted debug info."); break; } ptr += len; } qfree(di); } }