^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * From split of dump_linuxpagetables.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2016, Rashmica Gupta, IBM Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "ptdump.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) static const struct flag_info flag_array[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) .mask = _PAGE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) .val = _PAGE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) .set = "user",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .mask = _PAGE_RW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) .val = _PAGE_RW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .set = "rw",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .clear = "r ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .mask = _PAGE_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) .val = _PAGE_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) .set = " X ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .mask = _PAGE_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .val = _PAGE_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .set = "present",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .mask = _PAGE_COHERENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .val = _PAGE_COHERENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .set = "coherent",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .mask = _PAGE_GUARDED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .val = _PAGE_GUARDED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .set = "guarded",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .mask = _PAGE_DIRTY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .val = _PAGE_DIRTY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .set = "dirty",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .mask = _PAGE_ACCESSED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .val = _PAGE_ACCESSED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .set = "accessed",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .mask = _PAGE_WRITETHRU,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .val = _PAGE_WRITETHRU,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .set = "write through",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .mask = _PAGE_NO_CACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .val = _PAGE_NO_CACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .set = "no cache",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .clear = " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .mask = _PAGE_SPECIAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) .val = _PAGE_SPECIAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) .set = "special",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct pgtable_level pg_level[5] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }, { /* pgd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .flag = flag_array,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .num = ARRAY_SIZE(flag_array),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }, { /* pud */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .flag = flag_array,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) .num = ARRAY_SIZE(flag_array),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }, { /* pmd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .flag = flag_array,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .num = ARRAY_SIZE(flag_array),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }, { /* pte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .flag = flag_array,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .num = ARRAY_SIZE(flag_array),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) };