[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [mini-os master] mini-os: kexec: finalize parameter location and size
commit e6fcfc1d58a9d2c929da849262409351992c771f Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Mon Jun 23 10:40:52 2025 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jun 23 10:40:52 2025 +0200 mini-os: kexec: finalize parameter location and size Finalize the location and the size of the parameters for the new kernel. This is needed in order to avoid allocating new memory in the area occupied by the new kernel and parameters. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx> --- arch/x86/kexec.c | 15 +++++++++++++++ include/kexec.h | 3 +++ kexec.c | 2 ++ 3 files changed, 20 insertions(+) diff --git a/arch/x86/kexec.c b/arch/x86/kexec.c index 736ca1b..4783090 100644 --- a/arch/x86/kexec.c +++ b/arch/x86/kexec.c @@ -196,4 +196,19 @@ bool kexec_arch_need_analyze_shdrs(void) { return kernel_phys_entry == ~0UL; } + +static unsigned long kexec_param_loc; +static unsigned int kexec_param_size; + +void kexec_set_param_loc(const char *cmdline) +{ + kexec_param_size = sizeof(struct hvm_start_info); + kexec_param_size += e820_entries * sizeof(struct hvm_memmap_table_entry); + kexec_param_size += strlen(cmdline) + 1; + + kexec_last_addr = (kexec_last_addr + 7) & ~7UL; + kexec_param_loc = kexec_last_addr; + kexec_last_addr += kexec_param_size; + kexec_last_addr = round_pgup(kexec_last_addr); +} #endif /* CONFIG_KEXEC */ diff --git a/include/kexec.h b/include/kexec.h index f54cbb9..8a2b552 100644 --- a/include/kexec.h +++ b/include/kexec.h @@ -42,4 +42,7 @@ int kexec_arch_analyze_phdr(elf_ehdr *ehdr, elf_phdr *phdr); int kexec_arch_analyze_shdr(elf_ehdr *ehdr, elf_shdr *shdr); bool kexec_arch_need_analyze_shdrs(void); +/* Finalize parameter location and size. */ +void kexec_set_param_loc(const char *cmdline); + #endif /* _KEXEC_H */ diff --git a/kexec.c b/kexec.c index 7c0e637..3183938 100644 --- a/kexec.c +++ b/kexec.c @@ -172,6 +172,8 @@ int kexec(void *kernel, unsigned long kernel_size, const char *cmdline) if ( ret ) return ret; + kexec_set_param_loc(cmdline); + return ENOSYS; } EXPORT_SYMBOL(kexec); -- generated by git-patchbot for /home/xen/git/mini-os.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |