660 |
return(0); |
return(0); |
661 |
} |
} |
662 |
|
|
663 |
|
/* Check if PC register matches the compiled block virtual address */ |
664 |
|
static forced_inline int insn_block_match(cpu_mips_t *cpu,insn_block_t *block) |
665 |
|
{ |
666 |
|
m_uint64_t vpage; |
667 |
|
|
668 |
|
vpage = cpu->pc & ~(m_uint64_t)MIPS_MIN_PAGE_IMASK; |
669 |
|
return(block->start_pc == vpage); |
670 |
|
} |
671 |
|
|
672 |
/* Execute a compiled MIPS code */ |
/* Execute a compiled MIPS code */ |
673 |
void *insn_block_execute(cpu_mips_t *cpu) |
void *insn_block_execute(cpu_mips_t *cpu) |
674 |
{ |
{ |
690 |
cpu->cpu_thread_running = TRUE; |
cpu->cpu_thread_running = TRUE; |
691 |
start_cpu: |
start_cpu: |
692 |
for(;;) { |
for(;;) { |
693 |
if (unlikely(!cpu->pc) || unlikely(cpu->state != MIPS_CPU_RUNNING)) |
if (unlikely(cpu->state != MIPS_CPU_RUNNING)) |
694 |
break; |
break; |
695 |
|
|
696 |
/* Handle virtual idle loop */ |
/* Handle virtual idle loop */ |
723 |
block = cpu->exec_phys_map[phys_page]; |
block = cpu->exec_phys_map[phys_page]; |
724 |
|
|
725 |
/* No block found, compile the page */ |
/* No block found, compile the page */ |
726 |
if (unlikely(!block)) { |
if (unlikely(!block) || unlikely(!insn_block_match(cpu,block))) |
727 |
|
{ |
728 |
|
if (block != NULL) { |
729 |
|
insn_block_free(cpu,block,TRUE); |
730 |
|
cpu->exec_phys_map[phys_page] = NULL; |
731 |
|
} |
732 |
|
|
733 |
block = insn_page_compile(cpu,cpu->pc); |
block = insn_page_compile(cpu,cpu->pc); |
734 |
if (unlikely(!block)) { |
if (unlikely(!block)) { |
735 |
fprintf(stderr, |
fprintf(stderr, |