Merge branches 'main' and 'main' of gitlab.ethz.ch:rueegges/aos into main

This commit is contained in:
Sparchatus 2022-03-23 09:04:55 +00:00
commit e682cbc0b8

View File

@ -224,7 +224,51 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
}
// - Setup the dispatcher
// TODO
err = frame_create(si->cspace_cap_dispframe, DISPATCHER_FRAME_SIZE, NULL);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_CREATE_DISPATCHER_FRAME);
}
dispatcher_handle_t handle;
err = paging_map_frame_attr(
get_current_paging_state(), (void **)&handle,
DISPATCHER_FRAME_SIZE, si->cspace_cap_dispframe, VREGION_FLAGS_READ_WRITE
);
if (err_is_fail(err)) return err;
struct dispatcher_shared_generic *disp =
get_dispatcher_shared_generic(handle);
struct dispatcher_generic *disp_gen = get_dispatcher_generic(handle);
arch_registers_state_t *enabled_area =
dispatcher_get_enabled_save_area(handle);
arch_registers_state_t *disabled_area =
dispatcher_get_disabled_save_area(handle);
// 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
// Start in disabled mode
disp->disabled = 1;
// A name (for debugging)
strncpy(disp->name, argv[0], DISP_NAME_LEN);
// Set program counter (where it should start to execute)
disabled_area->named.pc = entry;
// Initialize offset registers
// got_addr is the address of the .got in the child's VSpace
armv8_set_registers((void *)got_addr, handle, enabled_area, disabled_area);
// we won't use error handling frames
disp_gen->eh_frame = 0;
disp_gen->eh_frame_size = 0;
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