mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-04 17:15:50 +00:00
Use 64-bit math when processing the lists of physical and excluded memory
to generate the phys_avail and dump_avail arrays. This is a partial fix for the kernel side of the problem mentioned in the PR. This part handles the cases where comparing start and end addresses of a block would fail because 32-bit wrap caused the end address to come out zero if the end of the region is the end of the address space (0xffffffff with 32-bit vm_paddr_t, but now the code should also work right if we ever support LPAE with 36-bit addresses). More work is necessary to make systems with ram at the end of the physical address space usable, but at least initially it's going to be more like a workaround than a fix, so this non-hacky part is being committed first. PR: 201614
This commit is contained in:
parent
a195a8e177
commit
e376ad23c2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=293061
@ -161,7 +161,7 @@ static size_t
|
||||
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
|
||||
{
|
||||
size_t acnt, exi, hwi;
|
||||
vm_paddr_t end, start, xend, xstart;
|
||||
uint64_t end, start, xend, xstart;
|
||||
long availmem;
|
||||
const struct region *exp, *hwp;
|
||||
|
||||
@ -171,7 +171,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
|
||||
for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
|
||||
start = hwp->addr;
|
||||
end = hwp->size + start;
|
||||
realmem += arm32_btop(end - start);
|
||||
realmem += arm32_btop((vm_offset_t)(end - start));
|
||||
for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
|
||||
/*
|
||||
* If the excluded region does not match given flags,
|
||||
@ -212,9 +212,10 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
|
||||
* could affect the remainder of this hw region.
|
||||
*/
|
||||
if ((xstart > start) && (xend < end)) {
|
||||
avail[acnt++] = start;
|
||||
avail[acnt++] = xstart;
|
||||
availmem += arm32_btop(xstart - start);
|
||||
avail[acnt++] = (vm_paddr_t)start;
|
||||
avail[acnt++] = (vm_paddr_t)xstart;
|
||||
availmem +=
|
||||
arm32_btop((vm_offset_t)(xstart - start));
|
||||
start = xend;
|
||||
continue;
|
||||
}
|
||||
@ -233,9 +234,9 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
|
||||
* available entry for it.
|
||||
*/
|
||||
if (end > start) {
|
||||
avail[acnt++] = start;
|
||||
avail[acnt++] = end;
|
||||
availmem += arm32_btop(end - start);
|
||||
avail[acnt++] = (vm_paddr_t)start;
|
||||
avail[acnt++] = (vm_paddr_t)end;
|
||||
availmem += arm32_btop((vm_offset_t)(end - start));
|
||||
}
|
||||
if (acnt >= MAX_AVAIL_ENTRIES)
|
||||
panic("Not enough space in the dump/phys_avail arrays");
|
||||
|
Loading…
x
Reference in New Issue
Block a user