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>
This commit is contained in:
Philippe Mathieu-Daudé 2024-11-23 07:26:43 +01:00
parent edf3bce969
commit 487a31e0ac
7 changed files with 29 additions and 17 deletions

View file

@ -38,4 +38,28 @@
*/
#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