|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [mini-os master] kexec: restructure building the start info data
commit f5969692186320b59d8864aa72bced542dcc8e0b
Author: Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Jul 15 15:29:26 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 16 15:04:19 2025 +0200
kexec: restructure building the start info data
Instead of setting most of the struct hvm_start_info fields first and
then building the leaf data, restructure kexec_get_entry() by
using an opaque "next" pointer where the next leaf data will be stored
and handle that leaf data together with the associated hvm_start_info
fields.
This will make it easier to add new data items without having to
rewrite large portions of the function.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
arch/x86/kexec.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kexec.c b/arch/x86/kexec.c
index d0af460..29f8aa8 100644
--- a/arch/x86/kexec.c
+++ b/arch/x86/kexec.c
@@ -215,6 +215,7 @@ void kexec_set_param_loc(const char *cmdline)
int kexec_get_entry(const char *cmdline)
{
+ void *next;
struct hvm_start_info *info;
struct hvm_memmap_table_entry *mmap;
unsigned int order;
@@ -229,16 +230,17 @@ int kexec_get_entry(const char *cmdline)
if ( !kexec_param_mem )
return ENOMEM;
- info = (struct hvm_start_info *)kexec_param_mem;
+ next = (void *)kexec_param_mem;
+
+ info = next;
memset(info, 0, sizeof(*info));
info->magic = XEN_HVM_START_MAGIC_VALUE;
info->version = 1;
- info->cmdline_paddr = kexec_param_pa + sizeof(*info) +
- e820_entries * sizeof(struct hvm_memmap_table_entry);
- info->memmap_paddr = kexec_param_pa + sizeof(*info);
- info->memmap_entries = e820_entries;
+ next = info + 1;
- mmap = (struct hvm_memmap_table_entry *)(info + 1);
+ mmap = next;
+ info->memmap_paddr = kexec_param_pa + (unsigned long)next -
kexec_param_mem;
+ info->memmap_entries = e820_entries;
for ( i = 0; i < e820_entries; i++ )
{
mmap->addr = e820_map[i].addr;
@@ -246,8 +248,10 @@ int kexec_get_entry(const char *cmdline)
mmap->type = e820_map[i].type;
mmap++;
}
+ next = mmap;
- strcpy((char *)mmap, cmdline);
+ info->cmdline_paddr = kexec_param_pa + (unsigned long)next -
kexec_param_mem;
+ strcpy(next, cmdline);
if ( kexec_add_action(KEXEC_COPY, to_virt(kexec_param_pa), info,
kexec_param_size) )
--
generated by git-patchbot for /home/xen/git/mini-os.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |