|
|
d39c82 |
diff -up crash-7.0.9/arm64.c.orig crash-7.0.9/arm64.c
|
|
|
d39c82 |
--- crash-7.0.9/arm64.c.orig 2015-04-21 11:45:27.324756052 -0400
|
|
|
d39c82 |
+++ crash-7.0.9/arm64.c 2015-04-21 11:46:44.288416377 -0400
|
|
|
d39c82 |
@@ -1,8 +1,8 @@
|
|
|
d39c82 |
/*
|
|
|
d39c82 |
* arm64.c - core analysis suite
|
|
|
d39c82 |
*
|
|
|
d39c82 |
- * Copyright (C) 2012-2014 David Anderson
|
|
|
d39c82 |
- * Copyright (C) 2012-2014 Red Hat, Inc. All rights reserved.
|
|
|
d39c82 |
+ * Copyright (C) 2012-2015 David Anderson
|
|
|
d39c82 |
+ * Copyright (C) 2012-2015 Red Hat, Inc. All rights reserved.
|
|
|
d39c82 |
*
|
|
|
d39c82 |
* This program is free software; you can redistribute it and/or modify
|
|
|
d39c82 |
* it under the terms of the GNU General Public License as published by
|
|
|
d39c82 |
@@ -26,6 +26,7 @@ static struct machine_specific arm64_mac
|
|
|
d39c82 |
static int arm64_verify_symbol(const char *, ulong, char);
|
|
|
d39c82 |
static void arm64_parse_cmdline_args(void);
|
|
|
d39c82 |
static void arm64_calc_phys_offset(void);
|
|
|
d39c82 |
+static void arm64_calc_virtual_memory_ranges(void);
|
|
|
d39c82 |
static int arm64_kdump_phys_base(ulong *);
|
|
|
d39c82 |
static ulong arm64_processor_speed(void);
|
|
|
d39c82 |
static void arm64_init_kernel_pgd(void);
|
|
|
d39c82 |
@@ -188,6 +189,7 @@ arm64_init(int when)
|
|
|
d39c82 |
break;
|
|
|
d39c82 |
|
|
|
d39c82 |
case POST_GDB:
|
|
|
d39c82 |
+ arm64_calc_virtual_memory_ranges();
|
|
|
d39c82 |
machdep->section_size_bits = _SECTION_SIZE_BITS;
|
|
|
d39c82 |
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
|
|
|
d39c82 |
if (THIS_KERNEL_VERSION >= LINUX(3,10,0)) {
|
|
|
d39c82 |
@@ -243,6 +245,9 @@ arm64_verify_symbol(const char *name, ul
|
|
|
d39c82 |
if (!name || !strlen(name))
|
|
|
d39c82 |
return FALSE;
|
|
|
d39c82 |
|
|
|
d39c82 |
+ if (((type == 'A') || (type == 'a')) && (highest_bit_long(value) != 63))
|
|
|
d39c82 |
+ return FALSE;
|
|
|
d39c82 |
+
|
|
|
d39c82 |
if ((value == 0) &&
|
|
|
d39c82 |
((type == 'a') || (type == 'n') || (type == 'N') || (type == 'U')))
|
|
|
d39c82 |
return FALSE;
|
|
|
d39c82 |
@@ -276,6 +281,8 @@ arm64_dump_machdep_table(ulong arg)
|
|
|
d39c82 |
fprintf(fp, "%sVM_L2_64K", others++ ? "|" : "");
|
|
|
d39c82 |
if (machdep->flags & VM_L3_4K)
|
|
|
d39c82 |
fprintf(fp, "%sVM_L3_4K", others++ ? "|" : "");
|
|
|
d39c82 |
+ if (machdep->flags & VMEMMAP)
|
|
|
d39c82 |
+ fprintf(fp, "%sVMEMMAP", others++ ? "|" : "");
|
|
|
d39c82 |
fprintf(fp, ")\n");
|
|
|
d39c82 |
|
|
|
d39c82 |
fprintf(fp, " kvbase: %lx\n", machdep->kvbase);
|
|
|
d39c82 |
@@ -365,6 +372,7 @@ arm64_dump_machdep_table(ulong arg)
|
|
|
d39c82 |
fprintf(fp, " modules_vaddr: %016lx\n", ms->modules_vaddr);
|
|
|
d39c82 |
fprintf(fp, " modules_end: %016lx\n", ms->modules_end);
|
|
|
d39c82 |
fprintf(fp, " vmemmap_vaddr: %016lx\n", ms->vmemmap_vaddr);
|
|
|
d39c82 |
+ fprintf(fp, " vmemmap_end: %016lx\n", ms->vmemmap_end);
|
|
|
d39c82 |
fprintf(fp, " phys_offset: %lx\n", ms->phys_offset);
|
|
|
d39c82 |
fprintf(fp, "__exception_text_start: %lx\n", ms->__exception_text_start);
|
|
|
d39c82 |
fprintf(fp, " __exception_text_end: %lx\n", ms->__exception_text_end);
|
|
|
d39c82 |
@@ -1649,6 +1657,57 @@ arm64_calc_VA_BITS(void)
|
|
|
d39c82 |
|
|
|
d39c82 |
}
|
|
|
d39c82 |
|
|
|
d39c82 |
+/*
|
|
|
d39c82 |
+ * The size and end of the vmalloc range is dependent upon the kernel's
|
|
|
d39c82 |
+ * VMEMMAP_SIZE value, and the vmemmap range is dependent upon the end
|
|
|
d39c82 |
+ * of the vmalloc range as well as the VMEMMAP_SIZE:
|
|
|
d39c82 |
+ *
|
|
|
d39c82 |
+ * #define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
|
|
|
d39c82 |
+ * #define VMALLOC_START (UL(0xffffffffffffffff) << VA_BITS)
|
|
|
d39c82 |
+ * #define VMALLOC_END (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
|
|
|
d39c82 |
+ *
|
|
|
d39c82 |
+ * Since VMEMMAP_SIZE is dependent upon the size of a struct page,
|
|
|
d39c82 |
+ * the two ranges cannot be determined until POST_GDB.
|
|
|
d39c82 |
+ */
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
|
|
|
d39c82 |
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
|
|
|
d39c82 |
+#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
|
|
d39c82 |
+#define SZ_64K 0x00010000
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+static void
|
|
|
d39c82 |
+arm64_calc_virtual_memory_ranges(void)
|
|
|
d39c82 |
+{
|
|
|
d39c82 |
+ struct machine_specific *ms = machdep->machspec;
|
|
|
d39c82 |
+ ulong vmemmap_start, vmemmap_end, vmemmap_size;
|
|
|
d39c82 |
+ ulong vmalloc_end;
|
|
|
d39c82 |
+ ulong PUD_SIZE = UNINITIALIZED;
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+ if (THIS_KERNEL_VERSION < LINUX(3,17,0)) /* use original hardwired values */
|
|
|
d39c82 |
+ return;
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+ STRUCT_SIZE_INIT(page, "page");
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+ switch (machdep->flags & (VM_L2_64K|VM_L3_4K))
|
|
|
d39c82 |
+ {
|
|
|
d39c82 |
+ case VM_L2_64K:
|
|
|
d39c82 |
+ PUD_SIZE = PGDIR_SIZE_L2_64K;
|
|
|
d39c82 |
+ break;
|
|
|
d39c82 |
+ case VM_L3_4K:
|
|
|
d39c82 |
+ PUD_SIZE = PGDIR_SIZE_L3_4K;
|
|
|
d39c82 |
+ break;
|
|
|
d39c82 |
+ }
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+ vmemmap_size = ALIGN((1UL << (ms->VA_BITS - machdep->pageshift)) * SIZE(page), PUD_SIZE);
|
|
|
d39c82 |
+ vmalloc_end = (ms->page_offset - PUD_SIZE - vmemmap_size - SZ_64K);
|
|
|
d39c82 |
+ vmemmap_start = vmalloc_end + SZ_64K;
|
|
|
d39c82 |
+ vmemmap_end = vmemmap_start + vmemmap_size;
|
|
|
d39c82 |
+
|
|
|
d39c82 |
+ ms->vmalloc_end = vmalloc_end - 1;
|
|
|
d39c82 |
+ ms->vmemmap_vaddr = vmemmap_start;
|
|
|
d39c82 |
+ ms->vmemmap_end = vmemmap_end - 1;
|
|
|
d39c82 |
+}
|
|
|
d39c82 |
+
|
|
|
d39c82 |
static int
|
|
|
d39c82 |
arm64_is_uvaddr(ulong addr, struct task_context *tc)
|
|
|
d39c82 |
{
|
|
|
d39c82 |
diff -up crash-7.0.9/defs.h.orig crash-7.0.9/defs.h
|
|
|
d39c82 |
--- crash-7.0.9/defs.h.orig 2015-04-21 11:45:00.966927052 -0400
|
|
|
d39c82 |
+++ crash-7.0.9/defs.h 2015-04-21 11:46:44.288416377 -0400
|
|
|
d39c82 |
@@ -2873,6 +2873,13 @@ typedef signed int s32;
|
|
|
d39c82 |
#define ARM64_MODULES_VADDR (ARM64_PAGE_OFFSET - MEGABYTES(64))
|
|
|
d39c82 |
#define ARM64_MODULES_END (ARM64_PAGE_OFFSET - 1)
|
|
|
d39c82 |
#define ARM64_VMALLOC_START ((0xffffffffffffffffUL) << machdep->machspec->VA_BITS)
|
|
|
d39c82 |
+/*
|
|
|
d39c82 |
+ * The following 3 definitions are the original values, but are obsolete
|
|
|
d39c82 |
+ * for 3.17 and later kernels because they are now build-time calculations.
|
|
|
d39c82 |
+ * They all depend on the kernel's new VMEMMAP_SIZE value, which is dependent
|
|
|
d39c82 |
+ * upon the size of struct page. Accordingly, arm64_calc_virtual_memory_ranges()
|
|
|
d39c82 |
+ * determines their values at POST_GDB time.
|
|
|
d39c82 |
+ */
|
|
|
d39c82 |
#define ARM64_VMALLOC_END (ARM64_PAGE_OFFSET - 0x400000000UL - KILOBYTES(64) - 1)
|
|
|
d39c82 |
#define ARM64_VMEMMAP_VADDR ((ARM64_VMALLOC_END+1) + KILOBYTES(64))
|
|
|
d39c82 |
#define ARM64_VMEMMAP_END (ARM64_VMEMMAP_VADDR + GIGABYTES(8UL) - 1)
|