summaryrefslogtreecommitdiff
path: root/usr.sbin/acpidump
diff options
context:
space:
mode:
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");