diff options
author | Huang Ying <ying.huang@intel.com> | 2008-10-29 11:24:25 +0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2008-10-31 12:58:16 +1100 |
commit | ceb04ae1223ba5cdd40df744aa73a32b2cc7d879 (patch) | |
tree | 993024edfe07b9cd7150fb2131175104e4948ad4 /kexec/arch/i386/kexec-bzImage.c | |
parent | 802a8a5e396e06a514251c44454c982bff3c5073 (diff) |
kexec jump support for kexec-tools
To support memory backup/restore an option named
--load-preserve-context is added to kexec. When it is specified
toggether with --mem-max, most segments for crash dump support are
loaded, and the memory range between mem_min to mem_max which has no
segments loaded are loaded as backup segments. To support jump back
from kexeced, options named --load-jump-back-helper and --entry are
added to load a helper image with specified entry to jump back.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/i386/kexec-bzImage.c')
-rw-r--r-- | kexec/arch/i386/kexec-bzImage.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c index 1f40076..be88a3f 100644 --- a/kexec/arch/i386/kexec-bzImage.c +++ b/kexec/arch/i386/kexec-bzImage.c @@ -114,6 +114,7 @@ int do_bzImage_load(struct kexec_info *info, unsigned int relocatable_kernel = 0; unsigned long kernel32_load_addr; char *modified_cmdline; + unsigned long cmdline_end; /* * Find out about the file I am about to load. @@ -166,7 +167,7 @@ int do_bzImage_load(struct kexec_info *info, /* Need to append some command line parameters internally in case of * taking crash dumps. */ - if (info->kexec_flags & KEXEC_ON_CRASH) { + if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) { modified_cmdline = xmalloc(COMMAND_LINE_SIZE); memset((void *)modified_cmdline, 0, COMMAND_LINE_SIZE); if (command_line) { @@ -205,11 +206,11 @@ int do_bzImage_load(struct kexec_info *info, 0x3000, 640*1024, -1, 0); dbgprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr); /* The argument/parameter segment */ - setup_size = kern16_size + command_line_len; + setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE; real_mode = xmalloc(setup_size); memcpy(real_mode, kernel, kern16_size); - if (info->kexec_flags & KEXEC_ON_CRASH) { + if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) { /* If using bzImage for capture kernel, then we will not be * executing real mode code. setup segment can be loaded * anywhere as we will be just reading command line. @@ -316,6 +317,9 @@ int do_bzImage_load(struct kexec_info *info, elf_rel_set_symbol(&info->rhdr, "entry16_regs", ®s16, sizeof(regs16)); elf_rel_set_symbol(&info->rhdr, "entry16_debug_regs", ®s16, sizeof(regs16)); elf_rel_set_symbol(&info->rhdr, "entry32_regs", ®s32, sizeof(regs32)); + cmdline_end = setup_base + kern16_size + command_line_len - 1; + elf_rel_set_symbol(&info->rhdr, "cmdline_end", &cmdline_end, + sizeof(unsigned long)); /* Fill in the information BIOS calls would normally provide. */ if (!real_mode_entry) { |