Dmitry Antipov wrote:
Dave Anderson wrote:
> To maintain backwards-compatibility, how about re-posting
> with the upper part of the ppc.c patch doing something like:
>
> if (symbol_exists("cur_cpu_spec")) {
> get_symbol_ptr("cur_cpu_spec", &cur_cpu_spec);
> readmem_uint(cur_cpu_spec + MEMBER_OFFSET("cpu_spec",
> "cpu_user_features"), KVADDR, &cpu_features,
> "cpu user features", FAULT_ON_ERROR);
> if (cpu_features & CPU_BOOKE)
> machdep->flags |= CPU_BOOKE;
> } else
> machdep->flags |= CPU_BOOKE;
>
> And it will need to be compilable without applying the
> MontaVista changes, i.e., change the cur_cpu_spec and cpu_features
> declarations, readmem_uint() to readmem(), get_symbol_ptr() to
> get_symbol_data(), etc...
OK
Dmitry
Queued for the next release...
Thanks,
Dave
------------------------------------------------------------------------------------------------------------------------
diff -ur .orig-crash-4.0-3.20/defs.h crash-4.0-3.20/defs.h
--- .orig-crash-4.0-3.20/defs.h 2007-02-21 23:52:01.000000000 +0300
+++ crash-4.0-3.20/defs.h 2007-03-15 14:30:14.000000000 +0300
@@ -3747,6 +3747,8 @@
#define display_idt_table() \
error(FATAL, "-d option is not applicable to PowerPC architecture\n")
#define KSYMS_START (0x1)
+/* This should match PPC_FEATURE_BOOKE from include/asm-powerpc/cputable.h */
+#define CPU_BOOKE (0x00008000)
#endif
/*
diff -ur .orig-crash-4.0-3.20/ppc.c crash-4.0-3.20/ppc.c
--- .orig-crash-4.0-3.20/ppc.c 2007-02-21 23:52:01.000000000 +0300
+++ crash-4.0-3.20/ppc.c 2007-03-15 14:37:59.000000000 +0300
@@ -51,6 +51,9 @@
void
ppc_init(int when)
{
+ uint cpu_features;
+ ulong cur_cpu_spec;
+
switch (when)
{
case PRE_SYMTAB:
@@ -140,6 +143,16 @@
if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
machdep->hz = 1000;
}
+ if (symbol_exists("cur_cpu_spec")) {
+ get_symbol_data("cur_cpu_spec", sizeof(void *),
&cur_cpu_spec);
+ readmem(cur_cpu_spec + MEMBER_OFFSET("cpu_spec",
"cpu_user_features"),
+ KVADDR, &cpu_features, sizeof(uint), "cpu user
features",
+ FAULT_ON_ERROR);
+ if (cpu_features & CPU_BOOKE)
+ machdep->flags |= CPU_BOOKE;
+ }
+ else
+ machdep->flags |= CPU_BOOKE;
machdep->section_size_bits = _SECTION_SIZE_BITS;
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
break;
@@ -285,7 +298,11 @@
page_middle = (ulong *)pgd_pte;
- page_table = page_middle + (BTOP(vaddr) & (PTRS_PER_PTE - 1));
+ if (machdep->flags & CPU_BOOKE)
+ page_table = page_middle + (BTOP(vaddr) & (PTRS_PER_PTE - 1));
+ else
+ page_table = ((page_middle & machdep->pagemask) +
machdep->kvbase) +
+ (BTOP(vaddr) & (PTRS_PER_PTE-1));
if (verbose)
fprintf(fp, " PMD: %lx => %lx\n",(ulong)page_middle,
@@ -369,7 +386,11 @@
page_middle = (ulong *)pgd_pte;
- page_table = page_middle + (BTOP(kvaddr) & (PTRS_PER_PTE-1));
+ if (machdep->flags & CPU_BOOKE)
+ page_table = page_middle + (BTOP(kvaddr) & (PTRS_PER_PTE - 1));
+ else
+ page_table = ((page_middle & machdep->pagemask) +
machdep->kvbase) +
+ (BTOP(kvaddr) & (PTRS_PER_PTE-1));
if (verbose)
fprintf(fp, " PMD: %lx => %lx\n", (ulong)page_middle,
------------------------------------------------------------------------------------------------------------------------
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility