From ad0aa884535e536ffd6c51bd8ceec59224ff8b21 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 17 Sep 2021 15:19:52 +0000 Subject: [PATCH] sys/param.h was only used for PAGE_MASK. use getpagesize() at initialization instead. --- lib/libarch/alpha/bwx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/libarch/alpha/bwx.c b/lib/libarch/alpha/bwx.c index 4ef9a9c2b47..1d0dc856aa9 100644 --- a/lib/libarch/alpha/bwx.c +++ b/lib/libarch/alpha/bwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwx.c,v 1.9 2018/04/26 15:55:14 guenther Exp $ */ +/* $OpenBSD: bwx.c,v 1.10 2021/09/17 15:19:52 deraadt Exp $ */ /*- * Copyright (c) 1998 Doug Rabson * All rights reserved. @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include +#include #include #include #include @@ -39,8 +39,9 @@ #include "io.h" -#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) -#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + page_mask) & ~page_mask) +#define trunc_page(x) ((x) & ~page_mask) +static long page_mask; #define PATH_APERTURE "/dev/xf86" @@ -85,6 +86,8 @@ bwx_init(void) int error; int mib[3]; + page_mask = getpagesize() - 1; + mib[0] = CTL_MACHDEP; mib[1] = CPU_CHIPSET; mib[2] = CPU_CHIPSET_PORTS; -- 2.20.1