spawn: Map dispatcher into child
This commit is contained in:
parent
c62530f230
commit
3f60fdbb72
@ -577,6 +577,7 @@ errors spawn SPAWN_ERR_ {
|
||||
failure UNKNOWN_TARGET_ARCH "Unknown target architecture type",
|
||||
failure UNSUPPORTED_TARGET_ARCH "Unsupported target architecture type",
|
||||
failure OUT_OF_PIDS "Failure allocating a pid",
|
||||
failure PAGING_INIT "Failure initializing child paging state",
|
||||
|
||||
failure SETUP_CSPACE "Failure in spawn_setup_cspace",
|
||||
failure DETERMINE_CPUTYPE "Failure in spawn_determine_cputype",
|
||||
|
||||
@ -212,7 +212,8 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
||||
// rueegges: initialize the foreign paging state
|
||||
struct paging_state child_paging_state;
|
||||
// 64 * 1024 is enough to catch null pointers and also enough to not conflict with child starting paging_alloc at VADDR_OFFSET
|
||||
paging_init_state_foreign(&child_paging_state, 64 * 1024, si->vspace_cap_l0_pagetable, get_default_slot_allocator());
|
||||
err = paging_init_state_foreign(&child_paging_state, 64 * 1024, si->vspace_cap_l0_pagetable, get_default_slot_allocator());
|
||||
if (err_is_fail(err)) return err_push(err, SPAWN_ERR_PAGING_INIT);
|
||||
|
||||
// - Load the ELF binary
|
||||
struct allocate_state st = {
|
||||
@ -240,7 +241,15 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
||||
get_current_paging_state(), (void **)&handle,
|
||||
DISPATCHER_FRAME_SIZE, si->cspace_cap_dispframe, VREGION_FLAGS_READ_WRITE
|
||||
);
|
||||
if (err_is_fail(err)) return err;
|
||||
if (err_is_fail(err)) return err_push(err, SPAWN_ERR_MAP_DISPATCHER_TO_SELF);
|
||||
|
||||
dispatcher_handle_t handle_child;
|
||||
err = paging_map_frame_attr(
|
||||
&child_paging_state, (void **)&handle_child,
|
||||
DISPATCHER_FRAME_SIZE, si->cspace_cap_dispframe, VREGION_FLAGS_READ_WRITE
|
||||
);
|
||||
if (err_is_fail(err)) return err_push(err, SPAWN_ERR_MAP_DISPATCHER_TO_NEW);
|
||||
|
||||
|
||||
struct dispatcher_shared_generic *disp =
|
||||
get_dispatcher_shared_generic(handle);
|
||||
@ -256,7 +265,7 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
||||
// core id of the process
|
||||
disp_gen->core_id = disp_get_core_id();
|
||||
// Virtual address of the dispatcher frame in child's VSpace
|
||||
disp->udisp = 0; // TODO
|
||||
disp->udisp = handle_child;
|
||||
// Start in disabled mode
|
||||
disp->disabled = 1;
|
||||
// A name (for debugging)
|
||||
@ -274,8 +283,6 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
||||
disp_gen->eh_frame_hdr = 0;
|
||||
disp_gen->eh_frame_hdr_size = 0;
|
||||
|
||||
// TODO: Map dispatcher frame into child address space
|
||||
|
||||
// - Setup the environment
|
||||
// TODO
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user