[Yellowstone] Use mutex to wait for denali to spawn VFS.

Kind of a hacky way to pass a signal between threads but works as
a POC for thread synchronization.
This commit is contained in:
Drew Galbraith 2023-10-25 19:08:00 -07:00
parent 6cb0041253
commit adfffdd3c3
3 changed files with 36 additions and 17 deletions

View file

@ -8,6 +8,12 @@
#include "hw/pcie.h"
#include "yellowstone_server.h"
glcr::ErrorCode SpawnProcess(z_cap_t vmmo_cap, z_cap_t yellowstone_cap) {
uint64_t vaddr;
RET_ERR(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
return SpawnProcessFromElfRegion(vaddr, yellowstone_cap);
}
uint64_t main(uint64_t port_cap) {
dbgln("Yellowstone Initializing.");
check(ParseInitPort(port_cap));
@ -15,10 +21,13 @@ uint64_t main(uint64_t port_cap) {
ASSIGN_OR_RETURN(auto server, YellowstoneServer::Create());
Thread server_thread = server->RunServer();
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
ASSIGN_OR_RETURN(YellowstoneClient client, server->CreateClient());
check(SpawnProcessFromElfRegion(vaddr, client.Capability()));
ASSIGN_OR_RETURN(YellowstoneClient client1, server->CreateClient());
check(SpawnProcess(gBootDenaliVmmoCap, client1.Capability()));
check(server->WaitDenaliRegistered());
ASSIGN_OR_RETURN(YellowstoneClient client2, server->CreateClient());
check(SpawnProcess(gBootVictoriaFallsVmmoCap, client2.Capability()));
check(server_thread.Join());
dbgln("Yellowstone Finished Successfully.");