[Crash-utility] [PATCH} crash 4.0-2.8 fixes to make it work on x86_64 for 2.6.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

Here is the final patch to make crash work on x86-64 for
2.6.14 kernel. 

Please let me know, if you want me to re-work or cleanup.

Thanks,
Badari


--- crash-4.0-2.8/defs.h	2005-10-21 11:36:32.000000000 -0700
+++ crash-4.0-2.8.new/defs.h	2005-11-01 15:05:41.834622632 -0800
@@ -1740,14 +1740,14 @@ struct load_module {
 #define _64BIT_
 #define MACHINE_TYPE       "X86_64"
 
-#define USERSPACE_TOP         0x0000008000000000
-#define __START_KERNEL_map    0xffffffff80000000
-#define PAGE_OFFSET           0x0000010000000000
+#define USERSPACE_TOP	(x86_64_userspace_top)
+#define PAGE_OFFSET	(x86_64_page_offset)
+#define VMALLOC_START	(x86_64_vmalloc_start_addr)
+#define VMALLOC_END	(x86_64_vmalloc_end)
+#define MODULES_VADDR	(x86_64_modules_vaddr) 
+#define MODULES_END	(x86_64_modules_end)
 
-#define VMALLOC_START   0xffffff0000000000
-#define VMALLOC_END     0xffffff7fffffffff
-#define MODULES_VADDR   0xffffffffa0000000
-#define MODULES_END     0xffffffffafffffff
+#define __START_KERNEL_map    0xffffffff80000000
 #define MODULES_LEN     (MODULES_END - MODULES_VADDR)
 
 #define PTOV(X)               ((unsigned long)(X)+(machdep->kvbase))
--- crash-4.0-2.8/x86_64.c	2005-10-21 11:36:32.000000000 -0700
+++ crash-4.0-2.8.new/x86_64.c	2005-11-01 15:13:58.646095808 -0800
@@ -65,6 +65,12 @@ static void x86_64_cpu_pda_init(void);
 static void x86_64_ist_init(void);
 static void x86_64_post_init(void);
 
+ulong x86_64_userspace_top;
+ulong x86_64_page_offset;
+ulong x86_64_vmalloc_start_addr;
+ulong x86_64_vmalloc_end;
+ulong x86_64_modules_vaddr;
+ulong x86_64_modules_end;
 
 struct machine_specific x86_64_machine_specific = { 0 };
 
@@ -105,6 +111,21 @@ x86_64_init(int when)
 		break;
 
 	case PRE_GDB:
+		if (symbol_exists("startup_64")) {
+			x86_64_userspace_top = 0x0000800000000000;
+			x86_64_page_offset = 0xffff810000000000;
+			x86_64_vmalloc_start_addr = 0xffffc20000000000;
+			x86_64_vmalloc_end = 0xffffe1ffffffffff;
+			x86_64_modules_vaddr = 0xffffffff88000000;
+			x86_64_modules_end = 0xfffffffffff00000;
+		} else {
+			x86_64_userspace_top = 0x0000008000000000;
+			x86_64_page_offset = 0x0000010000000000;
+			x86_64_vmalloc_start_addr = 0xffffff0000000000;
+			x86_64_vmalloc_end = 0xffffff7fffffffff;
+			x86_64_modules_vaddr = 0xffffffffa0000000;
+			x86_64_modules_end = 0xffffffffafffffff;
+		}
 	        machdep->kvbase = (ulong)PAGE_OFFSET;
 		machdep->identity_map_base = (ulong)PAGE_OFFSET;
                 machdep->is_kvaddr = x86_64_is_kvaddr;
@@ -329,9 +350,13 @@ x86_64_cpu_pda_init(void)
 	for (i = cpus = 0; i < nr_pda; i++) {
 		if (!CPU_PDA_READ(i, cpu_pda_buf))
 			break;
-		level4_pgt = ULONG(cpu_pda_buf + OFFSET(x8664_pda_level4_pgt));
+		if (VALID_MEMBER(x8664_pda_level4_pgt)) {
+			level4_pgt = ULONG(cpu_pda_buf + OFFSET(x8664_pda_level4_pgt));
+			if (!VALID_LEVEL4_PGT_ADDR(level4_pgt))
+				break;
+		}
 		cpunumber = INT(cpu_pda_buf + OFFSET(x8664_pda_cpunumber));
-		if (!VALID_LEVEL4_PGT_ADDR(level4_pgt) || (cpunumber != cpus))
+		if (cpunumber != cpus)
 			break;
 		cpus++;
 
@@ -2500,10 +2525,15 @@ x86_64_get_smp_cpus(void)
 	for (i = cpus = 0; i < nr_pda; i++) {
 		if (!CPU_PDA_READ(i, cpu_pda_buf))
 			break;
-		level4_pgt = ULONG(cpu_pda_buf + OFFSET(x8664_pda_level4_pgt));
+
+		if (VALID_MEMBER(x8664_pda_level4_pgt)) {
+			level4_pgt = ULONG(cpu_pda_buf + OFFSET(x8664_pda_level4_pgt));
+			if (!VALID_LEVEL4_PGT_ADDR(level4_pgt))
+				break;
+		}
 		cpunumber = INT(cpu_pda_buf + OFFSET(x8664_pda_cpunumber));
-                if (!VALID_LEVEL4_PGT_ADDR(level4_pgt) || (cpunumber != cpus))
-                        break;
+		if (cpunumber != cpus)
+			break;
                 cpus++;
 	}
 

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux