summaryrefslogtreecommitdiff
path: root/usr.sbin/memconfig
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-09-20 08:28:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-09-20 08:28:52 +0000
commitaf9b876bf99e9a5f23c55670ef0788f8c44df303 (patch)
treead01ab331d1973838e0d25426102c821cec2d40f /usr.sbin/memconfig
parent81396e8116759976710efcf5b1cd215909b66b60 (diff)
report the "fix-active" flag, and print any other unknown flags in hex.
ok oga kettenis
Diffstat (limited to 'usr.sbin/memconfig')
-rw-r--r--usr.sbin/memconfig/memconfig.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/memconfig/memconfig.c b/usr.sbin/memconfig/memconfig.c
index 978ac038862..66cc9ffa53a 100644
--- a/usr.sbin/memconfig/memconfig.c
+++ b/usr.sbin/memconfig/memconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memconfig.c,v 1.14 2011/06/06 14:59:16 tedu Exp $ */
+/* $OpenBSD: memconfig.c,v 1.15 2011/09/20 08:28:51 deraadt Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
@@ -56,6 +56,7 @@ struct {
{"fixed-length", MDF_FIXLEN, 0},
{"set-by-firmware", MDF_FIRMWARE, 0},
{"active", MDF_ACTIVE, MDF_SETTABLE},
+ {"fix-active", MDF_FIXACTIVE, 0},
{"bogus", MDF_BOGUS, 0},
{NULL, 0, 0}
};
@@ -152,7 +153,7 @@ mrgetall(int memfd, int *nmr)
static void
listfunc(int memfd, int argc, char *argv[])
{
- int nd, i, j, ch, showall = 0;
+ int nd, i, j, k, ch, showall = 0;
struct mem_range_desc *mrd;
char *owner;
@@ -179,9 +180,17 @@ listfunc(int memfd, int argc, char *argv[])
continue;
printf("%qx/%qx %.8s ", mrd[i].mr_base, mrd[i].mr_len,
mrd[i].mr_owner[0] ? mrd[i].mr_owner : "-");
- for (j = 0; attrnames[j].name != NULL; j++)
- if (mrd[i].mr_flags & attrnames[j].val)
- printf("%s ", attrnames[j].name);
+ for (j = 0; j < 32; j++) {
+ if ( ((1<<j) & mrd[i].mr_flags) == 0)
+ continue;
+ for (k = 0; attrnames[k].name != NULL; k++)
+ if (((1<<j) & mrd[i].mr_flags) & attrnames[k].val) {
+ printf("%s ", attrnames[k].name);
+ break;
+ }
+ if (attrnames[k].name == NULL)
+ printf("0x%x", (1<<j) & mrd[i].mr_flags);
+ }
printf("\n");
}
free(mrd);