Commit 27f48d3e authored by Vivek Goyal's avatar Vivek Goyal Committed by Linus Torvalds

kexec-bzImage64: support for loading bzImage using 64bit entry

This is loader specific code which can load bzImage and set it up for
64bit entry.  This does not take care of 32bit entry or real mode entry.

32bit mode entry can be implemented if somebody needs it.
Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: WANG Chao <chaowang@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 12db5562
#ifndef _ASM_KEXEC_BZIMAGE64_H
#define _ASM_KEXEC_BZIMAGE64_H
extern struct kexec_file_ops kexec_bzImage64_ops;
#endif /* _ASM_KEXE_BZIMAGE64_H */
......@@ -23,6 +23,7 @@
#include <asm/page.h>
#include <asm/ptrace.h>
#include <asm/bootparam.h>
/*
* KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
......@@ -161,6 +162,26 @@ struct kimage_arch {
pmd_t *pmd;
pte_t *pte;
};
struct kexec_entry64_regs {
uint64_t rax;
uint64_t rbx;
uint64_t rcx;
uint64_t rdx;
uint64_t rsi;
uint64_t rdi;
uint64_t rsp;
uint64_t rbp;
uint64_t r8;
uint64_t r9;
uint64_t r10;
uint64_t r11;
uint64_t r12;
uint64_t r13;
uint64_t r14;
uint64_t r15;
uint64_t rip;
};
#endif
typedef void crash_vmclear_fn(void);
......
......@@ -118,4 +118,5 @@ ifeq ($(CONFIG_X86_64),y)
obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
obj-y += vsmp_64.o
obj-$(CONFIG_KEXEC) += kexec-bzimage64.o
endif
This diff is collapsed.
......@@ -23,9 +23,10 @@
#include <asm/tlbflush.h>
#include <asm/mmu_context.h>
#include <asm/debugreg.h>
#include <asm/kexec-bzimage64.h>
static struct kexec_file_ops *kexec_file_loaders[] = {
NULL,
&kexec_bzImage64_ops,
};
static void free_transition_pgtable(struct kimage *image)
......@@ -328,7 +329,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image)
if (!image->fops || !image->fops->cleanup)
return 0;
return image->fops->cleanup(image);
return image->fops->cleanup(image->image_loader_data);
}
/*
......
......@@ -190,7 +190,7 @@ typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
unsigned long kernel_len, char *initrd,
unsigned long initrd_len, char *cmdline,
unsigned long cmdline_len);
typedef int (kexec_cleanup_t)(struct kimage *image);
typedef int (kexec_cleanup_t)(void *loader_data);
struct kexec_file_ops {
kexec_probe_t *probe;
......
......@@ -460,6 +460,14 @@ static void kimage_file_post_load_cleanup(struct kimage *image)
/* See if architecture has anything to cleanup post load */
arch_kimage_file_post_load_cleanup(image);
/*
* Above call should have called into bootloader to free up
* any data stored in kimage->image_loader_data. It should
* be ok now to free it up.
*/
kfree(image->image_loader_data);
image->image_loader_data = NULL;
}
/*
......@@ -576,7 +584,6 @@ kimage_file_alloc_init(struct kimage **rimage, int kernel_fd,
kimage_free_page_list(&image->control_pages);
out_free_post_load_bufs:
kimage_file_post_load_cleanup(image);
kfree(image->image_loader_data);
out_free_image:
kfree(image);
return ret;
......@@ -900,8 +907,6 @@ static void kimage_free(struct kimage *image)
/* Free the kexec control pages... */
kimage_free_page_list(&image->control_pages);
kfree(image->image_loader_data);
/*
* Free up any temporary buffers allocated. This might hit if
* error occurred much later after buffer allocation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment