summaryrefslogtreecommitdiffstats
path: root/purgatory
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2005-08-04 17:46:07 +0530
committerEric W. Biederman <ebiederm@xmission.com>2006-07-27 09:36:34 -0600
commit1ac3ddd1d4a3d8cb7af5fd02c1ffb85893c4ea50 (patch)
tree9df26ececf6fdd915fc54c7d080788efdd40a7b7 /purgatory
parentdcb661fb3e778052d64b1b1557621856eade403a (diff)
downloadkexec-tools-1ac3ddd1d4a3d8cb7af5fd02c1ffb85893c4ea50.tar.gz
crashdump backup region handling
o This patch adds support for reserving space for backup region. Also adds code in purgatory to copy the first 640K to backup region. o Moved kexec_flags inside kexec_info structure. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Diffstat (limited to 'purgatory')
-rw-r--r--purgatory/arch/i386/Makefile1
-rw-r--r--purgatory/arch/i386/crashdump_backup.c44
-rw-r--r--purgatory/arch/i386/purgatory-x86.c7
-rw-r--r--purgatory/arch/i386/purgatory-x86.h1
-rw-r--r--purgatory/arch/ia64/purgatory-ia64.c6
-rw-r--r--purgatory/arch/ppc/purgatory-ppc.c6
-rw-r--r--purgatory/arch/x86_64/purgatory-x86_64.c6
-rw-r--r--purgatory/include/purgatory.h1
-rw-r--r--purgatory/purgatory.c1
9 files changed, 73 insertions, 0 deletions
diff --git a/purgatory/arch/i386/Makefile b/purgatory/arch/i386/Makefile
index 8af604c2..97478f41 100644
--- a/purgatory/arch/i386/Makefile
+++ b/purgatory/arch/i386/Makefile
@@ -12,3 +12,4 @@ PURGATORY_C_SRCS+= purgatory/arch/i386/purgatory-x86.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
+PURGATORY_C_SRCS+= purgatory/arch/i386/crashdump_backup.c
diff --git a/purgatory/arch/i386/crashdump_backup.c b/purgatory/arch/i386/crashdump_backup.c
new file mode 100644
index 00000000..14e807fe
--- /dev/null
+++ b/purgatory/arch/i386/crashdump_backup.c
@@ -0,0 +1,44 @@
+/*
+ * kexec: Linux boots Linux
+ *
+ * Created by: Vivek goyal (vgoyal@in.ibm.com)
+ * Copyright (C) IBM Corporation, 2005. All rights reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation (version 2 of the License).
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#define BACKUP_REGION_SOURCE 0x00000000
+#define BACKUP_REGION_SIZE 0xa0000
+
+/* Backup region start gets set after /proc/iomem has been parsed. */
+uint32_t 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
+ * validity checks have to be performed. */
+
+void crashdump_backup_memory(void)
+{
+ void *dest, *src;
+
+ src = (void *) BACKUP_REGION_SOURCE;
+
+ if (backup_start) {
+ dest = (void *)(backup_start);
+ memcpy(dest, src, BACKUP_REGION_SIZE);
+ }
+}
diff --git a/purgatory/arch/i386/purgatory-x86.c b/purgatory/arch/i386/purgatory-x86.c
index 442358a2..5ad07404 100644
--- a/purgatory/arch/i386/purgatory-x86.c
+++ b/purgatory/arch/i386/purgatory-x86.c
@@ -30,6 +30,7 @@ void x86_setup_cpu(void)
uint8_t reset_vga = 0;
uint8_t legacy_timer = 0;
uint8_t legacy_pic = 0;
+uint8_t panic_kernel = 0;
void setup_arch(void)
{
@@ -38,3 +39,9 @@ void setup_arch(void)
if (legacy_pic) x86_setup_legacy_pic();
/* if (legacy_timer) x86_setup_legacy_timer(); */
}
+
+/* This function can be used to execute after the SHA256 verification. */
+void post_verification_setup_arch(void)
+{
+ if (panic_kernel) crashdump_backup_memory();
+}
diff --git a/purgatory/arch/i386/purgatory-x86.h b/purgatory/arch/i386/purgatory-x86.h
index 4178b379..02039c9f 100644
--- a/purgatory/arch/i386/purgatory-x86.h
+++ b/purgatory/arch/i386/purgatory-x86.h
@@ -4,5 +4,6 @@
void x86_reset_vga(void);
void x86_setup_legacy_pic(void);
void x86_setup_legacy_timer(void);
+void crashdump_backup_memory(void);
#endif /* PURGATORY_X86_H */
diff --git a/purgatory/arch/ia64/purgatory-ia64.c b/purgatory/arch/ia64/purgatory-ia64.c
index c10cbeaf..369e175b 100644
--- a/purgatory/arch/ia64/purgatory-ia64.c
+++ b/purgatory/arch/ia64/purgatory-ia64.c
@@ -5,3 +5,9 @@ void setup_arch(void)
{
/* Nothing for now */
}
+
+/* This function can be used to execute after the SHA256 verification. */
+void post_verification_setup_arch(void)
+{
+ /* Nothing for now */
+}
diff --git a/purgatory/arch/ppc/purgatory-ppc.c b/purgatory/arch/ppc/purgatory-ppc.c
index ab4d941d..077f495a 100644
--- a/purgatory/arch/ppc/purgatory-ppc.c
+++ b/purgatory/arch/ppc/purgatory-ppc.c
@@ -5,3 +5,9 @@ void setup_arch(void)
{
/* Nothing for now */
}
+
+/* This function can be used to execute after the SHA256 verification. */
+void post_verification_setup_arch(void)
+{
+ /* Nothing for now */
+}
diff --git a/purgatory/arch/x86_64/purgatory-x86_64.c b/purgatory/arch/x86_64/purgatory-x86_64.c
index f839ab5e..8a2387c3 100644
--- a/purgatory/arch/x86_64/purgatory-x86_64.c
+++ b/purgatory/arch/x86_64/purgatory-x86_64.c
@@ -10,3 +10,9 @@ void setup_arch(void)
if (reset_vga) x86_reset_vga();
if (legacy_pic) x86_setup_legacy_pic();
}
+
+/* This function can be used to execute after the SHA256 verification. */
+void post_verification_setup_arch(void)
+{
+ /* Nothing for now */
+}
diff --git a/purgatory/include/purgatory.h b/purgatory/include/purgatory.h
index 93037f20..79ed5bfe 100644
--- a/purgatory/include/purgatory.h
+++ b/purgatory/include/purgatory.h
@@ -4,5 +4,6 @@
void putchar(int ch);
void printf(const char *fmt, ...);
void setup_arch(void);
+void post_verification_setup_arch(void);
#endif /* PURGATORY_H */
diff --git a/purgatory/purgatory.c b/purgatory/purgatory.c
index 97fc638d..ad0cac2a 100644
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -44,4 +44,5 @@ void purgatory(void)
printf("I'm in purgatory\n");
setup_arch();
verify_sha256_digest();
+ post_verification_setup_arch();
}