From 24c9fa55a967bb93c335c93c2b65d244cd605e8b Mon Sep 17 00:00:00 2001 From: Sparchatus Date: Mon, 28 Mar 2022 07:58:55 +0000 Subject: [PATCH] Pass init EP to spawn child --- .vscode/c_cpp_properties.json | 3 ++- include/spawn/spawn.h | 1 + lib/spawn/spawn.c | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index d000859..a0a9e63 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -15,7 +15,8 @@ "compilerPath": "", "intelliSenseMode": "gcc-arm64", "defines": [ - "CONFIG_TIMESLICE=80" + "CONFIG_TIMESLICE=80", + "CONFIG_INTERCONNECT_DRIVER_LMP" ] } ], diff --git a/include/spawn/spawn.h b/include/spawn/spawn.h index 9ba2089..91c0476 100644 --- a/include/spawn/spawn.h +++ b/include/spawn/spawn.h @@ -48,6 +48,7 @@ struct spawninfo { // 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_initep; // < Endpoint to init 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. diff --git a/lib/spawn/spawn.c b/lib/spawn/spawn.c index 8698210..7b450e8 100644 --- a/lib/spawn/spawn.c +++ b/lib/spawn/spawn.c @@ -362,6 +362,9 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si, si->cspace_cap_selfep.cnode = si->cspace_l2_cnode_taskcn; si->cspace_cap_selfep.slot = TASKCN_SLOT_SELFEP; + si->cspace_cap_initep.cnode = si->cspace_l2_cnode_taskcn; + si->cspace_cap_initep.slot = TASKCN_SLOT_INITEP; + si->cspace_cap_dispatcher.cnode = si->cspace_l2_cnode_taskcn; si->cspace_cap_dispatcher.slot = TASKCN_SLOT_DISPATCHER; @@ -403,6 +406,8 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si, err = cap_retype(si->cspace_cap_selfep, si->cspace_cap_dispatcher, 0, ObjType_EndPointLMP, 0, 1); if (err_is_fail(err)) return err; + err = cap_copy(si->cspace_cap_initep, cap_selfep); + if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_COPY_FAIL); // - Setup the child's vspace // afeer: create level 0 page table