From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVnlJ-00077v-CN for qemu-devel@nongnu.org; Thu, 03 Apr 2014 15:57:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVnlE-0004XQ-Jl for qemu-devel@nongnu.org; Thu, 03 Apr 2014 15:57:21 -0400 Received: from mail-qc0-x22a.google.com ([2607:f8b0:400d:c01::22a]:54914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVnlE-0004VF-D4 for qemu-devel@nongnu.org; Thu, 03 Apr 2014 15:57:16 -0400 Received: by mail-qc0-f170.google.com with SMTP id x13so2515689qcv.29 for ; Thu, 03 Apr 2014 12:57:15 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 3 Apr 2014 12:56:30 -0700 Message-Id: <1396555000-8205-17-git-send-email-rth@twiddle.net> In-Reply-To: <1396555000-8205-1-git-send-email-rth@twiddle.net> References: <1396555000-8205-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v3 16/26] tcg-aarch64: Use ADR to pass the return address to the ld/st helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: claudio.fontana@gmail.com Reviewed-by: Claudio Fontana Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 4729d11..5d19e27 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -1070,6 +1070,13 @@ static const void * const qemu_st_helpers[4] = { helper_ret_stq_mmu, }; +static inline void tcg_out_adr(TCGContext *s, TCGReg rd, uintptr_t addr) +{ + addr -= (uintptr_t)s->code_ptr; + assert(addr == sextract64(addr, 0, 21)); + tcg_out_insn(s, 3406, ADR, rd, addr); +} + static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) { TCGMemOp opc = lb->opc; @@ -1080,7 +1087,7 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_movr(s, TCG_TYPE_I64, TCG_REG_X0, TCG_AREG0); tcg_out_movr(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, lb->mem_index); - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_X3, (intptr_t)lb->raddr); + tcg_out_adr(s, TCG_REG_X3, (intptr_t)lb->raddr); tcg_out_call(s, (intptr_t)qemu_ld_helpers[size]); if (opc & MO_SIGN) { tcg_out_sxt(s, TCG_TYPE_I64, size, lb->datalo_reg, TCG_REG_X0); @@ -1101,7 +1108,7 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_movr(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); tcg_out_movr(s, size == MO_64, TCG_REG_X2, lb->datalo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, lb->mem_index); - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_X4, (intptr_t)lb->raddr); + tcg_out_adr(s, TCG_REG_X4, (intptr_t)lb->raddr); tcg_out_call(s, (intptr_t)qemu_st_helpers[size]); tcg_out_goto(s, (intptr_t)lb->raddr); } -- 1.9.0