From f6c48c1932ee2e9fac92fab351cd390f81d12cfe Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 7 Sep 2006 15:03:02 +0000 Subject: [PATCH] Use a single constant to define the sizes of the physmap[], phys_avail[], and dump_avail[] arrays so they are in sync (previously it was possible to store more entries in the physmap[] then we could store in phys_avail[], which was pointless). While I'm here, bump up the length of these tables to hold 30 entries on amd64 and 16 on i386. This allows machines with fairly fragmented memory maps to boot ok (at least one machine would not boot FreeBSD/i386 but would boot FreeBSD/amd64 because amd64 allowed for more fragments). MFC after: 3 days --- sys/amd64/amd64/machdep.c | 8 ++++---- sys/i386/i386/machdep.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index ff2367884107..544b9fb4b550 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -160,8 +160,10 @@ int cold = 1; long Maxmem = 0; long realmem = 0; -vm_paddr_t phys_avail[20]; -vm_paddr_t dump_avail[20]; +#define PHYSMAP_SIZE (2 * 30) + +vm_paddr_t phys_avail[PHYSMAP_SIZE + 2]; +vm_paddr_t dump_avail[PHYSMAP_SIZE + 2]; /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(phys_avail[0])) - 2) @@ -832,8 +834,6 @@ isa_irq_pending(void) } #endif -#define PHYSMAP_SIZE (2 * 20) - u_int basemem; /* diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 8f2c54f8fc8e..32b6d788af01 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -188,8 +188,10 @@ static void freebsd4_sendsig(sig_t catcher, ksiginfo_t *, sigset_t *mask); long Maxmem = 0; long realmem = 0; -vm_paddr_t phys_avail[10]; -vm_paddr_t dump_avail[10]; +#define PHYSMAP_SIZE (2 * 16) + +vm_paddr_t phys_avail[PHYSMAP_SIZE + 2]; +vm_paddr_t dump_avail[PHYSMAP_SIZE + 2]; /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(phys_avail[0])) - 2) @@ -1614,8 +1616,6 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } -#define PHYSMAP_SIZE (2 * 8) - /* * Populate the (physmap) array with base/bound pairs describing the * available physical memory in the system, then test this memory and