forked from Bananymous/banan-os
Kernel: make DMARegion::create static and fix mapping
This commit is contained in:
parent
400db176d1
commit
521513bed2
|
@ -8,7 +8,7 @@ namespace Kernel
|
||||||
class DMARegion
|
class DMARegion
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BAN::ErrorOr<BAN::UniqPtr<DMARegion>> create(size_t size);
|
static BAN::ErrorOr<BAN::UniqPtr<DMARegion>> create(size_t size);
|
||||||
~DMARegion();
|
~DMARegion();
|
||||||
|
|
||||||
size_t size() const { return m_size; }
|
size_t size() const { return m_size; }
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Kernel
|
||||||
vaddr_guard.disable();
|
vaddr_guard.disable();
|
||||||
paddr_guard.disable();
|
paddr_guard.disable();
|
||||||
|
|
||||||
PageTable::kernel().map_range_at(paddr, vaddr, size, PageTable::Flags::CacheDisable | PageTable::Flags::ReadWrite | PageTable::Flags::Reserved);
|
PageTable::kernel().map_range_at(paddr, vaddr, size, PageTable::Flags::CacheDisable | PageTable::Flags::ReadWrite | PageTable::Flags::Present);
|
||||||
|
|
||||||
return BAN::UniqPtr<DMARegion>::adopt(region_ptr);
|
return BAN::UniqPtr<DMARegion>::adopt(region_ptr);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace Kernel
|
||||||
DMARegion::~DMARegion()
|
DMARegion::~DMARegion()
|
||||||
{
|
{
|
||||||
PageTable::kernel().unmap_range(m_vaddr, m_size);
|
PageTable::kernel().unmap_range(m_vaddr, m_size);
|
||||||
Heap::get().release_contiguous_pages(m_vaddr, BAN::Math::div_round_up<size_t>(m_size, PAGE_SIZE));
|
Heap::get().release_contiguous_pages(m_paddr, BAN::Math::div_round_up<size_t>(m_size, PAGE_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue