[kernel] Add new vm_area_fixed

Add a new vm_area type, vm_area_fixed, which is sharable but not
allocatable. Useful for mapping things like MMIO to process spaces.
This commit is contained in:
Justin C. Miller
2021-01-28 01:05:21 -08:00
parent 71dc332dae
commit e3ebaeb2c8
2 changed files with 31 additions and 0 deletions

View File

@@ -53,6 +53,17 @@ vm_area_shared::~vm_area_shared()
} }
vm_area_fixed::vm_area_fixed(size_t size, vm_flags flags) :
m_mapper {*this},
vm_area {size, flags}
{
}
vm_area_fixed::~vm_area_fixed()
{
}
vm_area_open::vm_area_open(size_t size, vm_space &space, vm_flags flags) : vm_area_open::vm_area_open(size_t size, vm_space &space, vm_flags flags) :
m_mapper(*this, space), m_mapper(*this, space),
vm_area(size, flags) vm_area(size, flags)

View File

@@ -108,6 +108,26 @@ private:
}; };
/// A shareable but non-allocatable memory area (like mmio)
class vm_area_fixed :
public vm_area
{
public:
/// Constructor.
/// \arg size Initial virtual size of the memory area
/// \arg flags Flags for this memory area
vm_area_fixed(size_t size, vm_flags flags = vm_flags::none);
virtual ~vm_area_fixed();
virtual bool allowed(uintptr_t offset) const override { return false; }
virtual vm_mapper & mapper() override { return m_mapper; }
virtual const vm_mapper & mapper() const override { return m_mapper; }
private:
vm_mapper_multi m_mapper;
};
/// Area that allows open allocation (eg, kernel heap) /// Area that allows open allocation (eg, kernel heap)
class vm_area_open : class vm_area_open :
public vm_area public vm_area