|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 08/11] types, x86 boot: define DEFINE_PTR_TYPE and char_ptr_t
Pointer fields within structs need to be defined as fixed size types in
the x86 boot build environment. Using a typedef for the field type
enables the definition to be changed in the 32-bit boot build and
the main hypervisor build, allowing for a single common structure
definition and a common header file.
Add a macro for defining pointer types for fields and use this macro for
pointers to chars in <xen/bootinfo.h> and <asm/bootinfo.h> as
preparation for using these headers in the x86 boot build.
The 32-bit behaviour is obtained by inclusion of "defs.h" first with a
check for such an existing definition on the <xen/types.h> version.
Signed-off-by: Christopher Clark <christopher.w.clark@xxxxxxxxx>
Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
New in v2
---
xen/arch/x86/boot/defs.h | 4 ++++
xen/arch/x86/include/asm/bootinfo.h | 2 +-
xen/include/xen/bootinfo.h | 2 +-
xen/include/xen/types.h | 6 ++++++
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 867df6d18d..bc0f1b5cf8 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -65,4 +65,8 @@ typedef unsigned long long paddr_t;
#define DEFINE_STRUCT_PTR_TYPE(struct_name) \
typedef uint64_t struct_name ## _ptr_t;
+#define DEFINE_PTR_TYPE(type) \
+ typedef uint64_t type ## _ptr_t;
+DEFINE_PTR_TYPE(char);
+
#endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/include/asm/bootinfo.h
b/xen/arch/x86/include/asm/bootinfo.h
index 8d1261503d..989fb7a1da 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -15,7 +15,7 @@ struct arch_boot_info {
#define BOOTINFO_FLAG_X86_MEMMAP 1U << 6
#define BOOTINFO_FLAG_X86_LOADERNAME 1U << 9
- char *boot_loader_name;
+ char_ptr_t boot_loader_name;
uint32_t mmap_length;
paddr_t mmap_addr;
diff --git a/xen/include/xen/bootinfo.h b/xen/include/xen/bootinfo.h
index 8ee3ee36e9..8389da4f72 100644
--- a/xen/include/xen/bootinfo.h
+++ b/xen/include/xen/bootinfo.h
@@ -41,7 +41,7 @@ struct boot_module {
DEFINE_STRUCT_PTR_TYPE(boot_module);
struct boot_info {
- char *cmdline;
+ char_ptr_t cmdline;
unsigned int nr_mods;
boot_module_ptr_t mods;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 78a2079619..e807ffe255 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -76,4 +76,10 @@ typedef bool bool_t;
typedef struct struct_name * struct_name ## _ptr_t;
#endif
+#ifndef DEFINE_PTR_TYPE
+#define DEFINE_PTR_TYPE(type) \
+ typedef type * type ## _ptr_t;
+DEFINE_PTR_TYPE(char);
+#endif
+
#endif /* __TYPES_H__ */
--
2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |