[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [MINI-OS PATCH 05/12] 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> --- 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 2069f3c6..98a478d3 100644 --- a/arch/x86/kexec.c +++ b/arch/x86/kexec.c @@ -197,4 +197,19 @@ bool kexec_arch_need_analyze_shdrs(void) { return kernel_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 f54cbb90..8a2b552f 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 3ff4ea07..7e559994 100644 --- a/kexec.c +++ b/kexec.c @@ -173,6 +173,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); -- 2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |