mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 02:35:29 +00:00
i386: do not cross the pages boundaries in replay mode
This patch denies crossing the boundary of the pages in the replay mode, because it can cause an exception. Do it only when boundary is crossed by the first instruction in the block. If current instruction already crossed the bound - it's ok, because an exception hasn't stopped this code. Backports commit 5b9efc39aee90bbd343793e942bf8f582a0c9e4f from qemu
This commit is contained in:
parent
e73fbde2ce
commit
ee0d7ba219
|
@ -28,6 +28,9 @@
|
|||
#define TARGET_LONG_BITS 32
|
||||
#endif
|
||||
|
||||
/* Maximum instruction code size */
|
||||
#define TARGET_MAX_INSN_SIZE 16
|
||||
|
||||
/* support for self modifying code even if the modified instruction is
|
||||
close to the modifying instruction */
|
||||
#define TARGET_HAS_PRECISE_SMC
|
||||
|
|
|
@ -8765,6 +8765,21 @@ static inline void gen_intermediate_code_internal(uint8_t *gen_opc_cc_op,
|
|||
gen_eob(dc);
|
||||
break;
|
||||
}
|
||||
/* Do not cross the boundary of the pages in icount mode,
|
||||
it can cause an exception. Do it only when boundary is
|
||||
crossed by the first instruction in the block.
|
||||
If current instruction already crossed the bound - it's ok,
|
||||
because an exception hasn't stopped this code.
|
||||
*/
|
||||
/* UNICORN: Commented out
|
||||
if (use_icount
|
||||
&& ((pc_ptr & TARGET_PAGE_MASK)
|
||||
!= ((pc_ptr + TARGET_MAX_INSN_SIZE - 1) & TARGET_PAGE_MASK)
|
||||
|| (pc_ptr & ~TARGET_PAGE_MASK) == 0)) {
|
||||
gen_jmp_im(dc, pc_ptr - dc->cs_base);
|
||||
gen_eob(dc);
|
||||
break;
|
||||
}*/
|
||||
/* if too long translation, stop generation too */
|
||||
if (tcg_op_buf_full(tcg_ctx) ||
|
||||
(pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) ||
|
||||
|
|
Loading…
Reference in a new issue