[zion] Add a direct port write for the kernel
This commit is contained in:
parent
0a909eae0e
commit
2ea1f90690
3 changed files with 21 additions and 16 deletions
|
|
@ -130,25 +130,11 @@ void LoadInitProgram() {
|
|||
prog2_vmmo->CopyBytesToObject(reinterpret_cast<uint64_t>(prog2.address),
|
||||
prog2.size);
|
||||
|
||||
// TODO: Probably add a way for the kernel to write caps directly rather than
|
||||
// by installing them first.
|
||||
uint64_t vmmo_cap =
|
||||
gScheduler->CurrentProcess().AddNewCapability(prog2_vmmo, ZC_WRITE);
|
||||
|
||||
auto port = MakeRefCounted<Port>();
|
||||
uint64_t port_cap = proc->AddNewCapability(port, ZC_READ | ZC_WRITE);
|
||||
|
||||
uint64_t vmmo_id = Z_BOOT_DENALI_VMMO;
|
||||
ZMessage vmmo_msg{
|
||||
.type = 0,
|
||||
.num_bytes = 8,
|
||||
.bytes = reinterpret_cast<uint8_t*>(&vmmo_id),
|
||||
.num_caps = 1,
|
||||
.caps = &vmmo_cap,
|
||||
};
|
||||
if (port->Write(vmmo_msg) != Z_OK) {
|
||||
panic("Failed to write cap");
|
||||
}
|
||||
port->WriteKernel(Z_BOOT_DENALI_VMMO,
|
||||
MakeRefCounted<Capability>(prog2_vmmo, ZC_READ | ZC_WRITE));
|
||||
|
||||
proc->CreateThread()->Start(entry, port_cap, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue