@@ -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 */
@@ -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 */
@@ -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);
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@suse.com> --- arch/x86/kexec.c | 15 +++++++++++++++ include/kexec.h | 3 +++ kexec.c | 2 ++ 3 files changed, 20 insertions(+)