Added ignore_physical_memory_ranges_beyond_4gb() which removes the memory
beyond 4 GB from the physical memory ranges. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37224 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bdf17d41a1
commit
ff9151d11f
@ -49,6 +49,7 @@ void sort_physical_address_ranges(phys_addr_range* ranges, uint32 numRanges);
|
||||
status_t insert_physical_memory_range(phys_addr_t start, phys_size_t size);
|
||||
status_t insert_physical_allocated_range(phys_addr_t start, phys_size_t size);
|
||||
status_t insert_virtual_allocated_range(addr_t start, size_t size);
|
||||
void ignore_physical_memory_ranges_beyond_4gb();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -396,6 +396,46 @@ insert_virtual_allocated_range(addr_t start, size_t size)
|
||||
}
|
||||
|
||||
|
||||
#if B_HAIKU_PHYSICAL_BITS > 32
|
||||
|
||||
void
|
||||
ignore_physical_memory_ranges_beyond_4gb()
|
||||
{
|
||||
// sort
|
||||
sort_physical_address_ranges(gKernelArgs.physical_memory_range,
|
||||
gKernelArgs.num_physical_memory_ranges);
|
||||
|
||||
static const phys_addr_t kLimit = (phys_addr_t)1 << 32;
|
||||
|
||||
// remove everything past 4 GB
|
||||
for (uint32 i = gKernelArgs.num_physical_memory_ranges; i > 0; i--) {
|
||||
phys_addr_range& range = gKernelArgs.physical_memory_range[i - 1];
|
||||
if (range.start >= kLimit) {
|
||||
// the complete range is beyond the limit
|
||||
dprintf("ignore_physical_memory_ranges_beyond_4gb(): ignoring "
|
||||
"range: %#" B_PRIxPHYSADDR " - %#" B_PRIxPHYSADDR "\n",
|
||||
range.start, range.start + range.size);
|
||||
gKernelArgs.ignored_physical_memory += range.size;
|
||||
gKernelArgs.num_physical_memory_ranges = i - 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kLimit - range.start < range.size) {
|
||||
// the range is partially beyond the limit
|
||||
dprintf("ignore_physical_memory_ranges_beyond_4gb(): ignoring "
|
||||
"range: %#" B_PRIxPHYSADDR " - %#" B_PRIxPHYSADDR "\n", kLimit,
|
||||
range.start + range.size);
|
||||
gKernelArgs.ignored_physical_memory
|
||||
+= range.size - (kLimit - range.start);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // B_HAIKU_PHYSICAL_BITS > 32
|
||||
|
||||
|
||||
// #pragma mark - kernel_args allocations
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user