also transfer slot0 capability of bootinfo
This commit is contained in:
parent
9e35e00500
commit
47f554c940
@ -195,6 +195,10 @@ struct bootinfo_serialized {
|
|||||||
|
|
||||||
size_t regions_length;
|
size_t regions_length;
|
||||||
size_t mem_spawn_core;
|
size_t mem_spawn_core;
|
||||||
|
|
||||||
|
genpaddr_t slot_0_frame_base; ///< base of the "special" capability on module_cnode slot 0
|
||||||
|
size_t slot_0_frame_bytes; ///< bytes
|
||||||
|
|
||||||
struct mem_region_serialized regions[];
|
struct mem_region_serialized regions[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -360,6 +360,17 @@ static errval_t serialize_bootinfo(struct bootinfo * bootinfo, struct bootinfo_s
|
|||||||
serialized_bootinfo->mem_spawn_core = bootinfo->mem_spawn_core;
|
serialized_bootinfo->mem_spawn_core = bootinfo->mem_spawn_core;
|
||||||
serialized_bootinfo->regions_length = bootinfo->regions_length;
|
serialized_bootinfo->regions_length = bootinfo->regions_length;
|
||||||
|
|
||||||
|
struct capref slot_0_cap = {
|
||||||
|
.cnode = cnode_module,
|
||||||
|
.slot = 0,
|
||||||
|
};
|
||||||
|
struct capability slot_0_cap_id;
|
||||||
|
err = cap_direct_identify(slot_0_cap, &slot_0_cap_id);
|
||||||
|
if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_IDENTIFY);
|
||||||
|
|
||||||
|
serialized_bootinfo->slot_0_frame_base = slot_0_cap_id.u.frame.base;
|
||||||
|
serialized_bootinfo->slot_0_frame_bytes = slot_0_cap_id.u.frame.bytes;
|
||||||
|
|
||||||
for (int i = 0; i < bootinfo->regions_length; ++i) {
|
for (int i = 0; i < bootinfo->regions_length; ++i) {
|
||||||
serialized_bootinfo->regions[i].mr_base = bootinfo->regions[i].mr_base;
|
serialized_bootinfo->regions[i].mr_base = bootinfo->regions[i].mr_base;
|
||||||
serialized_bootinfo->regions[i].mr_bytes = bootinfo->regions[i].mr_bytes;
|
serialized_bootinfo->regions[i].mr_bytes = bootinfo->regions[i].mr_bytes;
|
||||||
|
|||||||
@ -182,6 +182,14 @@ static errval_t deserialize_bootinfo(struct bootinfo_serialized * serialized, st
|
|||||||
(*ret)->mem_spawn_core = serialized->mem_spawn_core;
|
(*ret)->mem_spawn_core = serialized->mem_spawn_core;
|
||||||
(*ret)->regions_length = serialized->regions_length;
|
(*ret)->regions_length = serialized->regions_length;
|
||||||
|
|
||||||
|
//forge the slot 0 cap
|
||||||
|
struct capref slot_0_forge_destination = {
|
||||||
|
.cnode = cnode_module,
|
||||||
|
.slot = 0,
|
||||||
|
};
|
||||||
|
err = devframe_forge(slot_0_forge_destination, serialized->slot_0_frame_base, serialized->slot_0_frame_bytes, my_core_id);
|
||||||
|
if (err_is_fail(err)) return err;
|
||||||
|
|
||||||
for (int i = 0; i < serialized->regions_length; ++i) {
|
for (int i = 0; i < serialized->regions_length; ++i) {
|
||||||
(*ret)->regions[i].mr_base = serialized->regions[i].mr_base;
|
(*ret)->regions[i].mr_base = serialized->regions[i].mr_base;
|
||||||
(*ret)->regions[i].mr_bytes = serialized->regions[i].mr_bytes;
|
(*ret)->regions[i].mr_bytes = serialized->regions[i].mr_bytes;
|
||||||
@ -225,6 +233,8 @@ app_main(int argc, char *argv[]) {
|
|||||||
grading_setup_app_init(bi);
|
grading_setup_app_init(bi);
|
||||||
|
|
||||||
// TODO: initialize mem allocator, vspace management here
|
// TODO: initialize mem allocator, vspace management here
|
||||||
|
err = cap_retype(cap_selfep, cap_dispatcher, 0, ObjType_EndPointLMP, 0, 1);
|
||||||
|
if (err_is_fail(err)) return err;
|
||||||
|
|
||||||
// Grading
|
// Grading
|
||||||
grading_test_early();
|
grading_test_early();
|
||||||
@ -248,8 +258,8 @@ app_main(int argc, char *argv[]) {
|
|||||||
err = aos_urpc_get_bootinfo(&urpc_to_bsp, &bi_ser);
|
err = aos_urpc_get_bootinfo(&urpc_to_bsp, &bi_ser);
|
||||||
if (err_is_fail(err)) return err;
|
if (err_is_fail(err)) return err;
|
||||||
err = deserialize_bootinfo(bi_ser, &bi);
|
err = deserialize_bootinfo(bi_ser, &bi);
|
||||||
if (err_is_fail(err)) return err;
|
|
||||||
free(bi_ser);
|
free(bi_ser);
|
||||||
|
if (err_is_fail(err)) return err;
|
||||||
|
|
||||||
debug_printf("[app_main]: received bootinfo with %d regions\n", bi->regions_length);
|
debug_printf("[app_main]: received bootinfo with %d regions\n", bi->regions_length);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user