acadia/lib/mammoth/util/init.cpp

54 lines
1.3 KiB
C++
Raw Normal View History

#include "util/init.h"
2023-06-21 18:28:54 -07:00
#include <glacier/status/error.h>
#include <ztypes.h>
#include "ipc/port_server.h"
#include "util/debug.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;
uint64_t gBootVictoriaFallsVmmoCap = 0;
uint64_t gBootPciVmmoCap = 0;
uint64_t gBootFramebufferVmmoCap = 0;
z_err_t ParseInitPort(uint64_t init_port_cap) {
mmth::PortServer port = mmth::PortServer::AdoptCap(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:
gSelfProcCap = init_cap;
break;
case Z_INIT_SELF_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:
gBootDenaliVmmoCap = init_cap;
break;
case Z_BOOT_VICTORIA_FALLS_VMMO:
gBootVictoriaFallsVmmoCap = init_cap;
break;
case Z_BOOT_PCI_VMMO:
gBootPciVmmoCap = init_cap;
break;
case Z_BOOT_FRAMEBUFFER_INFO_VMMO:
gBootFramebufferVmmoCap = init_cap;
break;
default:
dbgln("Unexpected init type {x}, continuing.", init_sig);
}
}
2023-06-21 18:28:54 -07:00
return glcr::OK;
}