void bm_AddBlock(RuntimeBlockInfo* blk) { /* if (IsOnRam(blk->addr) && PageIsConst(blk->addr)) { blocks_page[(blk->addr&RAM_MASK)/PAGE_SIZE].push_back(blk); } */ all_blocks.push_back(blk); if (blkmap.find(blk)!=blkmap.end()) { printf("DUP: %08X %08X %08X %08X\n", (*blkmap.find(blk))->addr,(*blkmap.find(blk))->code,blk->addr,blk->code); verify(false); } blkmap.insert(blk); verify(bm_GetCode(blk->addr)==ngen_FailedToFindBlock); FPCA(blk->addr)=blk->code; #ifdef DYNA_OPROF if (oprofHandle) { char fname[512]; sprintf(fname,"sh4:%08X,c:%d,s:%d,h:%d",blk->addr,blk->guest_cycles,blk->guest_opcodes,blk->host_opcodes); if (op_write_native_code(oprofHandle, fname, (uint64_t)blk->code, (void*)blk->code, blk->host_code_size) != 0) { printf("op_write_native_code error\n"); } } #endif }
RuntimeBlockInfo* DYNACALL bm_GetBlock(u32 addr) { DynarecCodeEntry* cde=bm_GetCode(addr); if (cde==ngen_FailedToFindBlock) return 0; else return bm_GetBlock((void*)cde); }
void ngen_mainloop(void* v_cntx) { Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB)); cycle_counter = 0; for (;;) { cycle_counter = SH4_TIMESLICE; do { DynarecCodeEntryPtr rcb = bm_GetCode(ctx->cntx.pc); rcb(); } while (cycle_counter > 0); if (UpdateSystem()) { rdv_DoInterrupts_pc(ctx->cntx.pc); } } }
DynarecCodeEntry* DYNACALL bm_GetCode2(u32 addr) { return bm_GetCode(addr); }
DynarecCodeEntryPtr DYNACALL bm_GetCode2(u32 addr) { return (DynarecCodeEntryPtr)bm_GetCode(addr); }