[Crash-utility] [PATCH v3 06/10] LoongArch64: Add 'help -m/M' command support

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

 



Add loongarch64_dump_machdep_table() implementation,
display machdep_table.

E.g. With this patch:
crash> help -m
              flags: 1 (KSYMS_START)
             kvbase: 8000000000000000
  identity_map_base: 8000000000000000
           pagesize: 16384
          pageshift: 14
           pagemask: ffffffffffffc000
         pageoffset: 3fff
        pgdir_shift: 36
       ptrs_per_pgd: 2048
       ptrs_per_pte: 2048
          stacksize: 16384
                 hz: 250
            memsize: 68689920000 (0xffe3d0000)
               bits: 64
         back_trace: loongarch64_back_trace_cmd()
    processor_speed: loongarch64_processor_speed()
...

Co-developed-by: Youling Tang <tangyouling@xxxxxxxxxxx>
Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxxx>
Signed-off-by: Ming Wang <wangming01@xxxxxxxxxxx>
---
 loongarch64.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/loongarch64.c b/loongarch64.c
index fd05695..2624c9b 100644
--- a/loongarch64.c
+++ b/loongarch64.c
@@ -1118,9 +1118,64 @@ loongarch64_is_task_addr(ulong task)
 	return (IS_KVADDR(task) && ALIGNED_STACK_OFFSET(task) == 0);
 }
 
+/*
+ * 'help -m/M' command output
+ */
 void
 loongarch64_dump_machdep_table(ulong arg)
 {
+	int others = 0;
+
+	fprintf(fp, "              flags: %lx (", machdep->flags);
+	if (machdep->flags & KSYMS_START)
+		fprintf(fp, "%sKSYMS_START", others++ ? "|" : "");
+	fprintf(fp, ")\n");
+
+	fprintf(fp, "             kvbase: %lx\n", machdep->kvbase);
+	fprintf(fp, "  identity_map_base: %lx\n", machdep->identity_map_base);
+	fprintf(fp, "           pagesize: %d\n", machdep->pagesize);
+	fprintf(fp, "          pageshift: %d\n", machdep->pageshift);
+	fprintf(fp, "           pagemask: %llx\n", machdep->pagemask);
+	fprintf(fp, "         pageoffset: %lx\n", machdep->pageoffset);
+	fprintf(fp, "        pgdir_shift: %d\n", PGDIR_SHIFT);
+	fprintf(fp, "       ptrs_per_pgd: %lu\n", PTRS_PER_PGD);
+	fprintf(fp, "       ptrs_per_pte: %ld\n", PTRS_PER_PTE);
+	fprintf(fp, "          stacksize: %ld\n", machdep->stacksize);
+	fprintf(fp, "                 hz: %d\n", machdep->hz);
+	fprintf(fp, "            memsize: %ld (0x%lx)\n",
+		machdep->memsize, machdep->memsize);
+	fprintf(fp, "               bits: %d\n", machdep->bits);
+	fprintf(fp, "         back_trace: loongarch64_back_trace_cmd()\n");
+	fprintf(fp, "    processor_speed: loongarch64_processor_speed()\n");
+	fprintf(fp, "              uvtop: loongarch64_uvtop()\n");
+	fprintf(fp, "              kvtop: loongarch64_kvtop()\n");
+	fprintf(fp, "    get_stack_frame: loongarch64_get_stack_frame()\n");
+	fprintf(fp, "      get_stackbase: generic_get_stackbase()\n");
+	fprintf(fp, "       get_stacktop: generic_get_stacktop()\n");
+	fprintf(fp, "      translate_pte: loongarch64_translate_pte()\n");
+	fprintf(fp, "        memory_size: generic_memory_size()\n");
+	fprintf(fp, "      vmalloc_start: loongarch64_vmalloc_start()\n");
+	fprintf(fp, "       is_task_addr: loongarch64_is_task_addr()\n");
+	fprintf(fp, "      verify_symbol: loongarch64_verify_symbol()\n");
+	fprintf(fp, "         dis_filter: generic_dis_filter()\n");
+	fprintf(fp, "           cmd_mach: loongarch64_cmd_mach()\n");
+	fprintf(fp, "       get_smp_cpus: loongarch64_get_smp_cpus()\n");
+	fprintf(fp, "          is_kvaddr: generic_is_kvaddr()\n");
+	fprintf(fp, "          is_uvaddr: generic_is_uvaddr()\n");
+	fprintf(fp, "       verify_paddr: generic_verify_paddr()\n");
+	fprintf(fp, "    init_kernel_pgd: NULL\n");
+	fprintf(fp, "    value_to_symbol: generic_machdep_value_to_symbol()\n");
+	fprintf(fp, "  line_number_hooks: NULL\n");
+	fprintf(fp, "      last_pgd_read: %lx\n", machdep->last_pgd_read);
+	fprintf(fp, "      last_pmd_read: %lx\n", machdep->last_pmd_read);
+	fprintf(fp, "     last_ptbl_read: %lx\n", machdep->last_ptbl_read);
+	fprintf(fp, "                pgd: %lx\n", (ulong)machdep->pgd);
+	fprintf(fp, "                pmd: %lx\n", (ulong)machdep->pmd);
+	fprintf(fp, "               ptbl: %lx\n", (ulong)machdep->ptbl);
+	fprintf(fp, "  section_size_bits: %ld\n", machdep->section_size_bits);
+	fprintf(fp, "   max_physmem_bits: %ld\n", machdep->max_physmem_bits);
+	fprintf(fp, "  sections_per_root: %ld\n", machdep->sections_per_root);
+	fprintf(fp, "           machspec: %lx\n", (ulong)machdep->machspec);
 }
 
 static void
-- 
2.39.2
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




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

 

Powered by Linux