571 |
fastcall u_int MTS_PROTO(cache)(cpu_mips_t *cpu,m_uint64_t vaddr,u_int op) |
fastcall u_int MTS_PROTO(cache)(cpu_mips_t *cpu,m_uint64_t vaddr,u_int op) |
572 |
{ |
{ |
573 |
mips64_jit_tcb_t *block; |
mips64_jit_tcb_t *block; |
574 |
m_uint32_t phys_page; |
m_uint32_t pc_hash; |
575 |
|
|
576 |
#if DEBUG_CACHE |
#if DEBUG_CACHE |
577 |
cpu_log(cpu->gen, |
cpu_log(cpu->gen, |
579 |
cpu->pc, vaddr, op & 0x3, op >> 2); |
cpu->pc, vaddr, op & 0x3, op >> 2); |
580 |
#endif |
#endif |
581 |
|
|
582 |
if (!cpu->translate(cpu,vaddr,&phys_page)) { |
if (cpu->exec_blk_map) { |
583 |
if ((phys_page < 1048576) && cpu->exec_phys_map) { |
pc_hash = mips64_jit_get_pc_hash(cpu->pc); |
584 |
block = cpu->exec_phys_map[phys_page]; |
block = cpu->exec_blk_map[pc_hash]; |
585 |
|
|
586 |
if (block) { |
if (block && mips64_jit_tcb_match(cpu,block)) { |
|
if ((cpu->pc < block->start_pc) || |
|
|
((cpu->pc - block->start_pc) >= MIPS_MIN_PAGE_SIZE)) |
|
|
{ |
|
587 |
#if DEBUG_CACHE |
#if DEBUG_CACHE |
588 |
cpu_log(cpu->gen,"MTS", |
cpu_log(cpu->gen,"MTS", |
589 |
"CACHE: removing compiled page at 0x%llx, pc=0x%llx\n", |
"CACHE: removing compiled page at 0x%llx, pc=0x%llx\n", |
590 |
block->start_pc,cpu->pc); |
block->start_pc,cpu->pc); |
591 |
#endif |
#endif |
592 |
cpu->exec_phys_map[phys_page] = NULL; |
cpu->exec_blk_map[pc_hash] = NULL; |
593 |
mips64_jit_tcb_free(cpu,block,TRUE); |
mips64_jit_tcb_free(cpu,block,TRUE); |
594 |
} |
} |
595 |
else |
else |
596 |
{ |
{ |
597 |
#if DEBUG_CACHE |
#if DEBUG_CACHE |
598 |
cpu_log(cpu->gen,"MTS", |
cpu_log(cpu->gen,"MTS", |
599 |
"CACHE: trying to remove page 0x%llx with pc=0x%llx\n", |
"CACHE: trying to remove page 0x%llx with pc=0x%llx\n", |
600 |
block->start_pc,cpu->pc); |
block->start_pc,cpu->pc); |
601 |
#endif |
#endif |
|
} |
|
|
} |
|
602 |
} |
} |
603 |
} |
} |
604 |
|
|