// 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: // this processor is big endian inf.mf = 1; default: break; case processor_t::term: free_ioports(ports, numports); break; case processor_t::newfile: if ( choose_ioport_device(cfgname, device, sizeof(device), NULL) ) set_device_name(device, IORESP_ALL); // default configuration if ( refresh_idpflags() == 0 ) { idpflags = 0; idpflags |= NETNODE_USE_INSN_SYNTHETIC; idpflags |= NETNODE_USE_REG_ALIASES; } // patch register names according to idpflags patch_regnames(); break; case processor_t::newprc: ptype = processor_subtype_t(va_arg(va, int)); // msg("ptype = %s\n", ptype == prc_m32r ? "m32r" : ptype == prc_m32rx ? "m32rx" : "???"); break; case processor_t::oldfile: refresh_idpflags(); { char buf[MAXSTR]; if ( helper.supval(-1, buf, sizeof(buf)) > 0 ) set_device_name(buf, IORESP_NONE); } // patch register names according to idpflags patch_regnames(); break; case processor_t::savebase: case processor_t::closebase: // synchronize the database long variable with the current configuration settings #ifdef DEBUG msg("Saving configuration: synthetic insn %s, aliases registers %s\n", use_synthetic_insn() ? "true " : "false", use_reg_aliases() ? "true" : "false" ); #endif helper.altset(-1, idpflags); 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::init: // this processor is big endian inf.mf = 1; refresh_idpflags(); { char buf[MAXSTR]; if ( helper.supval(-1, buf, sizeof(buf)) > 0 ) set_device_name(buf, IORESP_ALL); } break; case processor_t::term: free_reg_names(); default: break; case processor_t::newfile: // default configuration idpflags = CONF_GR_DEC; // patch general registers names patch_general_registers(true); break; case processor_t::newseg: { segment_t *s = va_arg(va, segment_t *); // set RW/RP segment registers initial values s->defsr[rRW-ph.regFirstSreg] = 0; s->defsr[rRP-ph.regFirstSreg] = BADSEL; } break; case processor_t::oldfile: patch_general_registers(); break; case processor_t::closebase: case processor_t::savebase: helper.altset(-1, idpflags); helper.supset(-1, device); break; } va_end(va); return(1); }