create cspace

This commit is contained in:
Aurel Feer 2022-03-22 20:49:42 +00:00
parent 6b911752f0
commit 68c6df0238
2 changed files with 48 additions and 0 deletions

View File

@ -31,7 +31,24 @@ struct spawninfo {
// when spawning a new dispatcher,
// e.g. references to the child's
// capabilities or paging state
//afeer: see script page 84/85
struct cnoderef cspace_l1_cnode_info;
struct capref cspace_l1_cnode_cap;
struct cnoderef cspace_l2_cnode_taskcn; // < Contains information about the process itself.
struct cnoderef cspace_l2_cnode_slot_alloc_0; // < Empty L2 Node that contains space for the childs initial slot allocator. When the new process starts creating and retyping capa- bilities, they will be stored in here.
struct cnoderef cspace_l2_cnode_slot_alloc_1; // < A second L2 Node for the slot allocator to use.
struct cnoderef cspace_l2_cnode_slot_alloc_2; // < A third L2 Node for the slot allocator to use.
struct cnoderef cspace_l2_cnode_base_pagecn; // < Each slot holds a BASE_PAGE_SIZEd RAM capability.
struct cnoderef cspace_l2_cnode_pagecn; // < Contains capabilites to the pagetable
// these capabilites are all stored in the taskcn cnode
struct capref cspace_cap_selfep; // < Endpoint to itself. You can get this capability by retyping the dispatcher capability to ObjType_EndPointLMP.
struct capref cspace_cap_dispatcher; // < Contains the dispatcher capability.The dispatcher is the equivalent of a “Process Control Block” in other operating systems. You can create one using dispatcher_create(...);
struct capref cspace_cap_rootcn; // < Contains a capability for the root (L1) CNode.
struct capref cspace_cap_dispframe; // < A capability to the dispatcher frame, used to communicate between a process and the CPU driver.
struct capref cspace_cap_argspage; // < A page containing a list of command line ar- guments.
};
// Start a child process using the multiboot command line. Fills in si.

View File

@ -83,6 +83,37 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
// - Setup the environment
// - Make the new dispatcher runnable
// afeer: script page 84/85
cnode_create_l1(&si->cspace_l1_cnode_cap, &si->cspace_l1_cnode_info);
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_TASKCN, &si->cspace_l2_cnode_taskcn);
// afeer: (script page 84) is this correct?
si->cspace_cap_selfep.cnode = si->cspace_l2_cnode_taskcn;
si->cspace_cap_selfep.slot = TASKCN_SLOT_SELFEP;
si->cspace_cap_dispatcher.cnode = si->cspace_l2_cnode_taskcn;
si->cspace_cap_dispatcher.slot = TASKCN_SLOT_DISPATCHER;
si->cspace_cap_rootcn.cnode = si->cspace_l2_cnode_taskcn;
si->cspace_cap_rootcn.slot = TASKCN_SLOT_ROOTCN;
si->cspace_cap_dispframe.cnode = si->cspace_l2_cnode_taskcn;
si->cspace_cap_dispframe.slot = TASKCN_SLOT_DISPFRAME;
si->cspace_cap_argspage.cnode = si->cspace_l2_cnode_taskcn;
si->cspace_cap_argspage.slot = TASKCN_SLOT_ARGSPAGE;
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_SLOT_ALLOC0, &si->cspace_l2_cnode_slot_alloc_0);
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_SLOT_ALLOC1, &si->cspace_l2_cnode_slot_alloc_1);
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_SLOT_ALLOC2, &si->cspace_l2_cnode_slot_alloc_2);
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_BASE_PAGE_CN, &si->cspace_l2_cnode_base_pagecn);
cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_PAGECN, &si->cspace_l2_cnode_pagecn); // < afeer: TODO: script page 85: fill this with pagetable capabilities
// afeer: populate some capabilities
dispatcher_create(si->cspace_cap_dispatcher);
cap_retype(si->cspace_cap_selfep, si->cspace_cap_dispatcher, 0, ObjType_EndPointLMP, 0, 1);
return LIB_ERR_NOT_IMPLEMENTED;
}