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_RO | _PAGE_NA, 25 .val = 0, 26 .set = "rw", 27 }, { 28 .mask = _PAGE_RO | _PAGE_NA, 29 .val = _PAGE_RO, 30 .set = "r ", 31 }, { 32 .mask = _PAGE_RO | _PAGE_NA, 33 .val = _PAGE_NA, 34 .set = " ", 35 }, { 36 .mask = _PAGE_EXEC, 37 .val = _PAGE_EXEC, 38 .set = " X ", 39 .clear = " ", 40 }, { 41 .mask = _PAGE_PRESENT, 42 .val = _PAGE_PRESENT, 43 .set = "present", 44 .clear = " ", 45 }, { 46 .mask = _PAGE_GUARDED, 47 .val = _PAGE_GUARDED, 48 .set = "guarded", 49 .clear = " ", 50 }, { 51 .mask = _PAGE_DIRTY, 52 .val = _PAGE_DIRTY, 53 .set = "dirty", 54 .clear = " ", 55 }, { 56 .mask = _PAGE_ACCESSED, 57 .val = _PAGE_ACCESSED, 58 .set = "accessed", 59 .clear = " ", 60 }, { 61 .mask = _PAGE_NO_CACHE, 62 .val = _PAGE_NO_CACHE, 63 .set = "no cache", 64 .clear = " ", 65 }, { 66 .mask = _PAGE_SPECIAL, 67 .val = _PAGE_SPECIAL, 68 .set = "special", 69 } 70 }; 71 72 struct pgtable_level pg_level[5] = { 73 { /* pgd */ 74 .flag = flag_array, 75 .num = ARRAY_SIZE(flag_array), 76 }, { /* p4d */ 77 .flag = flag_array, 78 .num = ARRAY_SIZE(flag_array), 79 }, { /* pud */ 80 .flag = flag_array, 81 .num = ARRAY_SIZE(flag_array), 82 }, { /* pmd */ 83 .flag = flag_array, 84 .num = ARRAY_SIZE(flag_array), 85 }, { /* pte */ 86 .flag = flag_array, 87 .num = ARRAY_SIZE(flag_array), 88 }, 89 }; 90