// The kernel event notifications // Here you may take desired actions upon some kernel events static int notify(processor_t::idp_notify msgid, ...) { va_list va; va_start(va, msgid); // A well behavior processor module should call invoke_callbacks() // in his notify() function. If this function returns 0, then // the processor module should process the notification itself // Otherwise the code should be returned to the caller: int code = invoke_callbacks(HT_IDP, msgid, va); if ( code ) return code; switch ( msgid ) { case processor_t::init: inf.mf = 1; helper.create("$ fr"); default: break; case processor_t::term: free_ioports(ports, numports); break; case processor_t::newfile: choose_device(); set_device_name(device, IORESP_ALL); break; case processor_t::oldfile: { char buf[MAXSTR]; if ( helper.supval(-1, buf, sizeof(buf)) > 0 ) set_device_name(buf, IORESP_NONE); } break; case processor_t::closebase: case processor_t::savebase: helper.supset(-1, device); break; } va_end(va); return(1); }
// The kernel event notifications // Here you may take desired actions upon some kernel events static int notify(processor_t::idp_notify msgid, ...) { va_list va; va_start(va, msgid); // A well behavior processor module should call invoke_callbacks() // in his notify() function. If this function returns 0, then // the processor module should process the notification itself // Otherwise the code should be returned to the caller: int code = invoke_callbacks(HT_IDP, msgid, va); if ( code ) return code; switch ( msgid ) { case processor_t::newfile: helper.create("$ m7700"); if ( choose_device() ) set_device_name(device, IORESP_ALL); // Set the default segment register values : // -1 (badsel) for DR // 0 for fM and fX for ( segment_t *s=get_first_seg(); s != NULL; s=get_next_seg(s->startEA) ) { SetDefaultRegisterValue(s, rDR, BADSEL); SetDefaultRegisterValue(s, rfM, 0); SetDefaultRegisterValue(s, rfX, 0); } info(m7700_help_message); break; case processor_t::term: free_ioports(ports, numports); default: break; case processor_t::newprc: ptype = processor_subtype_t(va_arg(va, int)); break; case processor_t::setsgr: { ea_t ea1 = va_arg(va, ea_t); ea_t ea2 = va_arg(va, ea_t); int reg = va_arg(va, int); sel_t v = va_arg(va, sel_t); sel_t ov = va_arg(va, sel_t); if ( (reg == rfM || reg == rfX) && v != ov ) set_sreg_at_next_code(ea1, ea2, reg, ov); } break; case processor_t::oldfile: helper.create("$ m7700"); { char buf[MAXSTR]; if ( helper.supval(-1, buf, sizeof(buf)) > 0 ) set_device_name(buf, IORESP_ALL); } break; case processor_t::savebase: case processor_t::closebase: helper.supset(-1, device); break; } va_end(va); return(1); }
// The kernel event notifications // Here you may take desired actions upon some kernel events static int idaapi notify(processor_t::idp_notify msgid, ...) { va_list va; va_start(va, msgid); // A well behavior processor module should call invoke_callbacks() // in his notify() function. If this function returns 0, then // the processor module should process the notification itself // Otherwise the code should be returned to the caller: int code = invoke_callbacks(HT_IDP, msgid, va); if ( code ) return code; switch ( msgid ) { case processor_t::init: inf.mf = 1; helper.create("$ fr"); default: break; case processor_t::term: free_ioports(ports, numports); break; case processor_t::newfile: choose_device(); set_device_name(device, IORESP_ALL); break; case processor_t::oldfile: { char buf[MAXSTR]; if ( helper.supval(-1, buf, sizeof(buf)) > 0 ) set_device_name(buf, IORESP_NONE); } break; case processor_t::closebase: case processor_t::savebase: helper.supset(-1, device); break; case processor_t::is_basic_block_end: return is_basic_block_end() ? 2 : 0; #ifdef FR_TYPEINFO_SUPPORT // +++ TYPE CALLBACKS case processor_t::max_ptr_size: return 4+1; case processor_t::get_default_enum_size: // get default enum size // args: cm_t cm // returns: sizeof(enum) { // cm_t cm = va_argi(va, cm_t); return 1; // inf.cc.size_e; } case processor_t::based_ptr: { uint ptrt = va_arg(va, unsigned int); qnotused(ptrt); char **ptrname = va_arg(va, char **); *ptrname = NULL; return 0; // returns: size of type } case processor_t::get_stkarg_offset2: // get offset from SP to the first stack argument // args: none // returns: the offset+2 return 0x00 + 2; case processor_t::calc_cdecl_purged_bytes2: // calculate number of purged bytes after call { //ea_t ea = va_arg(va, ea_t); return 0x00 + 2; } #endif // FR_TYPEINFO_SUPPORT #ifdef FR_TINFO_SUPPORT case processor_t::decorate_name3: { qstring *outbuf = va_arg(va, qstring *); const char *name = va_arg(va, const char *); bool mangle = va_argi(va, bool); cm_t cc = va_argi(va, cm_t); return gen_decorate_name3(outbuf, name, mangle, cc) ? 2 : 0; } case processor_t::calc_retloc3: //msg("calc_retloc3\n"); { const tinfo_t *type = va_arg(va, const tinfo_t *); cm_t cc = va_argi(va, cm_t); argloc_t *retloc = va_arg(va, argloc_t *); return calc_fr_retloc(*type, cc, retloc) ? 2 : -1; } break; case processor_t::calc_varglocs3: return 1; // not implemented break; case processor_t::calc_arglocs3: { //msg("calc_arglocs3\n"); func_type_data_t *fti = va_arg(va, func_type_data_t *); return calc_fr_arglocs(fti) ? 2 : -1; } case processor_t::use_stkarg_type3: { //msg("use_stkarg_type3\n"); ea_t ea = va_arg(va, ea_t); const funcarg_t *arg = va_arg(va, const funcarg_t* ); } return false; break; case processor_t::use_regarg_type3: //msg("use_regarg_type3\n"); { int *used = va_arg(va, int *); ea_t ea = va_arg(va, ea_t); const funcargvec_t *rargs = va_arg(va, const funcargvec_t *); *used = use_fr_regarg_type(ea, *rargs); return 2; } break; case processor_t::use_arg_types3: { ea_t ea = va_arg(va, ea_t); func_type_data_t *fti = va_arg(va, func_type_data_t *); funcargvec_t *rargs = va_arg(va, funcargvec_t *); use_fr_arg_types(ea, fti, rargs); return 2; } #ifdef IDA65 case processor_t::get_fastcall_regs2: case processor_t::get_varcall_regs2: { const int **regs = va_arg(va, const int **); return get_fr_fastcall_regs(regs) + 2; } case processor_t::get_thiscall_regs2: { const int **regs = va_arg(va, const int **); *regs = NULL; return 2; } #else case processor_t::get_fastcall_regs3: case processor_t::get_varcall_regs3: { const int *regs; get_fr_fastcall_regs(®s); callregs_t *callregs = va_arg(va, callregs_t *); callregs->set(ARGREGS_INDEPENDENT, regs, NULL); return callregs->nregs + 2; } case processor_t::get_thiscall_regs3: { callregs_t *callregs = va_arg(va, callregs_t *); callregs->reset(); return 2; } #endif IDA65 #endif // FR_TINFO_SUPPORT } va_end(va); return(1); }
static int notify(processor_t::idp_notify msgid, ...) { va_list va; va_start(va, msgid); // A well behaving processor module should call invoke_callbacks() // in his notify() function. If this function returns 0, then // the processor module should process the notification itself // Otherwise the code should be returned to the caller: int code = invoke_callbacks(HT_IDP, msgid, va); if ( code ) return code; switch(msgid) { case processor_t::init: // __emit__(0xCC); // debugger trap helper.create("$ f2mc"); { char buf[MAXSTR]; if ( helper.supval(0, buf, sizeof(buf)) > 0 ) f2mc_set_device_name(buf, IORESP_NONE); } inf.wide_high_byte_first = 1; break; case processor_t::term: free_ioports(ports, numports); default: break; case processor_t::newfile: // new file loaded set_segm_name(get_first_seg(), "CODE"); if ( choose_ioport_device(cfgname, device, sizeof(device), parse_area_line0) ) f2mc_set_device_name(device, IORESP_ALL); for ( int i = DTB; i <= rVds; i++ ) { for ( segment_t *s=get_first_seg(); s != NULL; s=get_next_seg(s->startEA) ) SetDefaultRegisterValue(s, i, 0); } break; case processor_t::oldfile: // old file loaded idpflags = (ushort)helper.altval(-1); break; case processor_t::closebase: case processor_t::savebase: helper.altset(-1, idpflags); break; case processor_t::newprc: // new processor type { ptype = ptypes[va_arg(va, int)]; switch ( ptype ) { case F2MC16L: cfgname = "f2mc16l.cfg"; break; case F2MC16LX: cfgname = "f2mc16lx.cfg"; break; default: error("interr: setprc"); break; } device[0] = '\0'; if ( get_first_seg() != NULL ) choose_device(NULL, 0); } break; case processor_t::newasm: // new assembler type break; case processor_t::newseg: // new segment break; } va_end(va); return 1; }