On 4/2/25 04:26, Philippe Mathieu-Daudé wrote:
Hi Richard,

On 18/3/25 22:31, Richard Henderson wrote:
The implementation of cpu_mmu_index was split between cpu-common.h
and cpu-all.h, depending on CONFIG_USER_ONLY.  We already have the
plumbing common to user and system mode.  Using MMU_USER_IDX
requires the cpu.h for a specific target, and so is restricted to
when we're compiling per-target.

Include the new header only where needed.

Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
  include/exec/cpu-all.h        |  6 ------
  include/exec/cpu-common.h     | 20 ------------------
  include/exec/cpu-mmu-index.h  | 39 +++++++++++++++++++++++++++++++++++
  include/exec/cpu_ldst.h       |  1 +
  semihosting/uaccess.c         |  1 +
  target/arm/gdbstub64.c        |  3 +++
  target/hppa/mem_helper.c      |  1 +
  target/i386/tcg/translate.c   |  1 +
  target/loongarch/cpu_helper.c |  1 +
  target/microblaze/helper.c    |  1 +
  target/microblaze/mmu.c       |  1 +
  target/openrisc/translate.c   |  1 +
  target/sparc/cpu.c            |  1 +
  target/sparc/mmu_helper.c     |  1 +
  target/tricore/helper.c       |  1 +
  target/xtensa/mmu_helper.c    |  1 +
  16 files changed, 54 insertions(+), 26 deletions(-)
  create mode 100644 include/exec/cpu-mmu-index.h


diff --git a/include/exec/cpu-mmu-index.h b/include/exec/cpu-mmu-index.h
new file mode 100644
index 0000000000..b46e622048
--- /dev/null
+++ b/include/exec/cpu-mmu-index.h
@@ -0,0 +1,39 @@
+/*
+ * cpu_mmu_index()
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#ifndef EXEC_CPU_MMU_INDEX_H
+#define EXEC_CPU_MMU_INDEX_H
+
+#include "hw/core/cpu.h"
+#include "tcg/debug-assert.h"
+#ifdef COMPILING_PER_TARGET
+#include "cpu.h"

IIUC we only need "cpu.h" on user emulation. Maybe use:

   #if defined(COMPILING_PER_TARGET) && defined(CONFIG_USER_ONLY)

Can't.

+#ifdef COMPILING_PER_TARGET
+# ifdef CONFIG_USER_ONLY

It would have to be this nesting, for the poisoning.


r~

Reply via email to