From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLGIC-00055n-UU for qemu-devel@nongnu.org; Wed, 05 Mar 2014 13:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLGI6-0007Tg-51 for qemu-devel@nongnu.org; Wed, 05 Mar 2014 13:11:44 -0500 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:47498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLGI5-0007TS-Vv for qemu-devel@nongnu.org; Wed, 05 Mar 2014 13:11:38 -0500 Received: by mail-qa0-f43.google.com with SMTP id j15so1357459qaq.16 for ; Wed, 05 Mar 2014 10:11:37 -0800 (PST) Sender: Richard Henderson From: Richard Henderson Date: Wed, 5 Mar 2014 10:11:14 -0800 Message-Id: <1394043081-4668-5-git-send-email-rth@twiddle.net> In-Reply-To: <1394043081-4668-1-git-send-email-rth@twiddle.net> References: <1394043081-4668-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 04/11] tcg-sparc: Use intptr_t as appropriate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c index fe34724..ebcba71 100644 --- a/tcg/sparc/tcg-target.c +++ b/tcg/sparc/tcg-target.c @@ -449,13 +449,14 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, tcg_out_ldst(s, arg, arg1, arg2, (type == TCG_TYPE_I32 ? STW : STX)); } -static inline void tcg_out_ld_ptr(TCGContext *s, int ret, - tcg_target_long arg) +static inline void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg) { + TCGReg base = TCG_REG_G0; if (!check_fit_tl(arg, 10)) { tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff); + base = ret; } - tcg_out_ld(s, TCG_TYPE_PTR, ret, ret, arg & 0x3ff); + tcg_out_ld(s, TCG_TYPE_PTR, ret, base, arg & 0x3ff); } static inline void tcg_out_sety(TCGContext *s, int rs) @@ -1176,8 +1177,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out32(s, CALL | (old_insn & ~INSN_OP(-1))); } else { /* indirect jump method */ - tcg_out_ld_ptr(s, TCG_REG_T1, - (tcg_target_long)(s->tb_next + args[0])); + tcg_out_ld_ptr(s, TCG_REG_T1, (uintptr_t)(s->tb_next + args[0])); tcg_out_arithi(s, TCG_REG_G0, TCG_REG_T1, 0, JMPL); } tcg_out_nop(s); @@ -1674,7 +1674,7 @@ static DebugFrame debug_frame = { void tcg_register_jit(void *buf, size_t buf_size) { - debug_frame.fde.func_start = (tcg_target_long) buf; + debug_frame.fde.func_start = (uintptr_t)buf; debug_frame.fde.func_len = buf_size; tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame)); @@ -1683,14 +1683,12 @@ void tcg_register_jit(void *buf, size_t buf_size) void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) { uint32_t *ptr = (uint32_t *)jmp_addr; - tcg_target_long disp = (tcg_target_long)(addr - jmp_addr) >> 2; + uintptr_t disp = addr - jmp_addr; /* We can reach the entire address space for 32-bit. For 64-bit the code_gen_buffer can't be larger than 2GB. */ - if (TCG_TARGET_REG_BITS == 64 && !check_fit_tl(disp, 30)) { - tcg_abort(); - } + assert(disp == (int32_t)disp); - *ptr = CALL | (disp & 0x3fffffff); + *ptr = CALL | (uint32_t)disp >> 2; flush_icache_range(jmp_addr, jmp_addr + 4); } -- 1.8.5.3