summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2005-11-17 19:09:36 +0530
committerEric W. Biederman <ebiederm@xmission.com>2006-07-27 10:34:40 -0600
commit4e2f70e3c75f2b81878c34c4f8b3c298ec1b1cd2 (patch)
tree16d82aa503ca2eaad292f56ab1c34077274dcfac
parent084a640be5c31ce2698ecc5c66c654460f93f53a (diff)
kexec-tools: x86_64 backup first 640k
o This patch adds the support for saving first 640k to the backup region for x86_64. Signed-off-by: Murali <muralim@in.ibm.com> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
-rw-r--r--kexec/arch/x86_64/kexec-x86_64.c10
-rw-r--r--purgatory/arch/i386/crashdump_backup.c4
-rw-r--r--purgatory/arch/x86_64/Makefile1
-rw-r--r--purgatory/arch/x86_64/purgatory-x86_64.c3
4 files changed, 16 insertions, 2 deletions
diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c
index 530adcf..3ed3844 100644
--- a/kexec/arch/x86_64/kexec-x86_64.c
+++ b/kexec/arch/x86_64/kexec-x86_64.c
@@ -260,6 +260,8 @@ int arch_compat_trampoline(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *info)
{
+ uint8_t panic_kernel = 0;
+
elf_rel_set_symbol(&info->rhdr, "reset_vga",
&arch_options.reset_vga, sizeof(arch_options.reset_vga));
elf_rel_set_symbol(&info->rhdr, "serial_base",
@@ -270,4 +272,12 @@ void arch_update_purgatory(struct kexec_info *info)
&arch_options.console_vga, sizeof(arch_options.console_vga));
elf_rel_set_symbol(&info->rhdr, "console_serial",
&arch_options.console_serial, sizeof(arch_options.console_serial));
+
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
+ panic_kernel = 1;
+ elf_rel_set_symbol(&info->rhdr, "backup_start",
+ &info->backup_start, sizeof(info->backup_start));
+ }
+ elf_rel_set_symbol(&info->rhdr, "panic_kernel",
+ &panic_kernel, sizeof(panic_kernel));
}
diff --git a/purgatory/arch/i386/crashdump_backup.c b/purgatory/arch/i386/crashdump_backup.c
index 14e807f..39a1946 100644
--- a/purgatory/arch/i386/crashdump_backup.c
+++ b/purgatory/arch/i386/crashdump_backup.c
@@ -25,7 +25,9 @@
#define BACKUP_REGION_SIZE 0xa0000
/* Backup region start gets set after /proc/iomem has been parsed. */
-uint32_t backup_start = 0;
+/* We reuse the same code for x86_64 also so changing backup_start to
+ unsigned long */
+unsigned long backup_start = 0;
/* Backup first 640K of memory to backup region as reserved by kexec.
* Assuming first 640K has to be present on i386 machines and no address
diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
index d08edff..29f4340 100644
--- a/purgatory/arch/x86_64/Makefile
+++ b/purgatory/arch/x86_64/Makefile
@@ -9,6 +9,7 @@ PURGATORY_S_SRCS+= purgatory/arch/x86_64/entry64.S
PURGATORY_S_SRCS+= purgatory/arch/x86_64/setup-x86_64.S
PURGATORY_S_SRCS+= purgatory/arch/x86_64/stack.S
PURGATORY_C_SRCS+= purgatory/arch/x86_64/purgatory-x86_64.c
+PURGATORY_C_SRCS+= purgatory/arch/i386/crashdump_backup.c
PURGATORY_C_SRCS+= purgatory/arch/i386/console-x86.c
PURGATORY_C_SRCS+= purgatory/arch/i386/vga.c
PURGATORY_C_SRCS+= purgatory/arch/i386/pic.c
diff --git a/purgatory/arch/x86_64/purgatory-x86_64.c b/purgatory/arch/x86_64/purgatory-x86_64.c
index 8a2387c..b159ed3 100644
--- a/purgatory/arch/x86_64/purgatory-x86_64.c
+++ b/purgatory/arch/x86_64/purgatory-x86_64.c
@@ -4,6 +4,7 @@
uint8_t reset_vga = 0;
uint8_t legacy_pic = 0;
+uint8_t panic_kernel = 0;
void setup_arch(void)
{
@@ -14,5 +15,5 @@ void setup_arch(void)
/* This function can be used to execute after the SHA256 verification. */
void post_verification_setup_arch(void)
{
- /* Nothing for now */
+ if (panic_kernel) crashdump_backup_memory();
}