qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, anthony@codemonkey.ws
Subject: [Qemu-devel] [PULL 10/17] tcg-aarch64: Update to helper_ret_*_mmu routines
Date: Thu, 10 Oct 2013 14:28:38 -0700	[thread overview]
Message-ID: <1381440525-6666-11-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1381440525-6666-1-git-send-email-rth@twiddle.net>

A minimal update to use the new helpers with the return address argument.

Tested-by: Claudio Fontana <claudio.fontana@linaro.org>
Reviewed-by: Claudio Fontana <claudio.fontana@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 include/exec/exec-all.h  | 18 ------------------
 tcg/aarch64/tcg-target.c | 28 ++++++++++++++++------------
 2 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 8dd1594..3ce80d1 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -320,24 +320,6 @@ extern uintptr_t tci_tb_ptr;
 
 #define GETPC()  (GETRA() - GETPC_ADJ)
 
-/* The LDST optimizations splits code generation into fast and slow path.
-   In some implementations, we pass the "logical" return address manually;
-   in others, we must infer the logical return from the true return.  */
-#if defined(CONFIG_QEMU_LDST_OPTIMIZATION) && defined(CONFIG_SOFTMMU)
-# if defined(__aarch64__)
-#  define GETRA_LDST(RA)  tcg_getra_ldst(RA)
-static inline uintptr_t tcg_getra_ldst(uintptr_t ra)
-{
-    int32_t b;
-    ra += 4;                    /* skip one instruction */
-    b = *(int32_t *)ra;         /* load the branch insn */
-    b = (b << 6) >> (6 - 2);    /* extract the displacement */
-    ra += b;                    /* apply the displacement  */
-    return ra;
-}
-# endif
-#endif /* CONFIG_QEMU_LDST_OPTIMIZATION */
-
 /* ??? Delete these once they are no longer used.  */
 bool is_tcg_gen_code(uintptr_t pc_ptr);
 #ifdef GETRA_LDST
diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c
index 6379df1..78e1443 100644
--- a/tcg/aarch64/tcg-target.c
+++ b/tcg/aarch64/tcg-target.c
@@ -778,22 +778,24 @@ static inline void tcg_out_nop(TCGContext *s)
 }
 
 #ifdef CONFIG_SOFTMMU
-/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
-   int mmu_idx) */
+/* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr,
+ *                                     int mmu_idx, uintptr_t ra)
+ */
 static const void * const qemu_ld_helpers[4] = {
-    helper_ldb_mmu,
-    helper_ldw_mmu,
-    helper_ldl_mmu,
-    helper_ldq_mmu,
+    helper_ret_ldub_mmu,
+    helper_ret_lduw_mmu,
+    helper_ret_ldul_mmu,
+    helper_ret_ldq_mmu,
 };
 
-/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr,
-   uintxx_t val, int mmu_idx) */
+/* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr,
+ *                                     uintxx_t val, int mmu_idx, uintptr_t ra)
+ */
 static const void * const qemu_st_helpers[4] = {
-    helper_stb_mmu,
-    helper_stw_mmu,
-    helper_stl_mmu,
-    helper_stq_mmu,
+    helper_ret_stb_mmu,
+    helper_ret_stw_mmu,
+    helper_ret_stl_mmu,
+    helper_ret_stq_mmu,
 };
 
 static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
@@ -802,6 +804,7 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
     tcg_out_movr(s, 1, 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, (tcg_target_long)lb->raddr);
     tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP,
                  (tcg_target_long)qemu_ld_helpers[lb->opc & 3]);
     tcg_out_callr(s, TCG_REG_TMP);
@@ -822,6 +825,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, 1, 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, (tcg_target_long)lb->raddr);
     tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP,
                  (tcg_target_long)qemu_st_helpers[lb->opc & 3]);
     tcg_out_callr(s, TCG_REG_TMP);
-- 
1.8.1.4

  parent reply	other threads:[~2013-10-10 21:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 21:28 [Qemu-devel] [PULL 00/17] TCG 2013-10-10 Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 01/17] tcg-hppa: Remove tcg backend Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 02/17] tcg: Delete tcg_helper_get_name declaration Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 03/17] tcg: Use a GHashTable for tcg_find_helper Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 04/17] target-m68k: Rename helpers.h to helper.h Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 05/17] tcg: Move helper registration into tcg_context_init Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 06/17] tcg: Remove stray semi-colons from target-*/helper.h Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 07/17] tcg: Put target helper data into an array Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 08/17] tcg: Add tcg-runtime.c helpers to all_helpers Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 09/17] tcg: Merge tcg_register_helper into tcg_context_init Richard Henderson
2013-10-10 21:28 ` Richard Henderson [this message]
2013-10-10 21:28 ` [Qemu-devel] [PULL 11/17] exec: Delete is_tcg_gen_code and GETRA_EXT Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 12/17] tcg: Add tcg-be-null.h Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 13/17] tcg: Add tcg-be-ldst.h Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 14/17] configure: Remove CONFIG_QEMU_LDST_OPTIMIZATION Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 15/17] tcg: Add TCGMemOp Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 16/17] tcg: Add qemu_ld_st_i32/64 Richard Henderson
2013-10-10 21:28 ` [Qemu-devel] [PULL 17/17] exec: Add both big- and little-endian memory helpers Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381440525-6666-11-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=anthony@codemonkey.ws \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).