38
38
seq_printf(m, fmt); \
39
39
})
40
40
41
- /*
42
- * The page dumper groups page table entries of the same type into a single
43
- * description. It uses pg_state to track the range information while
44
- * iterating over the pte entries. When the continuity is broken it then
45
- * dumps out a description of the range.
46
- */
47
- struct pg_state {
48
- struct ptdump_state ptdump ;
49
- struct seq_file * seq ;
50
- const struct addr_marker * marker ;
51
- const struct mm_struct * mm ;
52
- unsigned long start_address ;
53
- int level ;
54
- u64 current_prot ;
55
- bool check_wx ;
56
- unsigned long wx_pages ;
57
- unsigned long uxn_pages ;
58
- };
59
-
60
- struct prot_bits {
61
- u64 mask ;
62
- u64 val ;
63
- const char * set ;
64
- const char * clear ;
65
- };
66
-
67
- static const struct prot_bits pte_bits [] = {
41
+ static const struct ptdump_prot_bits pte_bits [] = {
68
42
{
69
43
.mask = PTE_VALID ,
70
44
.val = PTE_VALID ,
@@ -143,14 +117,7 @@ static const struct prot_bits pte_bits[] = {
143
117
}
144
118
};
145
119
146
- struct pg_level {
147
- const struct prot_bits * bits ;
148
- char name [4 ];
149
- int num ;
150
- u64 mask ;
151
- };
152
-
153
- static struct pg_level pg_level [] __ro_after_init = {
120
+ static struct ptdump_pg_level pg_level [] __ro_after_init = {
154
121
{ /* pgd */
155
122
.name = "PGD" ,
156
123
.bits = pte_bits ,
@@ -174,7 +141,7 @@ static struct pg_level pg_level[] __ro_after_init = {
174
141
},
175
142
};
176
143
177
- static void dump_prot (struct pg_state * st , const struct prot_bits * bits ,
144
+ static void dump_prot (struct ptdump_pg_state * st , const struct ptdump_prot_bits * bits ,
178
145
size_t num )
179
146
{
180
147
unsigned i ;
@@ -192,7 +159,7 @@ static void dump_prot(struct pg_state *st, const struct prot_bits *bits,
192
159
}
193
160
}
194
161
195
- static void note_prot_uxn (struct pg_state * st , unsigned long addr )
162
+ static void note_prot_uxn (struct ptdump_pg_state * st , unsigned long addr )
196
163
{
197
164
if (!st -> check_wx )
198
165
return ;
@@ -206,7 +173,7 @@ static void note_prot_uxn(struct pg_state *st, unsigned long addr)
206
173
st -> uxn_pages += (addr - st -> start_address ) / PAGE_SIZE ;
207
174
}
208
175
209
- static void note_prot_wx (struct pg_state * st , unsigned long addr )
176
+ static void note_prot_wx (struct ptdump_pg_state * st , unsigned long addr )
210
177
{
211
178
if (!st -> check_wx )
212
179
return ;
@@ -221,10 +188,10 @@ static void note_prot_wx(struct pg_state *st, unsigned long addr)
221
188
st -> wx_pages += (addr - st -> start_address ) / PAGE_SIZE ;
222
189
}
223
190
224
- static void note_page (struct ptdump_state * pt_st , unsigned long addr , int level ,
225
- u64 val )
191
+ void note_page (struct ptdump_state * pt_st , unsigned long addr , int level ,
192
+ u64 val )
226
193
{
227
- struct pg_state * st = container_of (pt_st , struct pg_state , ptdump );
194
+ struct ptdump_pg_state * st = container_of (pt_st , struct ptdump_pg_state , ptdump );
228
195
static const char units [] = "KMGTPE" ;
229
196
u64 prot = 0 ;
230
197
@@ -286,12 +253,12 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
286
253
void ptdump_walk (struct seq_file * s , struct ptdump_info * info )
287
254
{
288
255
unsigned long end = ~0UL ;
289
- struct pg_state st ;
256
+ struct ptdump_pg_state st ;
290
257
291
258
if (info -> base_addr < TASK_SIZE_64 )
292
259
end = TASK_SIZE_64 ;
293
260
294
- st = (struct pg_state ){
261
+ st = (struct ptdump_pg_state ){
295
262
.seq = s ,
296
263
.marker = info -> markers ,
297
264
.mm = info -> mm ,
@@ -324,7 +291,7 @@ static struct ptdump_info kernel_ptdump_info __ro_after_init = {
324
291
325
292
bool ptdump_check_wx (void )
326
293
{
327
- struct pg_state st = {
294
+ struct ptdump_pg_state st = {
328
295
.seq = NULL ,
329
296
.marker = (struct addr_marker []) {
330
297
{ 0 , NULL },
0 commit comments