qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v1 2/6] target-*: cpu.h: Undefine core code symbols


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH v1 2/6] target-*: cpu.h: Undefine core code symbols
Date: Mon, 26 Oct 2015 08:27:24 -0700

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 <address@hidden>
---
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-tilegx/cpu.h           |  1 +
 target-tricore/cpu.h          |  1 +
 target-unicore32/cpu.h        |  2 ++
 target-xtensa/cpu.h           |  2 ++
 19 files changed, 57 insertions(+)
 create mode 100644 include/exec/cpu-defs-clear.h

diff --git a/include/exec/cpu-defs-clear.h b/include/exec/cpu-defs-clear.h
new file mode 100644
index 0000000..f801612
--- /dev/null
+++ b/include/exec/cpu-defs-clear.h
@@ -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 <address@hidden>
+ *
+ * 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
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index d8e3737..bdd8be2 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -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
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index cc1265d..4b702df 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -20,6 +20,7 @@
 #define CPU_ARM_H
 
 #include "config.h"
+#include "exec/cpu-defs-clear.h"
 
 #include "kvm-consts.h"
 
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index e6f6c9a..bcd7e1a 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -22,6 +22,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 0119d9e..1623490 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "qemu-common.h"
 #include "standard-headers/asm-x86/hyperv.h"
+#include "exec/cpu-defs-clear.h"
 
 #ifdef TARGET_X86_64
 #define TARGET_LONG_BITS 64
diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index 54eeb64..3b6e33e 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -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
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 186f37b..800406e 100644
--- a/target-m68k/cpu.h
+++ b/target-m68k/cpu.h
@@ -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
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 2f47268..7532d9c 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 69d001e..44497f7 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -5,6 +5,8 @@
 
 #define ALIGNED_ONLY
 
+#include "exec/cpu-defs-clear.h"
+
 #define CPUArchState struct CPUMIPSState
 
 #include "config.h"
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 9fea329..b3e23ad 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h
index 8dbdbba..70943bd 100644
--- a/target-openrisc/cpu.h
+++ b/target-openrisc/cpu.h
@@ -20,6 +20,8 @@
 #ifndef CPU_OPENRISC_H
 #define CPU_OPENRISC_H
 
+#include "exec/cpu-defs-clear.h"
+
 #define TARGET_LONG_BITS 32
 
 #define CPUArchState struct CPUOpenRISCState
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 989bd78..799b8d3 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 //#define PPC_EMULATE_32BITS_HYPV
 
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 89104ef..46c038b 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -24,6 +24,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 64
 
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 6c52729..b45bb4e 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 32
 
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index cb10049..82d993c 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -3,6 +3,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 #include "qemu/bswap.h"
 
 #define ALIGNED_ONLY
diff --git a/target-tilegx/cpu.h b/target-tilegx/cpu.h
index 23b4a61..0134f30 100644
--- a/target-tilegx/cpu.h
+++ b/target-tilegx/cpu.h
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
+#include "exec/cpu-defs-clear.h"
 
 #define TARGET_LONG_BITS 64
 
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index 3a3fdb4..1ce246c 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -19,6 +19,7 @@
 #if !defined(__TRICORE_CPU_H__)
 #define __TRICORE_CPU_H__
 
+#include "exec/cpu-defs-clear.h"
 #include "tricore-defs.h"
 #include "config.h"
 #include "qemu-common.h"
diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h
index ab3fc3d..db210c9 100644
--- a/target-unicore32/cpu.h
+++ b/target-unicore32/cpu.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
 
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index 36cbeba..47ff99e 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -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
 
-- 
1.9.1




reply via email to

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