Add DMA_ALLOCATOR

This commit is contained in:
Berkus Decker 2020-10-20 05:33:57 +03:00
parent e48316cc4b
commit fb7f86abf0
1 changed files with 19 additions and 0 deletions

View File

@ -42,6 +42,25 @@ mod write_to;
entry!(kmain);
/// The global allocator for DMA-able memory. That is, memory which is tagged
/// non-cacheable in the page tables.
static DMA_ALLOCATOR: sync::NullLock<mm::BumpAllocator> =
sync::NullLock::new(mm::BumpAllocator::new(
// @todo Init this after we loaded boot memory map
memory::map::virt::DMA_HEAP_START as usize,
memory::map::virt::DMA_HEAP_END as usize,
"Global DMA Allocator",
// Try the following arguments instead to see all mailbox operations
// fail. It will cause the allocator to use memory that are marked
// cacheable and therefore not DMA-safe. The answer from the VideoCore
// won't be received by the CPU because it reads an old cached value
// that resembles an error case instead.
// 0x00600000 as usize,
// 0x007FFFFF as usize,
// "Global Non-DMA Allocator",
));
fn print_mmu_state_and_features() {
memory::mmu::print_features();
}