'NEED_CPU_H' guard target-specific code; it is defined by meson
altogether with the 'CONFIG_TARGET' definition. Rename NEED_CPU_H
as COMPILING_PER_TARGET to clarify its meaning.
Mechanical change running:
$ sed -i s/NEED_CPU_H/COMPILING_PER_TARGET/g $(git grep -l NEED_CPU_H)
then manually add a /* COMPILING_PER_TARGET */ comment
after the '#endif' when the block is large.
Inspired-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <
20240322161439.6448-4-philmd@linaro.org>
#ifndef CPU_DEFS_H
#define CPU_DEFS_H
-#ifndef NEED_CPU_H
+#ifndef COMPILING_PER_TARGET
#error cpu.h included from common code
#endif
#define dh_ctype_noreturn G_NORETURN void
#define dh_ctype(t) dh_ctype_##t
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
# ifdef TARGET_LONG_BITS
# if TARGET_LONG_BITS == 32
# define dh_alias_tl i32
# endif
# endif
# define dh_ctype_tl target_ulong
-#endif
+#endif /* COMPILING_PER_TARGET */
/* We can't use glue() here because it falls foul of C preprocessor
recursive expansion rules. */
MO_LE = 0,
MO_BE = MO_BSWAP,
#endif
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#if TARGET_BIG_ENDIAN
MO_TE = MO_BE,
#else
MO_BESL = MO_BE | MO_SL,
MO_BESQ = MO_BE | MO_SQ,
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
MO_TEUW = MO_TE | MO_UW,
MO_TEUL = MO_TE | MO_UL,
MO_TEUQ = MO_TE | MO_UQ,
MemTxResult address_space_set(AddressSpace *as, hwaddr addr,
uint8_t c, hwaddr len, MemTxAttrs attrs);
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
/* enum device_endian to MemOp. */
static inline MemOp devend_memop(enum device_endian end)
{
return (end == non_host_endianness) ? MO_BSWAP : 0;
#endif
}
-#endif
+#endif /* COMPILING_PER_TARGET */
/*
* Inhibit technologies that require discarding of pages in RAM blocks, e.g.,
* If we're in target-specific code, we can hard-code the swapping
* condition, otherwise we have to do (slower) run-time checks.
*/
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#define target_needs_bswap() (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
#else
#define target_needs_bswap() (target_words_bigendian() != HOST_BIG_ENDIAN)
-#endif
+#endif /* COMPILING_PER_TARGET */
static inline uint16_t tswap16(uint16_t s)
{
#ifndef _GDBSTUB_HELPERS_H_
#define _GDBSTUB_HELPERS_H_
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#include "cpu.h"
/*
const char *target_name(void);
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#ifndef CONFIG_USER_ONLY
}
#endif /* !CONFIG_USER_ONLY */
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
#define UNASSIGNED_CPU_INDEX -1
#define UNASSIGNED_CLUSTER_INDEX -1
#endif
#include "config-host.h"
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#include CONFIG_TARGET
#else
#include "exec/poison.h"
#include "qemu/accel.h"
#include "qom/object.h"
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#include "cpu.h"
#ifdef CONFIG_HVF
#define hvf_enabled() 0
#endif /* !CONFIG_HVF */
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
TYPE_HVF_ACCEL)
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
struct hvf_sw_breakpoint {
vaddr pc;
vaddr saved_insn;
* Return whether the guest supports debugging.
*/
bool hvf_arch_supports_guest_debug(void);
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
#endif
#include "qemu/accel.h"
#include "qom/object.h"
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
# ifdef CONFIG_KVM
# include <linux/kvm.h>
# define CONFIG_KVM_IS_POSSIBLE
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
int kvm_on_sigbus(int code, void *addr);
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#include "cpu.h"
void kvm_flush_coalesced_mmio_buffer(void);
int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
hwaddr *phys_addr);
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
void kvm_cpu_synchronize_state(CPUState *cpu);
#ifndef QEMU_NVMM_H
#define QEMU_NVMM_H
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#ifdef CONFIG_NVMM
#endif /* CONFIG_NVMM */
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
#endif /* QEMU_NVMM_H */
#ifndef QEMU_WHPX_H
#define QEMU_WHPX_H
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#ifdef CONFIG_WHPX
#endif /* CONFIG_WHPX */
-#endif /* NEED_CPU_H */
+#endif /* COMPILING_PER_TARGET */
#endif /* QEMU_WHPX_H */
#include "exec/cpu-common.h"
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
# ifdef CONFIG_XEN
# define CONFIG_XEN_IS_POSSIBLE
# endif
#else
# define CONFIG_XEN_IS_POSSIBLE
-#endif
+#endif /* COMPILING_PER_TARGET */
#ifdef CONFIG_XEN_IS_POSSIBLE
if target.endswith('-softmmu')
config_target = config_target_mak[target]
target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
- c_args = ['-DNEED_CPU_H',
+ c_args = ['-DCOMPILING_PER_TARGET',
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
target_module_ss = module_ss.apply(config_target, strict: false)
target_base_arch = config_target['TARGET_BASE_ARCH']
arch_srcs = [config_target_h[target]]
arch_deps = []
- c_args = ['-DNEED_CPU_H',
+ c_args = ['-DCOMPILING_PER_TARGET',
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
link_args = emulator_link_args
analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
echo target/i386/cpu.h:
-analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h
+analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h
-echo hw/hw.h + NEED_CPU_H:
-analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
+echo hw/hw.h + COMPILING_PER_TARGET:
+analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
#ifndef ARM_KVM_CONSTS_H
#define ARM_KVM_CONSTS_H
-#ifdef NEED_CPU_H
+#ifdef COMPILING_PER_TARGET
#ifdef CONFIG_KVM
#include <linux/kvm.h>
#include <linux/psci.h>
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y)
#endif
-#endif
+#endif /* COMPILING_PER_TARGET */
#ifndef MISMATCH_CHECK
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(0)