[Crash-utility] [PATCH V2] crash: arm32: a better way to identify LPAE enabled kernel

Liu Hua sdu.liu at huawei.com
Sun Sep 21 02:14:25 UTC 2014


Thanks to Dave's suggest, I impove the way to identify
LPAE enabled kernel for arm platform, for compatibility with
some old kernel.

If a vmcore santisfy one of the following conditions, It must
be generated by a LPAE enabled kernel.

(1) it has CONFIG_ARM_LPAE=y vmcore_info
(2) swapper_pg_dir and its next symbol value differ by 0x5000

changes from V1:
 - drop function next_symbol_value

Signed-off-by: Liu Hua <sdu.liu at huawei.com>
---
 arm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arm.c b/arm.c
index cb7d841..e7d3dbc 100644
--- a/arm.c
+++ b/arm.c
@@ -190,6 +190,8 @@ void
 arm_init(int when)
 {
 	ulong vaddr;
+	char *string;
+	struct syment *sp;
 
 #if defined(__i386__) || defined(__x86_64__)
 	if (ACTIVE())
@@ -229,8 +231,13 @@ arm_init(int when)
 		 * LPAE requires an additional page for the PGD, 
 		 * so PG_DIR_SIZE = 0x5000 for LPAE
 		 */
-		if ((symbol_value("_text") - symbol_value("swapper_pg_dir")) == 0x5000)
+		if ((string = pc->read_vmcoreinfo("CONFIG_ARM_LPAE"))) {
 			machdep->flags |= PAE;
+			free(string);
+		} else if ((sp = next_symbol("swapper_pg_dir", NULL)) &&
+		         (sp->value - symbol_value("swapper_pg_dir")) == 0x5000)
+                         machdep->flags |= PAE;
+
 		machdep->kvbase = symbol_value("_stext") & ~KVBASE_MASK;
 		machdep->identity_map_base = machdep->kvbase;
 		machdep->is_kvaddr = arm_is_kvaddr;
-- 
1.9.0




More information about the Crash-utility mailing list