summaryrefslogtreecommitdiff
path: root/usr.sbin/acpidump
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-08 10:28:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-08 10:28:03 +0000
commit3b9600d1f343c9534fb721453efaa4c8b6fd0707 (patch)
treed8e9f360b745e7ca4df86ab691c9eeb36211e781 /usr.sbin/acpidump
parentff4dfd48cd5efab31275b317d26233bb1f5663aa (diff)
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");