mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
tcg: Add TranslationBlock.jmp_insn_offset
Stop overloading jmp_target_arg for both offset and address, depending on TCG_TARGET_HAS_direct_jump. Instead, add a new field to hold the jump insn offset and always set the target address in jmp_target_addr[]. This will allow a tcg backend to use either direct or indirect depending on displacement. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
b7e4afbd9f
commit
9da6079b26
3 changed files with 8 additions and 6 deletions
|
@ -321,7 +321,7 @@ static void G_GNUC_UNUSED set_jmp_insn_offset(TCGContext *s, int which)
|
|||
* tcg_gen_code, where we bound tcg_current_code_size to UINT16_MAX.
|
||||
*/
|
||||
tcg_debug_assert(TCG_TARGET_HAS_direct_jump);
|
||||
s->gen_tb->jmp_target_arg[which] = tcg_current_code_size(s);
|
||||
s->gen_tb->jmp_insn_offset[which] = tcg_current_code_size(s);
|
||||
}
|
||||
|
||||
static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which)
|
||||
|
@ -330,7 +330,7 @@ static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which)
|
|||
* Return the read-execute version of the pointer, for the benefit
|
||||
* of any pc-relative addressing mode.
|
||||
*/
|
||||
return (uintptr_t)tcg_splitwx_to_rx(s->gen_tb->jmp_target_arg + which);
|
||||
return (uintptr_t)tcg_splitwx_to_rx(&s->gen_tb->jmp_target_addr[which]);
|
||||
}
|
||||
|
||||
/* Signal overflow, starting over with fewer guest insns. */
|
||||
|
@ -4668,6 +4668,8 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, target_ulong pc_start)
|
|||
/* Initialize goto_tb jump offsets. */
|
||||
tb->jmp_reset_offset[0] = TB_JMP_OFFSET_INVALID;
|
||||
tb->jmp_reset_offset[1] = TB_JMP_OFFSET_INVALID;
|
||||
tb->jmp_insn_offset[0] = TB_JMP_OFFSET_INVALID;
|
||||
tb->jmp_insn_offset[1] = TB_JMP_OFFSET_INVALID;
|
||||
|
||||
tcg_reg_alloc_start(s);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue