[Yellowstone] Release init caps after loading.

This was incredibly helpful for finding cases where we were using
uninitialized memory as it causes a lot more pages to be reused early.
This commit is contained in:
Drew Galbraith 2023-11-19 22:54:23 -08:00
parent 322502fcee
commit 126482f3e8
1 changed files with 1 additions and 9 deletions

View File

@ -13,14 +13,6 @@
#include "yellowstone_server.h"
glcr::ErrorCode SpawnProcess(z_cap_t vmmo_cap, z_cap_t yellowstone_cap) {
uint64_t vaddr;
// FIXME: Probably unmap this and remove the cap ownership.
RET_ERR(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
return SpawnProcessFromElfRegion(vaddr, yellowstone_cap);
}
glcr::ErrorCode SpawnProcessDeleteCap(z_cap_t vmmo_cap,
z_cap_t yellowstone_cap) {
OwnedMemoryRegion region = OwnedMemoryRegion::FromCapability(vmmo_cap);
return SpawnProcessFromElfRegion(region.vaddr(), yellowstone_cap);
}
@ -66,7 +58,7 @@ uint64_t main(uint64_t port_cap) {
check(vfs_client->OpenFile(req, resp));
ASSIGN_OR_RETURN(YellowstoneClient client3, server->CreateClient());
check(SpawnProcessDeleteCap(resp.memory(), client3.Capability()));
check(SpawnProcess(resp.memory(), client3.Capability()));
}
}