[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 24/26] include: split target_long definition from cpu-defs
From: |
Alex Bennée |
Subject: |
[PATCH v4 24/26] include: split target_long definition from cpu-defs |
Date: |
Thu, 2 Mar 2023 19:08:44 +0000 |
While we will continue to include this via cpu-defs it is useful to be
able to define this separately for 32 and 64 bit versions of an
otherwise target independent compilation unit.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v4
- update MAINTAINERS
---
MAINTAINERS | 1 +
include/exec/cpu-defs.h | 19 +----------------
include/exec/target_long.h | 42 ++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 18 deletions(-)
create mode 100644 include/exec/target_long.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 8d0113b8f9..3ef68cd0cf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -137,6 +137,7 @@ F: docs/devel/tcg*
F: include/exec/cpu*.h
F: include/exec/exec-all.h
F: include/exec/tb-flush.h
+F: include/exec/target_long.h
F: include/exec/helper*.h
F: include/sysemu/cpus.h
F: include/sysemu/tcg.h
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index be920d4208..cd8aa177cc 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -55,24 +55,7 @@
# endif
#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"
#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
diff --git a/include/exec/target_long.h b/include/exec/target_long.h
new file mode 100644
index 0000000000..93c9472971
--- /dev/null
+++ b/include/exec/target_long.h
@@ -0,0 +1,42 @@
+/*
+ * Target Long Definitions
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ * Copyright (c) 2023 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _TARGET_LONG_H_
+#define _TARGET_LONG_H_
+
+/*
+ * Usually this should only be included via cpu-defs.h however for
+ * certain cases where we want to build only two versions of a binary
+ * object we can include directly. However the build-system must
+ * ensure TARGET_LONG_BITS is defined directly.
+ */
+#ifndef TARGET_LONG_BITS
+#error TARGET_LONG_BITS not defined
+#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
+
+#endif /* _TARGET_LONG_H_ */
--
2.39.2
- [PATCH v4 06/26] gdbstub: move GDBState to shared internals header, (continued)
- [PATCH v4 06/26] gdbstub: move GDBState to shared internals header, Alex Bennée, 2023/03/02
- [PATCH v4 08/26] gdbstub: move fromhex/tohex routines to internals, Alex Bennée, 2023/03/02
- [PATCH v4 04/26] gdbstub: clean-up indent on gdb_exit, Alex Bennée, 2023/03/02
- [PATCH v4 12/26] gdbstub: rationalise signal mapping in softmmu, Alex Bennée, 2023/03/02
- [PATCH v4 10/26] gdbstub: move chunk of softmmu functionality to own file, Alex Bennée, 2023/03/02
- [PATCH v4 09/26] gdbstub: make various helpers visible to the rest of the module, Alex Bennée, 2023/03/02
- [PATCH v4 11/26] gdbstub: move chunks of user code into own files, Alex Bennée, 2023/03/02
- [PATCH v4 26/26] gdbstub: move update guest debug to accel ops, Alex Bennée, 2023/03/02
- [PATCH v4 23/26] testing: probe gdb for supported architectures ahead of time, Alex Bennée, 2023/03/02
- [PATCH v4 24/26] include: split target_long definition from cpu-defs,
Alex Bennée <=
- [PATCH v4 13/26] gdbstub: abstract target specific details from gdb_put_packet_binary, Alex Bennée, 2023/03/02
- [PATCH v4 18/26] gdbstub: fix address type of gdb_set_cpu_pc, Alex Bennée, 2023/03/02
- [PATCH v4 22/26] gdbstub: only compile gdbstub twice for whole build, Alex Bennée, 2023/03/02
- [PATCH v4 17/26] gdbstub: specialise stub_can_reverse, Alex Bennée, 2023/03/02
- [PATCH v4 19/26] gdbstub: don't use target_ulong while handling registers, Alex Bennée, 2023/03/02
- [PATCH v4 15/26] gdbstub: specialise target_memory_rw_debug, Alex Bennée, 2023/03/02
- [PATCH v4 16/26] gdbstub: introduce gdb_get_max_cpus, Alex Bennée, 2023/03/02
- [PATCH v4 14/26] gdbstub: specialise handle_query_attached, Alex Bennée, 2023/03/02
- [PATCH v4 20/26] gdbstub: move register helpers into standalone include, Alex Bennée, 2023/03/02
- [PATCH v4 25/26] gdbstub: split out softmmu/user specifics for syscall handling, Alex Bennée, 2023/03/02