[yellowstone] Add yellowstone server for endpoint registration.

This commit is contained in:
Drew Galbraith 2023-06-22 02:19:16 -07:00
parent 8dcb1ddabd
commit a46694d0f7
13 changed files with 248 additions and 31 deletions

View file

@ -1,4 +1,3 @@
#include <denali/denali.h>
#include <mammoth/debug.h>
#include <mammoth/endpoint_client.h>
#include <mammoth/init.h>
@ -7,32 +6,28 @@
#include "hw/gpt.h"
#include "hw/pcie.h"
#include "yellowstone_server.h"
uint64_t main(uint64_t port_cap) {
dbgln("Yellowstone Initializing.");
check(ParseInitPort(port_cap));
ASSIGN_OR_RETURN(YellowstoneServer server, YellowstoneServer::Create());
Thread server_thread = server.RunServer();
Thread registration_thread = server.RunRegistration();
DumpPciEDevices();
uint64_t vaddr;
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
auto endpoint_or = SpawnProcessFromElfRegion(vaddr);
if (!endpoint_or) {
check(endpoint_or.error());
}
EndpointClient endpoint = endpoint_or.value();
DenaliClient client(endpoint);
GptReader reader(client);
check(reader.ParsePartitionTables());
ASSIGN_OR_RETURN(EndpointClient client, server.GetServerClient());
check(SpawnProcessFromElfRegion(vaddr, client));
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootVictoriaFallsVmmoCap, &vaddr));
auto error_or = SpawnProcessFromElfRegion(vaddr);
if (!error_or) {
check(error_or.error());
}
ASSIGN_OR_RETURN(client, server.GetServerClient());
check(SpawnProcessFromElfRegion(vaddr, client));
check(server_thread.Join());
check(registration_thread.Join());
dbgln("Yellowstone Finished Successfully.");
return 0;
}