Fixed an arithmetic bug causing reserved memory regions at address 0x00 to be ignored

This commit is contained in:
2022-12-29 20:53:24 +00:00
parent 677661b115
commit d9daeae384

View File

@@ -192,7 +192,12 @@ void __next_memory_region(memblock_iter_t *it, memblock_type_t *type_a, memblock
* if we have gone past the last reserved region, these variables delimit the range between the end
* of the last reserved region and the end of memory. */
uintptr_t r_start = idx_b > 0 ? r[-1].limit + 1 : 0;
uintptr_t r_end = idx_b < type_b->count ? r->base - 1 : ADDR_MAX;
uintptr_t r_end = idx_b < type_b->count ? r->base : ADDR_MAX;
if (r_start == r_end) {
/* this free region has a length of zero, move to the next one */
continue;
}
if (r_start >= m_end) {
/* we've gone past the end of the current memory region, and need to go to the next one */