|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 07/11] x86 boot: define paddr_t and add macros for typedefing struct pointers
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
rather than a struct pointer type enables the type 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.
Introduces DEFINE_STRUCT_PTR_TYPE which will generate typedefs with a
_ptr_t suffix for pointers to the specified struct. This is then used
in <xen/bootinfo.h>
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.
paddr_t is used in <xen/bootinfo.h> so a definition is added here to
the x86 boot environment defs.h header.
Signed-off-by: Christopher Clark <christopher.w.clark@xxxxxxxxx>
Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
New in v2 of series
---
xen/arch/x86/boot/defs.h | 5 +++++
xen/arch/x86/include/asm/bootinfo.h | 2 ++
xen/include/xen/bootinfo.h | 7 ++++---
xen/include/xen/types.h | 5 +++++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index f9840044ec..867df6d18d 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -60,4 +60,9 @@ typedef u64 uint64_t;
#define U16_MAX ((u16)(~0U))
#define UINT_MAX (~0U)
+typedef unsigned long long paddr_t;
+
+#define DEFINE_STRUCT_PTR_TYPE(struct_name) \
+ typedef uint64_t struct_name ## _ptr_t;
+
#endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/include/asm/bootinfo.h
b/xen/arch/x86/include/asm/bootinfo.h
index 30c27980e0..8d1261503d 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -6,6 +6,7 @@ struct arch_bootmodule {
uint32_t flags;
unsigned headroom;
};
+DEFINE_STRUCT_PTR_TYPE(arch_bootmodule);
struct arch_boot_info {
uint32_t flags;
@@ -19,6 +20,7 @@ struct arch_boot_info {
uint32_t mmap_length;
paddr_t mmap_addr;
};
+DEFINE_STRUCT_PTR_TYPE(arch_boot_info);
struct __packed mb_memmap {
uint32_t size;
diff --git a/xen/include/xen/bootinfo.h b/xen/include/xen/bootinfo.h
index 2f4284a91f..8ee3ee36e9 100644
--- a/xen/include/xen/bootinfo.h
+++ b/xen/include/xen/bootinfo.h
@@ -35,17 +35,18 @@ struct boot_module {
mfn_t mfn;
size_t size;
- struct arch_bootmodule *arch;
+ arch_bootmodule_ptr_t arch;
struct boot_string string;
};
+DEFINE_STRUCT_PTR_TYPE(boot_module);
struct boot_info {
char *cmdline;
unsigned int nr_mods;
- struct boot_module *mods;
+ boot_module_ptr_t mods;
- struct arch_boot_info *arch;
+ arch_boot_info_ptr_t arch;
};
#endif
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 6aba80500a..78a2079619 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -71,4 +71,9 @@ typedef bool bool_t;
#define test_and_set_bool(b) xchg(&(b), true)
#define test_and_clear_bool(b) xchg(&(b), false)
+#ifndef DEFINE_STRUCT_PTR_TYPE
+#define DEFINE_STRUCT_PTR_TYPE(struct_name) \
+ typedef struct struct_name * struct_name ## _ptr_t;
+#endif
+
#endif /* __TYPES_H__ */
--
2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |