summaryrefslogtreecommitdiffstats
path: root/usr.sbin/acpidump
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-07-08 10:28:02 +0000
committerderaadt <deraadt@openbsd.org>2014-07-08 10:28:02 +0000
commitfadb1e41bbfedb3c391bf7f255e23059fda765ae (patch)
treeda53d6c86e36f959b4d824e45c0347a9d2b84dbf /usr.sbin/acpidump
parentno need to send a stat update message when {inc,dec}rementing by 0. (diff)
downloadwireguard-openbsd-fadb1e41bbfedb3c391bf7f255e23059fda765ae.tar.xz
wireguard-openbsd-fadb1e41bbfedb3c391bf7f255e23059fda765ae.zip
Stop using uvm_extern.h to fetch uvm_param.h; so define local versions
of trunc_page and such. Horrid namespace violations, prepare for your coming doom... ok kettenis
Diffstat (limited to 'usr.sbin/acpidump')
-rw-r--r--usr.sbin/acpidump/acpidump.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/acpidump/acpidump.c b/usr.sbin/acpidump/acpidump.c
index d84e4cfcaf9..2043a299908 100644
--- a/usr.sbin/acpidump/acpidump.c
+++ b/usr.sbin/acpidump/acpidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpidump.c,v 1.9 2013/12/03 01:47:06 deraadt Exp $ */
+/* $OpenBSD: acpidump.c,v 1.10 2014/07/08 10:28:02 deraadt Exp $ */
/*
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
@@ -31,8 +31,6 @@
#include <sys/queue.h>
#include <sys/stat.h>
-#include <uvm/uvm_extern.h>
-
#include <assert.h>
#include <err.h>
#include <fcntl.h>
@@ -211,6 +209,7 @@ struct acpi_user_mapping *
acpi_user_find_mapping(vm_offset_t pa, size_t size)
{
struct acpi_user_mapping *map;
+ int page_mask = getpagesize() - 1;
/* First search for an existing mapping */
for (map = LIST_FIRST(&maplist); map; map = LIST_NEXT(map, link)) {
@@ -219,8 +218,14 @@ acpi_user_find_mapping(vm_offset_t pa, size_t size)
}
/* Then create a new one */
+#undef round_page
+#undef trunc_page
+#define round_page(x) (((x) + page_mask) & ~page_mask)
+#define trunc_page(x) ((x) & ~page_mask)
size = round_page(pa + size) - trunc_page(pa);
pa = trunc_page(pa);
+#undef round_page
+#undef trunc_page
map = malloc(sizeof(struct acpi_user_mapping));
if (!map)
errx(1, "out of memory");