On 1/20/24 00:40, Anton Johansson wrote:
Makes translate-all.c independent of softmmu target by switching

     TARGET_LONG_BITS        -> target_long_bits()

     TARGET_INSN_START_WORDS -> tcg_ctx->insn_start_words,
                                target_insn_start_words(),

     TCG_GUEST_DEFAULT_MO    -> target_default_memory_order()

     MO_TE                   -> target_endian_memory_order()

Signed-off-by: Anton Johansson <a...@rev.ng>
---
  accel/tcg/translate-all.c | 38 ++++++++++++++++++--------------------
  1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 9c981d1750..a3ae0c6910 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -65,7 +65,6 @@
  #include "internal-common.h"
  #include "internal-target.h"
  #include "perf.h"
-#include "tcg/insn-start-words.h"
TBContext tb_ctx; @@ -106,7 +105,7 @@ static int64_t decode_sleb128(const uint8_t **pp)
          val |= (int64_t)(byte & 0x7f) << shift;
          shift += 7;
      } while (byte & 0x80);
-    if (shift < TARGET_LONG_BITS && (byte & 0x40)) {
+    if (shift < target_long_bits() && (byte & 0x40)) {

You just make TARGET_PAGE_SIZE etc target independent, right?
So you don't need this?  Or is this because of user-only still.

  static int encode_search(TranslationBlock *tb, uint8_t *block)
  {
+    const uint8_t insn_start_words = tcg_ctx->insn_start_words;

Ok, because we're still inside the compilation context.

  static int cpu_unwind_data_from_tb(TranslationBlock *tb, uintptr_t host_pc,
                                     uint64_t *data)
  {
+    const uint8_t insn_start_words = tcg_ctx->insn_start_words;

Not ok, because we're outside of the compilation context.


r~

Reply via email to