qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 03/11] exec: Restrict cputlb.h to sysemu/


From: Philippe Mathieu-Daudé
Subject: [PATCH 03/11] exec: Restrict cputlb.h to sysemu/
Date: Mon, 17 May 2021 13:11:03 +0200

To make it clearer the cputlb.h header is sysemu specific,
move it to the sysemu/ directory.

Patch created mechanically using:

  $ sed -i s,exec/cputlb.h,exec/sysemu/cputlb.h, $(git grep -l exec/cputlb.h)

Then the #ifdef'ry conditional on CONFIG_USER_ONLY has
been replaced by an #error.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/exec/{ => sysemu}/cputlb.h | 11 +++++++----
 accel/tcg/cputlb.c                 |  2 +-
 accel/tcg/translate-all.c          |  6 +++---
 MAINTAINERS                        |  1 +
 4 files changed, 12 insertions(+), 8 deletions(-)
 rename include/exec/{ => sysemu}/cputlb.h (86%)

diff --git a/include/exec/cputlb.h b/include/exec/sysemu/cputlb.h
similarity index 86%
rename from include/exec/cputlb.h
rename to include/exec/sysemu/cputlb.h
index 19b16e58f84..5a37a870343 100644
--- a/include/exec/cputlb.h
+++ b/include/exec/sysemu/cputlb.h
@@ -17,15 +17,18 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef CPUTLB_H
-#define CPUTLB_H
+#ifndef EXEC_SYSEMU_CPUTLB_H
+#define EXEC_SYSEMU_CPUTLB_H
+
+#ifdef CONFIG_USER_ONLY
+#error Cannot include sysemu specific header from user emulation
+#endif
 
 #include "exec/cpu-common.h"
 
-#if !defined(CONFIG_USER_ONLY)
 /* cputlb.c */
 void tlb_protect_code(ram_addr_t ram_addr);
 void tlb_unprotect_code(ram_addr_t ram_addr);
 void tlb_flush_counts(size_t *full, size_t *part, size_t *elide);
-#endif
+
 #endif
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 84e7d91a5ca..452029e8193 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -23,7 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/memory.h"
 #include "exec/cpu_ldst.h"
-#include "exec/cputlb.h"
+#include "exec/sysemu/cputlb.h"
 #include "exec/tb-hash.h"
 #include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ae7e873713a..98a07ce4e4e 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -42,11 +42,11 @@
 #include <libutil.h>
 #endif
 #endif
-#else
+#else /* !CONFIG_USER_ONLY */
+#include "exec/sysemu/cputlb.h"
 #include "exec/ram_addr.h"
-#endif
+#endif /* CONFIG_USER_ONLY */
 
-#include "exec/cputlb.h"
 #include "exec/tb-hash.h"
 #include "exec/translate-all.h"
 #include "qemu/bitmap.h"
diff --git a/MAINTAINERS b/MAINTAINERS
index f1ae9934349..4378ec47a2c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -131,6 +131,7 @@ F: include/exec/helper*.h
 F: include/exec/tb-hash.h
 F: include/exec/sysemu/hwaddr.h
 F: include/sysemu/cpus.h
+F: include/exec/sysemu/cputlb.h
 F: include/sysemu/tcg.h
 F: include/hw/core/tcg-cpu-ops.h
 
-- 
2.26.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]