From becc452a367aa681ca0c1fcb688ae0f16b32b11f Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 26 Nov 2022 17:42:11 -0800 Subject: tcg: Introduce get_jmp_target_addr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the existing set_jmp_reset_offset. Include the rw->rx address space conversion done by arm and s390x, and forgotten by mips and riscv. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tcg/tcg.c') diff --git a/tcg/tcg.c b/tcg/tcg.c index 4092dac..2a14fc2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -323,6 +323,15 @@ static void G_GNUC_UNUSED set_jmp_insn_offset(TCGContext *s, int which) s->tb_jmp_insn_offset[which] = tcg_current_code_size(s); } +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->tb_jmp_target_addr[which]); +} + /* Signal overflow, starting over with fewer guest insns. */ static G_NORETURN void tcg_raise_tb_overflow(TCGContext *s) -- cgit v1.1