acadia/lib/mammoth/src/init.cpp

45 lines
1.0 KiB
C++
Raw Normal View History

#include "mammoth/init.h"
2023-06-21 18:28:54 -07:00
#include <glacier/status/error.h>
#include <ztypes.h>
#include "mammoth/debug.h"
#include "mammoth/port.h"
uint64_t gSelfProcCap = 0;
uint64_t gSelfVmasCap = 0;
2023-06-21 23:14:42 -07:00
uint64_t gInitEndpointCap = 0;
uint64_t gBootDenaliVmmoCap = 0;
z_err_t ParseInitPort(uint64_t init_port_cap) {
Port port(init_port_cap);
z_err_t ret;
uint64_t init_sig, init_cap;
2023-06-21 18:28:54 -07:00
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != glcr::EMPTY) {
RET_ERR(ret);
switch (init_sig) {
case Z_INIT_SELF_PROC:
dbgln("received proc");
gSelfProcCap = init_cap;
break;
case Z_INIT_SELF_VMAS:
dbgln("received vmas");
gSelfVmasCap = init_cap;
break;
2023-06-21 23:14:42 -07:00
case Z_INIT_ENDPOINT:
gInitEndpointCap = init_cap;
break;
case Z_BOOT_DENALI_VMMO:
dbgln("received denali");
gBootDenaliVmmoCap = init_cap;
break;
default:
dbgln("Unexpected init type %x, continuing.", init_sig);
}
}
2023-06-21 18:28:54 -07:00
return glcr::OK;
}