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