mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
include/exec: Split out accel/tcg/cpu-mmu-index.h
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. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
0b6426ba6c
commit
efe25c260c
16 changed files with 56 additions and 26 deletions
41
include/accel/tcg/cpu-mmu-index.h
Normal file
41
include/accel/tcg/cpu-mmu-index.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* cpu_mmu_index()
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 Fabrice Bellard
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ACCEL_TCG_CPU_MMU_INDEX_H
|
||||||
|
#define ACCEL_TCG_CPU_MMU_INDEX_H
|
||||||
|
|
||||||
|
#include "hw/core/cpu.h"
|
||||||
|
#include "tcg/debug-assert.h"
|
||||||
|
#ifdef COMPILING_PER_TARGET
|
||||||
|
# ifdef CONFIG_USER_ONLY
|
||||||
|
# include "cpu.h"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu_mmu_index:
|
||||||
|
* @env: The cpu environment
|
||||||
|
* @ifetch: True for code access, false for data access.
|
||||||
|
*
|
||||||
|
* Return the core mmu index for the current translation regime.
|
||||||
|
* This function is used by generic TCG code paths.
|
||||||
|
*/
|
||||||
|
static inline int cpu_mmu_index(CPUState *cs, bool ifetch)
|
||||||
|
{
|
||||||
|
#ifdef COMPILING_PER_TARGET
|
||||||
|
# ifdef CONFIG_USER_ONLY
|
||||||
|
return MMU_USER_IDX;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ret = cs->cc->mmu_index(cs, ifetch);
|
||||||
|
tcg_debug_assert(ret >= 0 && ret < NB_MMU_MODES);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ACCEL_TCG_CPU_MMU_INDEX_H */
|
|
@ -34,8 +34,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
|
||||||
|
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
|
|
||||||
static inline int cpu_mmu_index(CPUState *cs, bool ifetch);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow some level of source compatibility with softmmu. We do not
|
* Allow some level of source compatibility with softmmu. We do not
|
||||||
* support any of the more exotic features, so only invalid pages may
|
* support any of the more exotic features, so only invalid pages may
|
||||||
|
@ -45,10 +43,6 @@ static inline int cpu_mmu_index(CPUState *cs, bool ifetch);
|
||||||
#define TLB_MMIO (1 << (TARGET_PAGE_BITS_MIN - 2))
|
#define TLB_MMIO (1 << (TARGET_PAGE_BITS_MIN - 2))
|
||||||
#define TLB_WATCHPOINT 0
|
#define TLB_WATCHPOINT 0
|
||||||
|
|
||||||
static inline int cpu_mmu_index(CPUState *cs, bool ifetch)
|
|
||||||
{
|
|
||||||
return MMU_USER_IDX;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -272,24 +272,4 @@ static inline CPUState *env_cpu(CPUArchState *env)
|
||||||
return (CPUState *)env_cpu_const(env);
|
return (CPUState *)env_cpu_const(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
/**
|
|
||||||
* cpu_mmu_index:
|
|
||||||
* @env: The cpu environment
|
|
||||||
* @ifetch: True for code access, false for data access.
|
|
||||||
*
|
|
||||||
* Return the core mmu index for the current translation regime.
|
|
||||||
* This function is used by generic TCG code paths.
|
|
||||||
*
|
|
||||||
* The user-only version of this function is inline in cpu-all.h,
|
|
||||||
* where it always returns MMU_USER_IDX.
|
|
||||||
*/
|
|
||||||
static inline int cpu_mmu_index(CPUState *cs, bool ifetch)
|
|
||||||
{
|
|
||||||
int ret = cs->cc->mmu_index(cs, ifetch);
|
|
||||||
tcg_debug_assert(ret >= 0 && ret < NB_MMU_MODES);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif /* !CONFIG_USER_ONLY */
|
|
||||||
|
|
||||||
#endif /* CPU_COMMON_H */
|
#endif /* CPU_COMMON_H */
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "exec/cpu-ldst-common.h"
|
#include "exec/cpu-ldst-common.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/abi_ptr.h"
|
#include "exec/abi_ptr.h"
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "exec/cpu-all.h"
|
#include "exec/cpu-all.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "semihosting/uaccess.h"
|
#include "semihosting/uaccess.h"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include "mte_user_helper.h"
|
#include "mte_user_helper.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_TCG
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int aarch64_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
int aarch64_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "qemu/host-utils.h"
|
#include "qemu/host-utils.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/translation-block.h"
|
#include "exec/translation-block.h"
|
||||||
#include "tcg/tcg-op.h"
|
#include "tcg/tcg-op.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "internals.h"
|
#include "internals.h"
|
||||||
#include "cpu-csr.h"
|
#include "cpu-csr.h"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
#include "qemu/host-utils.h"
|
#include "qemu/host-utils.h"
|
||||||
#include "exec/log.h"
|
#include "exec/log.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
|
|
||||||
static unsigned int tlb_decode_size(unsigned int f)
|
static unsigned int tlb_decode_size(unsigned int f)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "tcg/tcg-op.h"
|
#include "tcg/tcg-op.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "qemu/qemu-print.h"
|
#include "qemu/qemu-print.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/translation-block.h"
|
#include "exec/translation-block.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
#include "qemu/qemu-print.h"
|
#include "qemu/qemu-print.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "hw/registerfields.h"
|
#include "hw/registerfields.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
#include "fpu/softfloat-helpers.h"
|
#include "fpu/softfloat-helpers.h"
|
||||||
#include "qemu/qemu-print.h"
|
#include "qemu/qemu-print.h"
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
#include "qemu/host-utils.h"
|
#include "qemu/host-utils.h"
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "accel/tcg/cpu-mmu-index.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/page-protection.h"
|
#include "exec/page-protection.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue