[Zion] Add an argument to memory align a mapping.

This commit is contained in:
Drew Galbraith 2023-11-23 18:49:01 -08:00
parent c8931a01c8
commit d44be91099
11 changed files with 30 additions and 22 deletions

View file

@ -3,7 +3,9 @@
#include <glacier/status/error.h>
#include <zcall.h>
void dbgln(const glcr::String& string) { (void)ZDebug(string.cstr()); }
void dbgln(glcr::StringView string) {
(void)ZDebug(string.data(), string.size());
}
void check(uint64_t code) {
switch (code) {

View file

@ -6,7 +6,7 @@
#include <ztypes.h>
// TODO: Take StringView here instead.
void dbgln(const glcr::String& string);
void dbgln(glcr::StringView string);
template <typename... Args>
void dbgln(const glcr::StringView& fmt, Args... args) {

View file

@ -36,7 +36,7 @@ OwnedMemoryRegion::~OwnedMemoryRegion() {
OwnedMemoryRegion OwnedMemoryRegion::FromCapability(z_cap_t vmmo_cap) {
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, 0, &vaddr));
uint64_t size;
check(ZMemoryObjectInspect(vmmo_cap, &size));
@ -50,7 +50,7 @@ OwnedMemoryRegion OwnedMemoryRegion::ContiguousPhysical(uint64_t size,
check(ZMemoryObjectCreateContiguous(size, &vmmo_cap, paddr));
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, 0, &vaddr));
return OwnedMemoryRegion(vmmo_cap, vaddr, size);
}
@ -61,7 +61,7 @@ OwnedMemoryRegion OwnedMemoryRegion::DirectPhysical(uint64_t paddr,
check(ZMemoryObjectCreatePhysical(paddr, size, &vmmo_cap));
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, 0, &vaddr));
return OwnedMemoryRegion(vmmo_cap, vaddr, size);
}