File Index
Files and directories
Sign in
FILE

ptdump.h

File preview with syntax highlighting.

linux-6.19.14/arch/arm64/include/asm/ptdump.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2014 ARM Ltd.
 4 */
 5#ifndef __ASM_PTDUMP_H
 6#define __ASM_PTDUMP_H
 7
 8#include <linux/ptdump.h>
 9
10DECLARE_STATIC_KEY_FALSE(arm64_ptdump_lock_key);
11
12#ifdef CONFIG_PTDUMP
13
14#include <linux/mm_types.h>
15#include <linux/seq_file.h>
16
17struct addr_marker {
18	unsigned long start_address;
19	char *name;
20};
21
22struct ptdump_info {
23	struct mm_struct		*mm;
24	const struct addr_marker	*markers;
25	unsigned long			base_addr;
26};
27
28struct ptdump_prot_bits {
29	ptdesc_t	mask;
30	ptdesc_t	val;
31	const char	*set;
32	const char	*clear;
33};
34
35struct ptdump_pg_level {
36	const struct ptdump_prot_bits *bits;
37	char name[4];
38	int num;
39	ptdesc_t mask;
40};
41
42/*
43 * The page dumper groups page table entries of the same type into a single
44 * description. It uses pg_state to track the range information while
45 * iterating over the pte entries. When the continuity is broken it then
46 * dumps out a description of the range.
47 */
48struct ptdump_pg_state {
49	struct ptdump_state ptdump;
50	struct ptdump_pg_level *pg_level;
51	struct seq_file *seq;
52	const struct addr_marker *marker;
53	const struct mm_struct *mm;
54	unsigned long start_address;
55	int level;
56	ptdesc_t current_prot;
57	bool check_wx;
58	unsigned long wx_pages;
59	unsigned long uxn_pages;
60};
61
62void ptdump_walk(struct seq_file *s, struct ptdump_info *info);
63void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
64	       pteval_t val);
65void note_page_pte(struct ptdump_state *st, unsigned long addr, pte_t pte);
66void note_page_pmd(struct ptdump_state *st, unsigned long addr, pmd_t pmd);
67void note_page_pud(struct ptdump_state *st, unsigned long addr, pud_t pud);
68void note_page_p4d(struct ptdump_state *st, unsigned long addr, p4d_t p4d);
69void note_page_pgd(struct ptdump_state *st, unsigned long addr, pgd_t pgd);
70void note_page_flush(struct ptdump_state *st);
71#ifdef CONFIG_PTDUMP_DEBUGFS
72#define EFI_RUNTIME_MAP_END	DEFAULT_MAP_WINDOW_64
73void __init ptdump_debugfs_register(struct ptdump_info *info, const char *name);
74#else
75static inline void ptdump_debugfs_register(struct ptdump_info *info,
76					   const char *name) { }
77#endif /* CONFIG_PTDUMP_DEBUGFS */
78#else
79static inline void note_page(struct ptdump_state *pt_st, unsigned long addr,
80			     int level, pteval_t val) { }
81static inline void note_page_pte(struct ptdump_state *st, unsigned long addr, pte_t pte) { }
82static inline void note_page_pmd(struct ptdump_state *st, unsigned long addr, pmd_t pmd) { }
83static inline void note_page_pud(struct ptdump_state *st, unsigned long addr, pud_t pud) { }
84static inline void note_page_p4d(struct ptdump_state *st, unsigned long addr, p4d_t p4d) { }
85static inline void note_page_pgd(struct ptdump_state *st, unsigned long addr, pgd_t pgd) { }
86static inline void note_page_flush(struct ptdump_state *st) { }
87#endif /* CONFIG_PTDUMP */
88
89#endif /* __ASM_PTDUMP_H */
~/ Read-only file preview.