static int is_interface(unsigned long addr) { u8 * rex; u8 * opcode; u8 * modrm; u8 dispsize; do_disasm(addr, NULL); rex = get_rex_addr(); opcode = get_opcode_addr(); modrm = get_modrm_addr(); dispsize = get_disp_size(); if (!opcode || !modrm) return 0; if ((!rex || ((*rex | 0x06) == 0x46)) && (*opcode == 0x8a || *opcode == 0x8b) && ((*modrm & ~0x38) == 0x85 || (*modrm & ~0x38) == 0x45)) { if (dispsize == 8) { s8 * disp = (s8 *)get_disp_addr(); if (disp && *disp > 0) return 1; return 0; } else if (dispsize == 32) { s32 * disp = (s32 *)get_disp_addr(); if (disp && *disp > 0) return 1; return 0; } } return 0; }
static int is_init(unsigned long addr) { u8 * rex; u8 * opcode; u8 * modrm; u8 dispsize; do_disasm(addr, NULL); rex = get_rex_addr(); opcode = get_opcode_addr(); modrm = get_modrm_addr(); dispsize = get_disp_size(); if (!opcode || !modrm) return 0; if (((rex && (*rex | 0x06 == 0x46)) || !rex) && (*opcode == 0xc6 || *opcode == 0xc7) && (*modrm == 0x45 || *modrm == 0x85)) { if (dispsize == 8) { s8 * disp = (s8 *)get_disp_addr(); if (*disp < 0) return 1; return 0; } else if (dispsize == 32) { s32 * disp = (s32 *)get_disp_addr(); if (*disp < 0) return 1; return 0; } } return 0; }
int size () const { return 1 + (has_sib() ? 1 : 0) + get_disp_size() ; }