summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2019-04-23 03:14:44 +0000
committerguenther <guenther@openbsd.org>2019-04-23 03:14:44 +0000
commit9d9b0696dcc7d47d72868431f1c83dbe66934332 (patch)
treee2024da503e3386701f5561f8c1d218199bed369
parentAdd a header to explain fields (diff)
downloadwireguard-openbsd-9d9b0696dcc7d47d72868431f1c83dbe66934332.tar.xz
wireguard-openbsd-9d9b0696dcc7d47d72868431f1c83dbe66934332.zip
Simplify presentation of attributes to eliminate duplication
-rw-r--r--regress/sys/arch/amd64/dump_tables/dump_tables.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/regress/sys/arch/amd64/dump_tables/dump_tables.c b/regress/sys/arch/amd64/dump_tables/dump_tables.c
index c91e1d5c79d..49e250e6409 100644
--- a/regress/sys/arch/amd64/dump_tables/dump_tables.c
+++ b/regress/sys/arch/amd64/dump_tables/dump_tables.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump_tables.c,v 1.3 2019/04/23 03:06:07 guenther Exp $ */
+/* $OpenBSD: dump_tables.c,v 1.4 2019/04/23 03:14:44 guenther Exp $ */
/*
* Copyright (c) 2019 Philip Guenther <guenther@openbsd.org>
*
@@ -119,12 +119,13 @@ check_mbz(pd_entry_t e, pd_entry_t mbz)
}
void
-pflags(pd_entry_t e, const char *pad)
+pflags(pd_entry_t e, pd_entry_t inherited)
{
if (reproducible)
e &= ~(PG_M|PG_U);
- printf("[%c%c%c%c""%c%c%c%c]%s",
- e & PG_NX ? 'x' : '-',
+ inherited &= e;
+ printf("[%c%c%c%c""%c%c%c%c][%c%c%c]",
+ e & PG_NX ? 'X' : '-', /* reversed */
e & PG_G ? 'G' : '-',
e & PG_M ? 'M' : '-',
e & PG_U ? 'U' : '-',
@@ -132,7 +133,9 @@ pflags(pd_entry_t e, const char *pad)
e & PG_WT ? 'w' : '-',
e & PG_u ? 'u' : '-',
e & PG_RW ? 'W' : '-',
- pad);
+ inherited & PG_NX ? 'X' : '-', /* reversed */
+ inherited & PG_u ? 'u' : '-',
+ inherited & PG_RW ? 'W' : '-');
}
const char * const prefix[] = {
@@ -173,8 +176,7 @@ pent(int level, int idx, vaddr_t va, pd_entry_t e, pd_entry_t inherited,
printf("%016lx %s% 4d -> ", va, prefix[level], idx);
printf("%016llx %c ", pa, type);
- pflags(e, " ");
- pflags(e & (inherited | ~(PG_NX|PG_u|PG_RW)), "");
+ pflags(e, inherited);
if (name != NULL)
printf(" %s\n", name);
else
@@ -277,7 +279,7 @@ main(int argc, char **argv)
check_mbz(cr3, mbz_normal[5]);
}
printf("\
-VA lvl idx PA attr cumulative L4-slot\
+VA lvl idx PA entry-attr eff L4-slot\
\n");
for (i = 0; i < PAGE_SIZE / sizeof(pd_entry_t); i++) {
const char *name = NULL;