Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 Fix 4GB wraparound math.



details:   https://anonhg.NetBSD.org/src/rev/24576ede17f0
branches:  trunk
changeset: 337931:24576ede17f0
user:      matt <matt%NetBSD.org@localhost>
date:      Mon May 04 00:41:42 2015 +0000

description:
Fix 4GB wraparound math.

diffstat:

 sys/arch/arm/arm32/arm32_boot.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r d4f64f30d69f -r 24576ede17f0 sys/arch/arm/arm32/arm32_boot.c
--- a/sys/arch/arm/arm32/arm32_boot.c   Mon May 04 00:12:56 2015 +0000
+++ b/sys/arch/arm/arm32/arm32_boot.c   Mon May 04 00:41:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm32_boot.c,v 1.13 2015/05/04 00:12:56 matt Exp $     */
+/*     $NetBSD: arm32_boot.c,v 1.14 2015/05/04 00:41:42 matt Exp $     */
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -123,7 +123,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.13 2015/05/04 00:12:56 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.14 2015/05/04 00:41:42 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -268,11 +268,12 @@
                                        break;
                                }
                        }
-#ifndef         HAVE_ARM_LPAE
+#ifndef ARM_HAS_LPAE
                        // If memory ends at 4GB (and wraps to 0), ignore
                        // the last page.
-                       if (__predict_false(segend == 0 && start > 0)) {
-                               segend = -PAGE_SIZE;
+                       const paddr_t fourgig = 1 << (32 - PGSHIFT);
+                       if (__predict_false(segend >= fourgig && start > 0)) {
+                               segend = fourgig - 1;
                        }
 #endif
        



Home | Main Index | Thread Index | Old Index