When 2GB of memory is enabled for QEMU's Malta emulation, the physical
memory ends at an address of 2^32 - 1. This causes an integer overflow
to zero when computing the upper bound of the second phys_avail[] range.
As a result, FreeBSD/mips kernels were only using the first 256MB of
RAM and ignoring the remaining 1.75GB. To work around this, truncate
the extended memory size to 2GB minus one page for 32-bit mips kernels.
Review request is more if there is a cleaner way to detect/handle the
overflow. The rather complicated mapping of physical address to RAM
in Malta is perhaps best explained here:
https://lists.gnu.org/archive/html/qemu-devel/2013-08/msg04382.html