2023-06-07 00:04:53 -07:00
|
|
|
#include <mammoth/debug.h>
|
2023-06-21 21:26:24 -07:00
|
|
|
#include <mammoth/endpoint_client.h>
|
2023-06-16 23:51:49 -07:00
|
|
|
#include <mammoth/init.h>
|
2023-06-07 00:04:53 -07:00
|
|
|
#include <mammoth/process.h>
|
2023-06-07 00:19:15 -07:00
|
|
|
#include <zcall.h>
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-19 21:54:40 -07:00
|
|
|
#include "hw/gpt.h"
|
2023-06-07 22:45:42 -07:00
|
|
|
#include "hw/pcie.h"
|
2023-06-22 02:19:16 -07:00
|
|
|
#include "yellowstone_server.h"
|
2023-06-07 22:45:42 -07:00
|
|
|
|
2023-06-16 23:15:41 -07:00
|
|
|
uint64_t main(uint64_t port_cap) {
|
2023-06-07 11:18:35 -07:00
|
|
|
dbgln("Yellowstone Initializing.");
|
2023-06-16 23:51:49 -07:00
|
|
|
check(ParseInitPort(port_cap));
|
|
|
|
|
2023-06-22 02:19:16 -07:00
|
|
|
ASSIGN_OR_RETURN(YellowstoneServer server, YellowstoneServer::Create());
|
|
|
|
Thread server_thread = server.RunServer();
|
|
|
|
Thread registration_thread = server.RunRegistration();
|
2023-06-19 21:54:40 -07:00
|
|
|
DumpPciEDevices();
|
|
|
|
|
2023-06-07 00:19:15 -07:00
|
|
|
uint64_t vaddr;
|
2023-06-17 00:17:43 -07:00
|
|
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
|
2023-06-22 02:19:16 -07:00
|
|
|
ASSIGN_OR_RETURN(EndpointClient client, server.GetServerClient());
|
|
|
|
check(SpawnProcessFromElfRegion(vaddr, client));
|
2023-06-07 22:45:42 -07:00
|
|
|
|
2023-06-22 00:22:59 -07:00
|
|
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootVictoriaFallsVmmoCap, &vaddr));
|
2023-06-22 02:19:16 -07:00
|
|
|
ASSIGN_OR_RETURN(client, server.GetServerClient());
|
|
|
|
check(SpawnProcessFromElfRegion(vaddr, client));
|
|
|
|
|
|
|
|
check(server_thread.Join());
|
|
|
|
check(registration_thread.Join());
|
2023-06-07 11:18:35 -07:00
|
|
|
dbgln("Yellowstone Finished Successfully.");
|
2023-05-29 00:32:54 -07:00
|
|
|
return 0;
|
|
|
|
}
|