From d4c9f371a60b1347cdc108b471bf4a31790fdb6b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 8 Oct 2023 18:12:17 +0300 Subject: [PATCH] Kernel: make DMARegion::create static and fix mapping --- kernel/include/kernel/Memory/DMARegion.h | 2 +- kernel/kernel/Memory/DMARegion.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/include/kernel/Memory/DMARegion.h b/kernel/include/kernel/Memory/DMARegion.h index bd0585e189..bf6b58eb41 100644 --- a/kernel/include/kernel/Memory/DMARegion.h +++ b/kernel/include/kernel/Memory/DMARegion.h @@ -8,7 +8,7 @@ namespace Kernel class DMARegion { public: - BAN::ErrorOr> create(size_t size); + static BAN::ErrorOr> create(size_t size); ~DMARegion(); size_t size() const { return m_size; } diff --git a/kernel/kernel/Memory/DMARegion.cpp b/kernel/kernel/Memory/DMARegion.cpp index 645356e254..2ffd978de9 100644 --- a/kernel/kernel/Memory/DMARegion.cpp +++ b/kernel/kernel/Memory/DMARegion.cpp @@ -26,7 +26,7 @@ namespace Kernel vaddr_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::adopt(region_ptr); } @@ -40,7 +40,7 @@ namespace Kernel DMARegion::~DMARegion() { PageTable::kernel().unmap_range(m_vaddr, m_size); - Heap::get().release_contiguous_pages(m_vaddr, BAN::Math::div_round_up(m_size, PAGE_SIZE)); + Heap::get().release_contiguous_pages(m_paddr, BAN::Math::div_round_up(m_size, PAGE_SIZE)); } }