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:
27
kernel/include/kernel/Memory/DMARegion.h
Normal file
27
kernel/include/kernel/Memory/DMARegion.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user