[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 23/24] include: split target_long definition from cpu-defs
From: |
Alex Bennée |
Subject: |
[PATCH v3 23/24] include: split target_long definition from cpu-defs |
Date: |
Tue, 21 Feb 2023 22:52:26 +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.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
include/exec/cpu-defs.h | 19 +----------------
include/exec/target_long.h | 42 ++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 18 deletions(-)
create mode 100644 include/exec/target_long.h
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 21309cf567..98605dfba2 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -58,24 +58,7 @@
# define TARGET_TB_PCREL 0
#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.1
- [PATCH v3 01/24] gdbstub/internals.h: clean up include guard, (continued)
- [PATCH v3 01/24] gdbstub/internals.h: clean up include guard, Alex Bennée, 2023/02/21
- [PATCH v3 03/24] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs, Alex Bennée, 2023/02/21
- [PATCH v3 02/24] gdbstub: fix-up copyright and license files, Alex Bennée, 2023/02/21
- [PATCH v3 04/24] gdbstub: define separate user/system structures, Alex Bennée, 2023/02/21
- [PATCH v3 05/24] gdbstub: move GDBState to shared internals header, Alex Bennée, 2023/02/21
- [PATCH v3 06/24] includes: move tb_flush into its own header, Alex Bennée, 2023/02/21
- [PATCH v3 07/24] gdbstub: move fromhex/tohex routines to internals, Alex Bennée, 2023/02/21
- [PATCH v3 11/24] gdbstub: rationalise signal mapping in softmmu, Alex Bennée, 2023/02/21
- [PATCH v3 08/24] gdbstub: make various helpers visible to the rest of the module, Alex Bennée, 2023/02/21
- [PATCH v3 09/24] gdbstub: move chunk of softmmu functionality to own file, Alex Bennée, 2023/02/21
- [PATCH v3 23/24] include: split target_long definition from cpu-defs,
Alex Bennée <=
- [PATCH v3 24/24] gdbstub: split out softmmu/user specifics for syscall handling, Alex Bennée, 2023/02/21
- [PATCH v3 10/24] gdbstub: move chunks of user code into own files, Alex Bennée, 2023/02/21
- [PATCH v3 13/24] gdbstub: specialise handle_query_attached, Alex Bennée, 2023/02/21
- [PATCH v3 15/24] gdbstub: introduce gdb_get_max_cpus, Alex Bennée, 2023/02/21
- [PATCH v3 12/24] gdbstub: abstract target specific details from gdb_put_packet_binary, Alex Bennée, 2023/02/21
- [PATCH v3 14/24] gdbstub: specialise target_memory_rw_debug, Alex Bennée, 2023/02/21
- [PATCH v3 18/24] gdbstub: don't use target_ulong while handling registers, Alex Bennée, 2023/02/21
- [PATCH v3 22/24] testing: probe gdb for supported architectures ahead of time, Alex Bennée, 2023/02/21
- [PATCH v3 20/24] gdbstub: move syscall handling to new file, Alex Bennée, 2023/02/21
- [PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build, Alex Bennée, 2023/02/21