From: deraadt Date: Tue, 9 Mar 2021 04:53:40 +0000 (+0000) Subject: ofw_read_mem_regions() can skip calculation of physmem. pmap.c X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a787a73b306a7b9834ab0efed0df7bf42567548f;p=openbsd ofw_read_mem_regions() can skip calculation of physmem. pmap.c already calculates _usable_ memory and updates physmem (if it is 0), whereas ofw_read_mem_regions() was counting usable+unuseable memory. ie. 4G or more on some machines. powerpc's 32-bit pagetable cannot use memory beyond 4G phys addr. (On a 4G machine, physmem64 was calculated as 0, which caused the installer's auto-diskabel code to place /tmp on the b partition). ok gkoehler, works for kurt also --- diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index ef1a31f1362..aed118ce316 100644 --- a/sys/arch/macppc/macppc/ofw_machdep.c +++ b/sys/arch/macppc/macppc/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.62 2020/11/02 18:35:38 tobhe Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.63 2021/03/09 04:53:40 deraadt Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -137,7 +137,6 @@ ofw_read_mem_regions(int phandle, int address_cells, int size_cells) { int nreg, navail; int i, j; - uint physpages; switch (address_cells) { default: @@ -173,11 +172,9 @@ ofw_read_mem_regions(int phandle, int address_cells, int size_cells) } break; case 2: - physpages = 0; for (i = 0, j = 0; i < nreg; i++) { if (OFmem64[i].size == 0) continue; - physpages += atop(OFmem64[i].size); if (OFmem64[i].start >= 1ULL << 32) continue; OFmem[j].start = OFmem64[i].start; @@ -187,7 +184,6 @@ ofw_read_mem_regions(int phandle, int address_cells, int size_cells) OFmem[j].size = OFmem64[i].size; j++; } - physmem = physpages; break; } }