[yellowstone] Recieve all caps via init port.
This commit is contained in:
parent
2ea1f90690
commit
09ac87e6f5
|
@ -17,11 +17,11 @@ z_err_t ParseInitPort(uint64_t init_port_cap) {
|
||||||
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != Z_ERR_EMPTY) {
|
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != Z_ERR_EMPTY) {
|
||||||
RET_ERR(ret);
|
RET_ERR(ret);
|
||||||
switch (init_sig) {
|
switch (init_sig) {
|
||||||
case Z_INIT_PROC_SELF:
|
case Z_INIT_SELF_PROC:
|
||||||
dbgln("received proc");
|
dbgln("received proc");
|
||||||
gSelfProcCap = init_cap;
|
gSelfProcCap = init_cap;
|
||||||
break;
|
break;
|
||||||
case Z_INIT_VMAS_SELF:
|
case Z_INIT_SELF_VMAS:
|
||||||
dbgln("received vmas");
|
dbgln("received vmas");
|
||||||
gSelfVmasCap = init_cap;
|
gSelfVmasCap = init_cap;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "mammoth/channel.h"
|
#include "mammoth/channel.h"
|
||||||
#include "mammoth/debug.h"
|
#include "mammoth/debug.h"
|
||||||
|
#include "mammoth/init.h"
|
||||||
|
|
||||||
#define MAM_PROC_DEBUG 0
|
#define MAM_PROC_DEBUG 0
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ uint64_t LoadElfProgram(uint64_t base, uint64_t as_cap) {
|
||||||
dbgln("Map Local");
|
dbgln("Map Local");
|
||||||
#endif
|
#endif
|
||||||
uint64_t vaddr;
|
uint64_t vaddr;
|
||||||
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, mem_cap, &vaddr));
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, mem_cap, &vaddr));
|
||||||
|
|
||||||
#if MAM_PROC_DEBUG
|
#if MAM_PROC_DEBUG
|
||||||
dbgln("Copy");
|
dbgln("Copy");
|
||||||
|
@ -104,8 +105,8 @@ uint64_t SpawnProcessFromElfRegion(uint64_t program, Channel& local) {
|
||||||
uint64_t proc_cap;
|
uint64_t proc_cap;
|
||||||
uint64_t as_cap;
|
uint64_t as_cap;
|
||||||
uint64_t foreign_chan_id;
|
uint64_t foreign_chan_id;
|
||||||
check(ZProcessSpawn(Z_INIT_PROC_SELF, foreign.release_cap(), &proc_cap,
|
check(ZProcessSpawn(gSelfProcCap, foreign.release_cap(), &proc_cap, &as_cap,
|
||||||
&as_cap, &foreign_chan_id));
|
&foreign_chan_id));
|
||||||
|
|
||||||
uint64_t entry_point = LoadElfProgram(program, as_cap);
|
uint64_t entry_point = LoadElfProgram(program, as_cap);
|
||||||
#if MAM_PROC_DEBUG
|
#if MAM_PROC_DEBUG
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "hw/pcie.h"
|
#include "hw/pcie.h"
|
||||||
|
|
||||||
#include <mammoth/debug.h>
|
#include <mammoth/debug.h>
|
||||||
|
#include <mammoth/init.h>
|
||||||
#include <zcall.h>
|
#include <zcall.h>
|
||||||
#include <zinit.h>
|
#include <zinit.h>
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ void DumpPciEDevices() {
|
||||||
|
|
||||||
dbgln("Creating addr space");
|
dbgln("Creating addr space");
|
||||||
uint64_t vaddr;
|
uint64_t vaddr;
|
||||||
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, vmmo_cap, &vaddr));
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
|
||||||
dbgln("Addr %lx", vaddr);
|
dbgln("Addr %lx", vaddr);
|
||||||
|
|
||||||
dbgln("Dumping PCI");
|
dbgln("Dumping PCI");
|
||||||
|
|
|
@ -13,7 +13,7 @@ uint64_t main(uint64_t port_cap) {
|
||||||
check(ParseInitPort(port_cap));
|
check(ParseInitPort(port_cap));
|
||||||
|
|
||||||
uint64_t vaddr;
|
uint64_t vaddr;
|
||||||
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, gBootDenaliVmmoCap, &vaddr));
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
|
||||||
|
|
||||||
Channel local;
|
Channel local;
|
||||||
check(SpawnProcessFromElfRegion(vaddr, local));
|
check(SpawnProcessFromElfRegion(vaddr, local));
|
||||||
|
@ -35,7 +35,7 @@ uint64_t main(uint64_t port_cap) {
|
||||||
|
|
||||||
dbgln("Resp: %u", type);
|
dbgln("Resp: %u", type);
|
||||||
|
|
||||||
check(ZAddressSpaceMap(Z_INIT_VMAS_SELF, 0, mem_cap, &vaddr));
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, mem_cap, &vaddr));
|
||||||
uint32_t* mbr = reinterpret_cast<uint32_t*>(vaddr + 0x1FE);
|
uint32_t* mbr = reinterpret_cast<uint32_t*>(vaddr + 0x1FE);
|
||||||
dbgln("MBR: %x", *mbr);
|
dbgln("MBR: %x", *mbr);
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,7 @@
|
||||||
#define Z_INIT_PROC_SELF 0x00
|
#define Z_INIT_PROC_SELF 0x00
|
||||||
#define Z_INIT_VMAS_SELF 0x01
|
#define Z_INIT_VMAS_SELF 0x01
|
||||||
|
|
||||||
|
#define Z_INIT_SELF_PROC 0x100
|
||||||
|
#define Z_INIT_SELF_VMAS 0x101
|
||||||
|
|
||||||
#define Z_BOOT_DENALI_VMMO 0x1000
|
#define Z_BOOT_DENALI_VMMO 0x1000
|
||||||
|
|
|
@ -133,6 +133,11 @@ void LoadInitProgram() {
|
||||||
auto port = MakeRefCounted<Port>();
|
auto port = MakeRefCounted<Port>();
|
||||||
uint64_t port_cap = proc->AddNewCapability(port, ZC_READ | ZC_WRITE);
|
uint64_t port_cap = proc->AddNewCapability(port, ZC_READ | ZC_WRITE);
|
||||||
|
|
||||||
|
port->WriteKernel(Z_INIT_SELF_PROC,
|
||||||
|
MakeRefCounted<Capability>(
|
||||||
|
proc, ZC_PROC_SPAWN_PROC | ZC_PROC_SPAWN_THREAD));
|
||||||
|
port->WriteKernel(Z_INIT_SELF_VMAS,
|
||||||
|
MakeRefCounted<Capability>(proc->vmas(), ZC_WRITE));
|
||||||
port->WriteKernel(Z_BOOT_DENALI_VMMO,
|
port->WriteKernel(Z_BOOT_DENALI_VMMO,
|
||||||
MakeRefCounted<Capability>(prog2_vmmo, ZC_READ | ZC_WRITE));
|
MakeRefCounted<Capability>(prog2_vmmo, ZC_READ | ZC_WRITE));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue