dump.c (afd1efa1d80162cd48bacb3b848136249df28c62) | dump.c (e66372ecb80dc5179c7abb880229c7452e813d15) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Debug helper to dump the current kernel pagetables of the system 4 * so that we can see what the various memory ranges are set to. 5 * 6 * Derived from x86 implementation: 7 * (C) Copyright 2008 Intel Corporation 8 * --- 186 unchanged lines hidden (view full) --- 195 .mask = PMD_SECT_S, 196 .val = PMD_SECT_S, 197 .set = "SHD", 198 .clear = " ", 199 }, 200}; 201 202struct pg_level { | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Debug helper to dump the current kernel pagetables of the system 4 * so that we can see what the various memory ranges are set to. 5 * 6 * Derived from x86 implementation: 7 * (C) Copyright 2008 Intel Corporation 8 * --- 186 unchanged lines hidden (view full) --- 195 .mask = PMD_SECT_S, 196 .val = PMD_SECT_S, 197 .set = "SHD", 198 .clear = " ", 199 }, 200}; 201 202struct pg_level { |
203 const char *name; |
|
203 const struct prot_bits *bits; 204 size_t num; 205 u64 mask; 206 const struct prot_bits *ro_bit; 207 const struct prot_bits *nx_bit; 208}; 209 210static struct pg_level pg_level[] = { 211 { 212 }, { /* pgd */ 213 }, { /* p4d */ 214 }, { /* pud */ 215 }, { /* pmd */ | 204 const struct prot_bits *bits; 205 size_t num; 206 u64 mask; 207 const struct prot_bits *ro_bit; 208 const struct prot_bits *nx_bit; 209}; 210 211static struct pg_level pg_level[] = { 212 { 213 }, { /* pgd */ 214 }, { /* p4d */ 215 }, { /* pud */ 216 }, { /* pmd */ |
217 .name = (CONFIG_PGTABLE_LEVELS > 2) ? "PMD" : "PGD", |
|
216 .bits = section_bits, 217 .num = ARRAY_SIZE(section_bits), 218 }, { /* pte */ | 218 .bits = section_bits, 219 .num = ARRAY_SIZE(section_bits), 220 }, { /* pte */ |
221 .name = "PTE", |
|
219 .bits = pte_bits, 220 .num = ARRAY_SIZE(pte_bits), 221 }, 222}; 223 224static void dump_prot(struct pg_state *st, const struct prot_bits *bits, size_t num) 225{ 226 unsigned i; --- 50 unchanged lines hidden (view full) --- 277 pt_dump_seq_printf(st->seq, "0x%08lx-0x%08lx ", 278 st->start_address, addr); 279 280 delta = (addr - st->start_address) >> 10; 281 while (!(delta & 1023) && unit[1]) { 282 delta >>= 10; 283 unit++; 284 } | 222 .bits = pte_bits, 223 .num = ARRAY_SIZE(pte_bits), 224 }, 225}; 226 227static void dump_prot(struct pg_state *st, const struct prot_bits *bits, size_t num) 228{ 229 unsigned i; --- 50 unchanged lines hidden (view full) --- 280 pt_dump_seq_printf(st->seq, "0x%08lx-0x%08lx ", 281 st->start_address, addr); 282 283 delta = (addr - st->start_address) >> 10; 284 while (!(delta & 1023) && unit[1]) { 285 delta >>= 10; 286 unit++; 287 } |
285 pt_dump_seq_printf(st->seq, "%9lu%c", delta, *unit); | 288 pt_dump_seq_printf(st->seq, "%9lu%c %s", delta, *unit, 289 pg_level[st->level].name); |
286 if (st->current_domain) 287 pt_dump_seq_printf(st->seq, " %s", 288 st->current_domain); 289 if (pg_level[st->level].bits) 290 dump_prot(st, pg_level[st->level].bits, pg_level[st->level].num); 291 pt_dump_seq_printf(st->seq, "\n"); 292 } 293 --- 182 unchanged lines hidden --- | 290 if (st->current_domain) 291 pt_dump_seq_printf(st->seq, " %s", 292 st->current_domain); 293 if (pg_level[st->level].bits) 294 dump_prot(st, pg_level[st->level].bits, pg_level[st->level].num); 295 pt_dump_seq_printf(st->seq, "\n"); 296 } 297 --- 182 unchanged lines hidden --- |