[zion] [yellowstone] Pass the denali VMMO by port as a POC.

Preparing to bootsrap via port write rather than hard coding capability
ids.
This commit is contained in:
Drew Galbraith 2023-06-16 15:58:50 -07:00
parent 75b1f2d21c
commit 21b73b5b92
5 changed files with 71 additions and 24 deletions

View file

@ -6,10 +6,22 @@
#include "hw/pcie.h"
int main() {
int main(uint64_t port_cap) {
dbgln("Yellowstone Initializing.");
uint64_t msg_type, type, cap, bytes, caps;
check(ZPortRecv(port_cap, 8, reinterpret_cast<uint8_t*>(&msg_type), 1, &cap,
&type, &bytes, &caps));
uint64_t vmmo_cap = 0;
if (bytes != 8 || caps != 1) {
crash("Invalid boot msg", Z_ERR_INVALID);
}
if (msg_type == Z_INIT_BOOT_VMMO) {
vmmo_cap = cap;
} else {
crash("Missing vmmo cap", Z_ERR_UNIMPLEMENTED);
}
uint64_t vaddr;
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, Z_INIT_BOOT_VMMO, &vaddr));
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, vmmo_cap, &vaddr));
Channel local;
check(SpawnProcessFromElfRegion(vaddr, local));
@ -23,7 +35,7 @@ int main() {
reinterpret_cast<uint8_t*>(&read), 0, nullptr));
DenaliReadResponse resp;
uint64_t mem_cap, type, bytes, caps;
uint64_t mem_cap;
check(ZChannelRecv(local.cap(), sizeof(resp),
reinterpret_cast<uint8_t*>(&resp), 1, &mem_cap, &type,