Bläddra i källkod

accel/tcg: Move page_[un]protect() to 'user/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-7-philmd@linaro.org>
Philippe Mathieu-Daudé 8 månader sedan
förälder
incheckning
634f1455fc

+ 1 - 0
accel/tcg/internal-target.h

@@ -37,6 +37,7 @@ void page_table_config_init(void);
 #endif
 #endif
 
 
 #ifdef CONFIG_USER_ONLY
 #ifdef CONFIG_USER_ONLY
+#include "user/page-protection.h"
 /*
 /*
  * For user-only, page_protect sets the page read-only.
  * For user-only, page_protect sets the page read-only.
  * Since most execution is already on read-only pages, and we'd need to
  * Since most execution is already on read-only pages, and we'd need to

+ 1 - 1
accel/tcg/user-exec.c

@@ -25,7 +25,7 @@
 #include "qemu/rcu.h"
 #include "qemu/rcu.h"
 #include "exec/cpu_ldst.h"
 #include "exec/cpu_ldst.h"
 #include "qemu/main-loop.h"
 #include "qemu/main-loop.h"
-#include "exec/translate-all.h"
+#include "user/page-protection.h"
 #include "exec/page-protection.h"
 #include "exec/page-protection.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-proto.h"
 #include "qemu/atomic128.h"
 #include "qemu/atomic128.h"

+ 0 - 5
include/exec/translate-all.h

@@ -25,9 +25,4 @@
 /* translate-all.c */
 /* translate-all.c */
 void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
 void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
 
 
-#ifdef CONFIG_USER_ONLY
-void page_protect(tb_page_addr_t page_addr);
-int page_unprotect(tb_page_addr_t address, uintptr_t pc);
-#endif
-
 #endif /* TRANSLATE_ALL_H */
 #endif /* TRANSLATE_ALL_H */

+ 20 - 0
include/user/page-protection.h

@@ -0,0 +1,20 @@
+/*
+ * QEMU page protection declarations.
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+#ifndef USER_PAGE_PROTECTION_H
+#define USER_PAGE_PROTECTION_H
+
+#ifndef CONFIG_USER_ONLY
+#error Cannot include this header from system emulation
+#endif
+
+#include "exec/translation-block.h"
+
+void page_protect(tb_page_addr_t page_addr);
+int page_unprotect(tb_page_addr_t address, uintptr_t pc);
+
+#endif

+ 1 - 1
linux-user/elfload.c

@@ -8,6 +8,7 @@
 
 
 #include "qemu.h"
 #include "qemu.h"
 #include "user/tswap-target.h"
 #include "user/tswap-target.h"
+#include "user/page-protection.h"
 #include "exec/page-protection.h"
 #include "exec/page-protection.h"
 #include "user/guest-base.h"
 #include "user/guest-base.h"
 #include "user-internals.h"
 #include "user-internals.h"
@@ -3918,7 +3919,6 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
 }
 }
 
 
 #ifdef USE_ELF_CORE_DUMP
 #ifdef USE_ELF_CORE_DUMP
-#include "exec/translate-all.h"
 
 
 /*
 /*
  * Definitions to generate Intel SVR4-like core files.
  * Definitions to generate Intel SVR4-like core files.