[PATCH v2 41/50] target/hexagon: Add get_tb_mmu_index()

Anton Johansson via qemu development <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
Adds a functions to return the current mmu index given tb_flags of the
current translation block.  Required by helper-to-tcg in order to
retrieve the mmu index for memory operations without changing the
signature of helper functions.

Signed-off-by: Anton Johansson <[email protected]>
---
 target/hexagon/translate.c | 12 ++++++++++++
 target/hexagon/translate.h |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 199b4f8c2e..bfd84bba4e 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -128,6 +128,18 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regnum,
     return offset;
 }
 
+#if defined(TARGET_HELPER_TO_TCG)
+/*
+ * Returns the current mmu index given tb_flags of the current translation
+ * block.  Required by helper-to-tcg in order to retrieve the mmu index for
+ * memory operations without changing the signature of helper functions.
+ */
+int get_tb_mmu_index(uint32_t flags)
+{
+    return FIELD_EX32(flags, TB_FLAGS, MMU_INDEX);
+}
+#endif
+
 static void gen_exception(int excp, uint32_t PC)
 {
     gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp),
diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h
index 2fca157553..6cf3b2fe3b 100644
--- a/target/hexagon/translate.h
+++ b/target/hexagon/translate.h
@@ -345,4 +345,8 @@ FIELD(PROBE_PKT_SCALAR_HVX_STORES, MMU_IDX,        5, 2)
 
 void gen_framecheck(DisasContext *ctx, TCGv_i32 addr, TCGv_i32 ea);
 
+#if defined(TARGET_HELPER_TO_TCG)
+int get_tb_mmu_index(uint32_t flags);
+#endif
+
 #endif
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.