Both recompilers now check for interrupt after every instruction and exit the block if one has happened.

This commit is contained in:
OBattler
2020-07-13 01:23:40 +02:00
parent 099fd2fc34
commit 0cd0d83cee
6 changed files with 58 additions and 2 deletions

View File

@@ -2062,6 +2062,15 @@ generate_call:
codegen_block_full_ins++;
codegen_endpc = (cs + cpu_state.pc) + 8;
/* Check for interrupts. */
addbyte(0xE8); /*CALL*/
addlong(((uint8_t *)int_check - (uint8_t *)(&block->data[block_pos + 4])));
addbyte(0x09); /*OR %eax, %eax*/
addbyte(0xc0);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4]));
return;
}
}
@@ -2150,6 +2159,15 @@ generate_call:
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4]));
/* Check for interrupts. */
addbyte(0xE8); /*CALL*/
addlong(((uint8_t *)int_check - (uint8_t *)(&block->data[block_pos + 4])));
addbyte(0x09); /*OR %eax, %eax*/
addbyte(0xc0);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4]));
codegen_endpc = (cs + cpu_state.pc) + 8;
}