When converting the bios memory map to memory clusters, clip segments at
authorjmatthew <jmatthew@openbsd.org>
Mon, 30 Jul 2018 09:04:52 +0000 (09:04 +0000)
committerjmatthew <jmatthew@openbsd.org>
Mon, 30 Jul 2018 09:04:52 +0000 (09:04 +0000)
the 512GB mark as the direct map cannot address memory past that point.

ok kettenis@ (quite a while ago)

sys/arch/amd64/amd64/machdep.c

index 05c91e3..29f4448 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: machdep.c,v 1.249 2018/07/27 21:11:31 kettenis Exp $  */
+/*     $OpenBSD: machdep.c,v 1.250 2018/07/30 09:04:52 jmatthew Exp $  */
 /*     $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
 
 /*-
@@ -1485,6 +1485,16 @@ init_x86_64(paddr_t first_avail)
                                continue;
                }
 
+               /*
+                * The direct map is limited to 512GB of memory, so
+                * discard anything above that.
+                */
+               if (e1 >= (uint64_t)512*1024*1024*1024) {
+                       e1 = (uint64_t)512*1024*1024*1024;
+                       if (s1 > e1)
+                               continue;
+               }
+
                /* Crop stuff into "640K hole" */
                if (s1 < IOM_BEGIN && e1 > IOM_BEGIN)
                        e1 = IOM_BEGIN;