Przeglądaj źródła

accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection.h'

Move mmap_lock(), mmap_unlock() declarations and the
WITH_MMAP_LOCK_GUARD() definition to 'exec/page-protection.h'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241212185341.2857-5-philmd@linaro.org>
Philippe Mathieu-Daudé 9 miesięcy temu
rodzic
commit
487a31e0ac

+ 1 - 0
accel/tcg/cpu-exec.c

@@ -25,6 +25,7 @@
 #include "trace.h"
 #include "trace.h"
 #include "disas/disas.h"
 #include "disas/disas.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/page-protection.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg.h"
 #include "qemu/atomic.h"
 #include "qemu/atomic.h"
 #include "qemu/rcu.h"
 #include "qemu/rcu.h"

+ 1 - 0
accel/tcg/translate-all.c

@@ -44,6 +44,7 @@
 #endif
 #endif
 
 
 #include "exec/cputlb.h"
 #include "exec/cputlb.h"
+#include "exec/page-protection.h"
 #include "exec/translate-all.h"
 #include "exec/translate-all.h"
 #include "exec/translator.h"
 #include "exec/translator.h"
 #include "exec/tb-flush.h"
 #include "exec/tb-flush.h"

+ 1 - 0
accel/tcg/watchpoint.c

@@ -22,6 +22,7 @@
 #include "qemu/error-report.h"
 #include "qemu/error-report.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
 #include "exec/translate-all.h"
 #include "exec/translate-all.h"
+#include "exec/page-protection.h"
 #include "system/tcg.h"
 #include "system/tcg.h"
 #include "system/replay.h"
 #include "system/replay.h"
 #include "hw/core/tcg-cpu-ops.h"
 #include "hw/core/tcg-cpu-ops.h"

+ 0 - 17
include/exec/exec-all.h

@@ -27,7 +27,6 @@
 #endif
 #endif
 #include "exec/mmu-access-type.h"
 #include "exec/mmu-access-type.h"
 #include "exec/translation-block.h"
 #include "exec/translation-block.h"
-#include "qemu/clang-tsa.h"
 
 
 /**
 /**
  * cpu_loop_exit_requested:
  * cpu_loop_exit_requested:
@@ -520,18 +519,6 @@ static inline tb_page_addr_t get_page_addr_code(CPUArchState *env,
 }
 }
 
 
 #if defined(CONFIG_USER_ONLY)
 #if defined(CONFIG_USER_ONLY)
-void TSA_NO_TSA mmap_lock(void);
-void TSA_NO_TSA mmap_unlock(void);
-bool have_mmap_lock(void);
-
-static inline void mmap_unlock_guard(void *unused)
-{
-    mmap_unlock();
-}
-
-#define WITH_MMAP_LOCK_GUARD()                                            \
-    for (int _mmap_lock_iter __attribute__((cleanup(mmap_unlock_guard)))  \
-         = (mmap_lock(), 0); _mmap_lock_iter == 0; _mmap_lock_iter = 1)
 
 
 /**
 /**
  * adjust_signal_pc:
  * adjust_signal_pc:
@@ -585,10 +572,6 @@ G_NORETURN void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
                                      uintptr_t ra);
                                      uintptr_t ra);
 
 
 #else
 #else
-static inline void mmap_lock(void) {}
-static inline void mmap_unlock(void) {}
-#define WITH_MMAP_LOCK_GUARD()
-
 void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length);
 void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length);
 void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
 void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
 
 

+ 24 - 0
include/exec/page-protection.h

@@ -38,4 +38,28 @@
  */
  */
 #define PAGE_PASSTHROUGH 0x0800
 #define PAGE_PASSTHROUGH 0x0800
 
 
+#ifdef CONFIG_USER_ONLY
+
+#include "qemu/clang-tsa.h"
+
+void TSA_NO_TSA mmap_lock(void);
+void TSA_NO_TSA mmap_unlock(void);
+bool have_mmap_lock(void);
+
+static inline void mmap_unlock_guard(void *unused)
+{
+    mmap_unlock();
+}
+
+#define WITH_MMAP_LOCK_GUARD() \
+    for (int _mmap_lock_iter __attribute__((cleanup(mmap_unlock_guard))) \
+         = (mmap_lock(), 0); _mmap_lock_iter == 0; _mmap_lock_iter = 1)
+#else
+
+static inline void mmap_lock(void) {}
+static inline void mmap_unlock(void) {}
+#define WITH_MMAP_LOCK_GUARD()
+
+#endif /* !CONFIG_USER_ONLY */
+
 #endif
 #endif

+ 1 - 0
linux-user/flatload.c

@@ -34,6 +34,7 @@
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
 
 
 #include "qemu.h"
 #include "qemu.h"
+#include "exec/page-protection.h"
 #include "user-internals.h"
 #include "user-internals.h"
 #include "loader.h"
 #include "loader.h"
 #include "user-mmap.h"
 #include "user-mmap.h"

+ 1 - 0
target/arm/helper.c

@@ -13,6 +13,7 @@
 #include "internals.h"
 #include "internals.h"
 #include "cpu-features.h"
 #include "cpu-features.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-proto.h"
+#include "exec/page-protection.h"
 #include "qemu/main-loop.h"
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 #include "qemu/timer.h"
 #include "qemu/bitops.h"
 #include "qemu/bitops.h"