Kernel: Implement bare boness DMA Region

This does nothing but allocate contiguous physical and virtual memory
and map it as CacheDisable. Also memory is automatically freed RAII style.
This commit is contained in:
2023-10-08 02:56:01 +03:00
parent 799aab02f5
commit a6ca9fd453
3 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include <kernel/Memory/MemoryRegion.h>
namespace Kernel
{
class DMARegion
{
public:
BAN::ErrorOr<BAN::UniqPtr<DMARegion>> create(size_t size);
~DMARegion();
size_t size() const { return m_size; }
vaddr_t vaddr() const { return m_vaddr; }
paddr_t paddr() const { return m_paddr; }
private:
DMARegion(size_t size, vaddr_t vaddr, paddr_t paddr);
private:
const size_t m_size;
const vaddr_t m_vaddr;
const paddr_t m_paddr;
};
}