mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
tcg: Clean up direct block chaining safety checks
We don't take care of direct jumps when address mapping changes. Thus we must be sure to generate direct jumps so that they always keep valid even if address mapping changes. Luckily, we can only allow to execute a TB if it was generated from the pages which match with current mapping. Document tcg_gen_goto_tb() declaration and note the reason for destination PC limitations. Some targets with variable length instructions allow TB to straddle a page boundary. However, we make sure that both of TB pages match the current address mapping when looking up TBs. So it is safe to do direct jumps into the both pages. Correct the checks for some of those targets. Given that, we can safely patch a TB which spans two pages. Remove the unnecessary check in cpu_exec() and allow such TBs to be patched. Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com> Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
f9c5b66f48
commit
5b053a4a28
7 changed files with 20 additions and 10 deletions
10
tcg/tcg-op.h
10
tcg/tcg-op.h
|
@ -753,6 +753,16 @@ static inline void tcg_gen_exit_tb(uintptr_t val)
|
|||
tcg_gen_op1i(INDEX_op_exit_tb, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* tcg_gen_goto_tb() - output goto_tb TCG operation
|
||||
* @idx: Direct jump slot index (0 or 1)
|
||||
*
|
||||
* See tcg/README for more info about this TCG operation.
|
||||
*
|
||||
* NOTE: Direct jumps with goto_tb are only safe within the pages this TB
|
||||
* resides in because we don't take care of direct jumps when address mapping
|
||||
* changes, e.g. in tlb_flush().
|
||||
*/
|
||||
void tcg_gen_goto_tb(unsigned idx);
|
||||
|
||||
#if TARGET_LONG_BITS == 32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue