[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/18] accel/tcg: Move page_[un]protect() to 'user/page-protectio
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 06/18] accel/tcg: Move page_[un]protect() to 'user/page-protection.h' |
Date: |
Thu, 12 Dec 2024 19:53:29 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/internal-target.h | 1 +
include/exec/translate-all.h | 5 -----
include/user/page-protection.h | 20 ++++++++++++++++++++
accel/tcg/user-exec.c | 2 +-
linux-user/elfload.c | 2 +-
5 files changed, 23 insertions(+), 7 deletions(-)
create mode 100644 include/user/page-protection.h
diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h
index fe109724c68..a03c05315a4 100644
--- a/accel/tcg/internal-target.h
+++ b/accel/tcg/internal-target.h
@@ -37,6 +37,7 @@ void page_table_config_init(void);
#endif
#ifdef CONFIG_USER_ONLY
+#include "user/page-protection.h"
/*
* For user-only, page_protect sets the page read-only.
* Since most execution is already on read-only pages, and we'd need to
diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h
index c50661a05d5..039668ff8ac 100644
--- a/include/exec/translate-all.h
+++ b/include/exec/translate-all.h
@@ -25,9 +25,4 @@
/* translate-all.c */
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 */
diff --git a/include/user/page-protection.h b/include/user/page-protection.h
new file mode 100644
index 00000000000..448c7a03449
--- /dev/null
+++ b/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
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 4ed6dd19f30..636932303bb 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -25,7 +25,7 @@
#include "qemu/rcu.h"
#include "exec/cpu_ldst.h"
#include "qemu/main-loop.h"
-#include "exec/translate-all.h"
+#include "user/page-protection.h"
#include "exec/page-protection.h"
#include "exec/helper-proto.h"
#include "qemu/atomic128.h"
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 471a384b222..521fdde0aa2 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3918,7 +3918,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct
image_info *info)
}
#ifdef USE_ELF_CORE_DUMP
-#include "exec/translate-all.h"
+#include "user/page-protection.h"
/*
* Definitions to generate Intel SVR4-like core files.
--
2.45.2
- [PATCH 02/18] linux-user/aarch64: Include missing 'user/abitypes.h' header, (continued)
- [PATCH 04/18] accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection.h', Philippe Mathieu-Daudé, 2024/12/12
- [PATCH 05/18] accel/tcg: Use tb_page_addr_t type in page_unprotect(), Philippe Mathieu-Daudé, 2024/12/12
- [PATCH 06/18] accel/tcg: Move page_[un]protect() to 'user/page-protection.h',
Philippe Mathieu-Daudé <=
- [PATCH 07/18] system: Remove unnecessary 'exec/translate-all.h' include, Philippe Mathieu-Daudé, 2024/12/12
- [PATCH 08/18] accel/tcg: Move 'exec/translate-all.h' -> 'tb-internal.h', Philippe Mathieu-Daudé, 2024/12/12
- [PATCH 09/18] accel/tcg: Un-inline log_pc(), Philippe Mathieu-Daudé, 2024/12/12
- [PATCH 10/18] accel/tcg: Move TranslationBlock declarations to 'tb-internal.h', Philippe Mathieu-Daudé, 2024/12/12