Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 - fix an off-by-one that disallowed adjacen...
details: https://anonhg.NetBSD.org/src/rev/b3a38db389e5
branches: trunk
changeset: 761006:b3a38db389e5
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 18 17:44:15 2011 +0000
description:
- fix an off-by-one that disallowed adjacent mappings with conflicting
types from being created
- only allow MTRR_TYPE_WC mappings if the processor supports it
diffstat:
sys/arch/x86/x86/mtrr_i686.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diffs (51 lines):
diff -r bdaa2b48656f -r b3a38db389e5 sys/arch/x86/x86/mtrr_i686.c
--- a/sys/arch/x86/x86/mtrr_i686.c Tue Jan 18 17:34:28 2011 +0000
+++ b/sys/arch/x86/x86/mtrr_i686.c Tue Jan 18 17:44:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mtrr_i686.c,v 1.23 2011/01/12 23:52:38 jmcneill Exp $ */
+/* $NetBSD: mtrr_i686.c,v 1.24 2011/01/18 17:44:15 jmcneill Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.23 2011/01/12 23:52:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.24 2011/01/18 17:44:15 jmcneill Exp $");
#include "opt_multiprocessor.h"
@@ -481,6 +481,14 @@
|| mtrrp->type > MTRR_TYPE_WB) && (mtrrp->flags & MTRR_VALID))
return EINVAL;
+ /*
+ * If write-combining is requested, make sure that the WC feature
+ * is supported by the processor.
+ */
+ if (mtrrp->type == MTRR_TYPE_WC &&
+ !(i686_mtrr_cap & MTRR_I686_CAP_WC_MASK))
+ return ENODEV;
+
/*
* Only use fixed ranges < 1M.
*/
@@ -604,7 +612,7 @@
* XXX could be more sophisticated here by merging ranges.
*/
low = mtrrp->base;
- high = low + mtrrp->len;
+ high = low + mtrrp->len - 1;
freep = NULL;
for (i = 0; i < i686_mtrr_vcnt; i++) {
if (!(mtrr_var[i].flags & MTRR_VALID)) {
@@ -612,7 +620,7 @@
continue;
}
curlow = mtrr_var[i].base;
- curhigh = curlow + mtrr_var[i].len;
+ curhigh = curlow + mtrr_var[i].len - 1;
if (low == curlow && high == curhigh &&
(!(mtrr_var[i].flags & MTRR_PRIVATE) ||
((mtrrp->flags & MTRR_PRIVATE) && (p != NULL) &&
Home |
Main Index |
Thread Index |
Old Index