new file mode 100644
@@ -0,0 +1,33 @@
+/*
+ * Undefine the standard macros defined by cpu.h which are used by core code.
+ * Each arch cpu.h should include this before defining any of these symbols.
+ * This is to allow system level code to include multiple arches cpu.h.
+ *
+ * Copyright (c) 2015 Peter Crosthwaite <crosthwaite.peter@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* No multiple include guard intended. */
+
+#undef CPUArchState
+
+#undef ELF_MACHINE
+
+#undef TARGET_LONG_BITS
+#undef TARGET_PAGE_BITS
+#undef TARGET_PHYS_ADDR_SPACE_BITS
+#undef TARGET_VIRT_ADDR_SPACE_BITS
+
+#undef NB_MMU_MODES
@@ -22,6 +22,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 64
#define ALIGNED_ONLY
@@ -20,6 +20,7 @@
#define CPU_ARM_H
#include "config.h"
+#include "exec/cpu-defs-clear.h"
#include "kvm-consts.h"
@@ -22,6 +22,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 32
@@ -21,6 +21,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#ifdef TARGET_X86_64
#define TARGET_LONG_BITS 64
@@ -20,6 +20,8 @@
#ifndef CPU_LM32_H
#define CPU_LM32_H
+#include "exec/cpu-defs-clear.h"
+
#define TARGET_LONG_BITS 32
#define CPUArchState struct CPULM32State
@@ -20,6 +20,8 @@
#ifndef CPU_M68K_H
#define CPU_M68K_H
+#include "exec/cpu-defs-clear.h"
+
#define TARGET_LONG_BITS 32
#define CPUArchState struct CPUM68KState
@@ -21,6 +21,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 32
@@ -5,6 +5,8 @@
#define ALIGNED_ONLY
+#include "exec/cpu-defs-clear.h"
+
#define ELF_MACHINE EM_MIPS
#define CPUArchState struct CPUMIPSState
@@ -21,6 +21,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 32
@@ -20,6 +20,8 @@
#ifndef CPU_OPENRISC_H
#define CPU_OPENRISC_H
+#include "exec/cpu-defs-clear.h"
+
#define TARGET_LONG_BITS 32
#define ELF_MACHINE EM_OPENRISC
@@ -21,6 +21,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
//#define PPC_EMULATE_32BITS_HYPV
@@ -24,6 +24,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 64
@@ -21,6 +21,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#define TARGET_LONG_BITS 32
@@ -3,6 +3,7 @@
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#include "qemu/bswap.h"
#define ALIGNED_ONLY
@@ -22,6 +22,7 @@
#include "tricore-defs.h"
#include "config.h"
#include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
#include "exec/cpu-defs.h"
#include "fpu/softfloat.h"
@@ -11,6 +11,8 @@
#ifndef QEMU_UNICORE32_CPU_H
#define QEMU_UNICORE32_CPU_H
+#include "exec/cpu-defs-clear.h"
+
#define TARGET_LONG_BITS 32
#define TARGET_PAGE_BITS 12
@@ -28,6 +28,8 @@
#ifndef CPU_XTENSA_H
#define CPU_XTENSA_H
+#include "exec/cpu-defs-clear.h"
+
#define ALIGNED_ONLY
#define TARGET_LONG_BITS 32
#define ELF_MACHINE EM_XTENSA
Pre-undefine all symbols that cpu.h defines for the sake of core code. This is to allow inclusion of multiple cpu.h's from system level code implementing multi-arch machines. Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> --- Such system level code cannot validly use these symbols as they are ambiguous. So we should probably add some sort of poisoning system as follow up work. --- include/exec/cpu-defs-clear.h | 33 +++++++++++++++++++++++++++++++++ target-alpha/cpu.h | 1 + target-arm/cpu.h | 1 + target-cris/cpu.h | 1 + target-i386/cpu.h | 1 + target-lm32/cpu.h | 2 ++ target-m68k/cpu.h | 2 ++ target-microblaze/cpu.h | 1 + target-mips/cpu.h | 2 ++ target-moxie/cpu.h | 1 + target-openrisc/cpu.h | 2 ++ target-ppc/cpu.h | 1 + target-s390x/cpu.h | 1 + target-sh4/cpu.h | 1 + target-sparc/cpu.h | 1 + target-tricore/cpu.h | 1 + target-unicore32/cpu.h | 2 ++ target-xtensa/cpu.h | 2 ++ 18 files changed, 56 insertions(+) create mode 100644 include/exec/cpu-defs-clear.h