[denali] Add a stub client for denali

This commit is contained in:
Drew Galbraith 2023-06-19 22:57:08 -07:00
parent a202bf2371
commit 45cf2115da
5 changed files with 63 additions and 1 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include <ztypes.h>
class MappedMemoryRegion {
public:
@ -8,6 +9,7 @@ class MappedMemoryRegion {
static MappedMemoryRegion DirectPhysical(uint64_t phys_addr, uint64_t size);
static MappedMemoryRegion ContiguousPhysical(uint64_t size);
static MappedMemoryRegion Default(uint64_t size);
static MappedMemoryRegion FromCapability(z_cap_t vmmo_cap);
MappedMemoryRegion() {}
// TODO: Disallow copy before doing any cleanup here.

View file

@ -35,3 +35,11 @@ MappedMemoryRegion MappedMemoryRegion::Default(uint64_t size) {
return MappedMemoryRegion(vmmo_cap, 0, vaddr, size);
}
MappedMemoryRegion MappedMemoryRegion::FromCapability(z_cap_t vmmo_cap) {
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
// FIXME: get the size here.
return MappedMemoryRegion(vmmo_cap, 0, vaddr, 0);
}