Hi Austin,
LGTM, so ack.
Thanks,
Tao Liu
On Fri, Aug 29, 2025 at 2:18 PM Austin Kim <austindh.kim(a)gmail.com> wrote:
>
> Currently, 'vtop' command does not include 'PAGE DIRECTORY'
information for
> RISC-V-based vmcores. Since 'PAGE DIRECTORY' is used as the root page
table,
> we need this information. Note that Arm64, Arm32 and x86 vmcore shows
> 'PAGE DIRECTORY' for 'vtop' command.
>
> (before)
> crash> vtop 0xffffffff80d8e1e0
> VIRTUAL PHYSICAL
> ffffffff80d8e1e0 40f8e1e0
>
> PGD: ffffffff81c4fff0 => 4fffe801
> PMD: 000000013fffa000 => 00000000103800eb
> PTE: 40e00000 => b35030414c583
> PAGE: 002cd40c10531000
>
> PTE PHYSICAL FLAGS
> b35030414c583 2cd40c10531000 (PRESENT|READ|DIRTY|SOFT)
>
> (after)
> crash> vtop 0xffffffff80d8e1e0
> VIRTUAL PHYSICAL
> ffffffff80d8e1e0 40f8e1e0
>
> PAGE DIRECTORY: ffffffff81c4f000
> PGD: ffffffff81c4fff0 => 4fffe801
> PMD: 000000013fffa000 => 00000000103800eb
> PTE: 40e00000 => b35030414c583
> PAGE: 002cd40c10531000
>
> PTE PHYSICAL FLAGS
> b35030414c583 2cd40c10531000 (PRESENT|READ|DIRTY|SOFT)
>
> Signed-off-by: Austin Kim <austindh.kim(a)gmail.com>
> ---
> riscv64.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/riscv64.c b/riscv64.c
> index 073ebb9..ef5c41d 100644
> --- a/riscv64.c
> +++ b/riscv64.c
> @@ -634,6 +634,9 @@ riscv64_vtop_3level_4k(ulong *pgd, ulong vaddr, physaddr_t
*paddr, int verbose)
> ulong pte_val, pte_pfn;
> ulong pt_phys;
>
> + if (verbose)
> + fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
> +
> /* PGD */
> pgd_ptr = pgd + pgd_index_l3_4k(vaddr);
> FILL_PGD(pgd, KVADDR, PAGESIZE());
> @@ -1213,6 +1216,9 @@ riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t
*paddr, int verbose)
> ulong pte_val, pte_pfn;
> ulong pt_phys;
>
> + if (verbose)
> + fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
> +
> /* PGD */
> pgd_ptr = pgd + pgd_index_l4_4k(vaddr);
> FILL_PGD(pgd, KVADDR, PAGESIZE());
> @@ -1289,6 +1295,9 @@ riscv64_vtop_5level_4k(ulong *pgd, ulong vaddr, physaddr_t
*paddr, int verbose)
> ulong pte_val, pte_pfn;
> ulong pt_phys;
>
> + if (verbose)
> + fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
> +
> /* PGD */
> pgd_ptr = pgd + pgd_index_l5_4k(vaddr);
> FILL_PGD(pgd, KVADDR, PAGESIZE());
> --
> 2.34.1
> --
> Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
> To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines:
https://github.com/crash-utility/crash/wiki