[Mammoth] Add the ability to duplicate an owned memory region.

This commit is contained in:
Drew Galbraith 2024-01-11 18:29:45 -08:00
parent be392252a4
commit e7cc98a20c
2 changed files with 5 additions and 0 deletions

View File

@ -71,4 +71,8 @@ z_cap_t OwnedMemoryRegion::DuplicateCap() {
return cap;
}
OwnedMemoryRegion OwnedMemoryRegion::Duplicate() {
return OwnedMemoryRegion::FromCapability(DuplicateCap());
}
} // namespace mmth

View File

@ -30,6 +30,7 @@ class OwnedMemoryRegion {
z_cap_t cap() const { return vmmo_cap_; }
z_cap_t DuplicateCap();
OwnedMemoryRegion Duplicate();
bool empty() const { return vmmo_cap_ == 0; }
explicit operator bool() const { return vmmo_cap_ != 0; }