[Mammoth] Get rid of last uses of MappedMemoryRegion.
This commit is contained in:
parent
d41a565721
commit
344e84c313
6 changed files with 20 additions and 56 deletions
|
|
@ -3,34 +3,6 @@
|
|||
#include <stdint.h>
|
||||
#include <ztypes.h>
|
||||
|
||||
class MappedMemoryRegion {
|
||||
public:
|
||||
// FIXME: Introduce optional type to contain error or.
|
||||
static MappedMemoryRegion DirectPhysical(uint64_t phys_addr, uint64_t size);
|
||||
static MappedMemoryRegion Default(uint64_t size);
|
||||
|
||||
MappedMemoryRegion() {}
|
||||
// TODO: Disallow copy before doing any cleanup here.
|
||||
~MappedMemoryRegion() {}
|
||||
|
||||
uint64_t paddr() { return paddr_; }
|
||||
uint64_t vaddr() { return vaddr_; }
|
||||
uint64_t size() { return size_; }
|
||||
|
||||
uint64_t cap() { return vmmo_cap_; }
|
||||
|
||||
operator bool() { return vmmo_cap_ != 0; }
|
||||
|
||||
private:
|
||||
MappedMemoryRegion(uint64_t vmmo_cap, uint64_t paddr, uint64_t vaddr,
|
||||
uint64_t size)
|
||||
: vmmo_cap_(vmmo_cap), paddr_(paddr), vaddr_(vaddr), size_(size) {}
|
||||
uint64_t vmmo_cap_ = 0;
|
||||
uint64_t paddr_ = 0;
|
||||
uint64_t vaddr_ = 0;
|
||||
uint64_t size_ = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
* Memory Region class that unmaps its memory and releases its
|
||||
* capability when it goes out of scope.
|
||||
|
|
@ -50,6 +22,7 @@ class OwnedMemoryRegion {
|
|||
static OwnedMemoryRegion FromCapability(z_cap_t vmmo_cap);
|
||||
// TODO: Consider making this its own class.
|
||||
static OwnedMemoryRegion ContiguousPhysical(uint64_t size, uint64_t* paddr);
|
||||
static OwnedMemoryRegion DirectPhysical(uint64_t paddr, uint64_t size);
|
||||
|
||||
uint64_t vaddr() { return vaddr_; }
|
||||
uint64_t size() { return size_; }
|
||||
|
|
@ -65,5 +38,6 @@ class OwnedMemoryRegion {
|
|||
: vmmo_cap_(vmmo_cap), vaddr_(vaddr), size_(size) {}
|
||||
uint64_t vmmo_cap_ = 0;
|
||||
uint64_t vaddr_ = 0;
|
||||
// TODO: We may want to differentiate between VMMO size and mapped size?
|
||||
uint64_t size_ = 0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue