[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 10/34] include/exec: Split target_long def to new h
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [RFC v2 10/34] include/exec: Split target_long def to new header |
Date: |
Sat, 30 May 2015 23:11:43 -0700 |
This is currently provided by cpu-defs and is a target specific
definition. However, to prepare for multi-arch only the bare minimum
content from cpu-defs.h should be exported to core code. And this is
all we need. So split it to a new header that the target_multi cpu.h
can include to save on having to include the ill-defined cpu-defs.h.
Allow multiple inclusion for multi-arch where multiple cpu.h's need
to be included and target_long will vary for each.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
include/exec/cpu-defs.h | 23 +-------------------
include/exec/target-long.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 22 deletions(-)
create mode 100644 include/exec/target-long.h
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 0f4886d..1c52d2a 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -32,28 +32,7 @@
#endif
#include "exec/memattrs.h"
-#ifndef TARGET_LONG_BITS
-#error TARGET_LONG_BITS must be defined before including this header
-#endif
-
-#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
-
-/* target_ulong is the type of a virtual address */
-#if TARGET_LONG_SIZE == 4
-typedef int32_t target_long;
-typedef uint32_t target_ulong;
-#define TARGET_FMT_lx "%08x"
-#define TARGET_FMT_ld "%d"
-#define TARGET_FMT_lu "%u"
-#elif TARGET_LONG_SIZE == 8
-typedef int64_t target_long;
-typedef uint64_t target_ulong;
-#define TARGET_FMT_lx "%016" PRIx64
-#define TARGET_FMT_ld "%" PRId64
-#define TARGET_FMT_lu "%" PRIu64
-#else
-#error TARGET_LONG_SIZE undefined
-#endif
+#include "exec/target-long.h"
/* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
addresses on the same page. The top bits are the same. This allows
diff --git a/include/exec/target-long.h b/include/exec/target-long.h
new file mode 100644
index 0000000..478e8f0
--- /dev/null
+++ b/include/exec/target-long.h
@@ -0,0 +1,52 @@
+/*
+ * definition for the target_long type and friends.
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * 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 included guard intended. Multi-arch setups may require multiple
+ * cpu.h's included which means this can be and should be reached twice.
+ */
+
+#include <stdint.h>
+
+#ifndef TARGET_LONG_BITS
+#error TARGET_LONG_BITS must be defined before including this header
+#endif
+
+#undef TARGET_LONG_SIZE
+#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
+
+#undef TARGET_FMT_lx
+#undef TARGET_FMT_ld
+#undef TARGET_FMT_lu
+
+/* target_ulong is the type of a virtual address */
+#if TARGET_LONG_SIZE == 4
+typedef int32_t target_long;
+typedef uint32_t target_ulong;
+#define TARGET_FMT_lx "%08x"
+#define TARGET_FMT_ld "%d"
+#define TARGET_FMT_lu "%u"
+#elif TARGET_LONG_SIZE == 8
+typedef int64_t target_long;
+typedef uint64_t target_ulong;
+#define TARGET_FMT_lx "%016" PRIx64
+#define TARGET_FMT_ld "%" PRId64
+#define TARGET_FMT_lu "%" PRIu64
+#else
+#error TARGET_LONG_SIZE undefined
+#endif
--
1.9.1
- [Qemu-devel] [RFC v2 00/34] Multi Architecture System Emulation, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 01/34] cpu-defs: Move CPU_TEMP_BUF_NLONGS to tcg, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 02/34] cpu-exec: Purge all uses of CPU_GET_ENV, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 03/34] Makefile.target: Introduce arch-obj, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 04/34] cpu-exec: Migrate some generic fns to cpus.c, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 05/34] translate: Listify tcg_exec_init, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 06/34] cpu-common: Define tb_page_addr_t for everyone, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 07/34] exec-all: Move cpu_can_do_io to qom/cpu.h, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 08/34] translate-all: Move tcg_handle_interrupt to -common, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 09/34] include/exec: Move standard exceptions to cpu-all.h, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 10/34] include/exec: Split target_long def to new header,
Peter Crosthwaite <=
- [Qemu-devel] [RFC v2 11/34] include/exec: Move cputlb exec.c defs out, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 12/34] include/exec: Move tb hash functions out, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 13/34] cpu-defs: Move out TB_JMP defines, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 14/34] cpu-defs: Allow multiple inclusions, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 15/34] HACK: monitor: Comment out TCG profile ops, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 16/34] HACK: Disable list_cpus, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 17/34] HACK: globalise TCG page size variables, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 18/34] HACK: monitor: uninclude cpu_ldst, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 19/34] HACK: disas: Defeature print_target_address, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 20/34] HACK: exec: comment out use of cpu_get_tb_cpu_from_state, Peter Crosthwaite, 2015/05/31