Make it possible to use caps in child
This commit is contained in:
parent
c835aa477b
commit
d58ae46282
@ -123,7 +123,7 @@ static size_t spawn_serialice_vspace_pt_size(struct pt_t *pt) {
|
|||||||
size_t sum = 0;
|
size_t sum = 0;
|
||||||
|
|
||||||
sum += sizeof(struct pt_t);
|
sum += sizeof(struct pt_t);
|
||||||
|
|
||||||
if(pt->children != NULL) {
|
if(pt->children != NULL) {
|
||||||
// children array
|
// children array
|
||||||
sum += PT_CHILD_ARRAY_SIZE;
|
sum += PT_CHILD_ARRAY_SIZE;
|
||||||
@ -160,6 +160,7 @@ static errval_t spawn_serialize_pt(struct spawninfo *si, struct pt_t *pt, void *
|
|||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
return err_push(err, LIB_ERR_CAP_COPY_FAIL);
|
return err_push(err, LIB_ERR_CAP_COPY_FAIL);
|
||||||
}
|
}
|
||||||
|
pt_child->cap_pt.cnode = cnode_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!capref_is_null(pt->cap_mapping)) {
|
if(!capref_is_null(pt->cap_mapping)) {
|
||||||
@ -170,6 +171,7 @@ static errval_t spawn_serialize_pt(struct spawninfo *si, struct pt_t *pt, void *
|
|||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
return err_push(err, LIB_ERR_CAP_COPY_FAIL);
|
return err_push(err, LIB_ERR_CAP_COPY_FAIL);
|
||||||
}
|
}
|
||||||
|
pt_child->cap_mapping.cnode = cnode_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pt->children == NULL) {
|
if (pt->children == NULL) {
|
||||||
@ -213,7 +215,7 @@ static errval_t spawn_serialize_vspace(struct spawninfo *si, struct paging_state
|
|||||||
size_t pointer_space = 2 * sizeof(void *);
|
size_t pointer_space = 2 * sizeof(void *);
|
||||||
|
|
||||||
size_t total_space = pointer_space + pt_space + vaddr_space;
|
size_t total_space = pointer_space + pt_space + vaddr_space;
|
||||||
size_t reserve_space =
|
size_t reserve_space =
|
||||||
// additional structs for the vaddr allocation that is required
|
// additional structs for the vaddr allocation that is required
|
||||||
2 * sizeof(struct pt_vaddr_reg_t) +
|
2 * sizeof(struct pt_vaddr_reg_t) +
|
||||||
// space for potential l1,l2,l3 page tables
|
// space for potential l1,l2,l3 page tables
|
||||||
@ -380,6 +382,9 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
|||||||
if (err_is_fail(err)) return err;
|
if (err_is_fail(err)) return err;
|
||||||
|
|
||||||
// afeer: populate some capabilities
|
// afeer: populate some capabilities
|
||||||
|
err = cap_copy(si->cspace_cap_rootcn, si->cspace_l1_cnode_cap);
|
||||||
|
if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_COPY_FAIL);
|
||||||
|
|
||||||
err = slot_alloc(&si->dispatcher);
|
err = slot_alloc(&si->dispatcher);
|
||||||
if (err_is_fail(err)) return err_push(err, LIB_ERR_SLOT_ALLOC);
|
if (err_is_fail(err)) return err_push(err, LIB_ERR_SLOT_ALLOC);
|
||||||
|
|
||||||
@ -516,7 +521,7 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
|||||||
|
|
||||||
// afeer: put the arguments into the argspage
|
// afeer: put the arguments into the argspage
|
||||||
struct spawn_domain_params * domain_params = (struct spawn_domain_params *) arguments_page_in_self;
|
struct spawn_domain_params * domain_params = (struct spawn_domain_params *) arguments_page_in_self;
|
||||||
|
|
||||||
err = spawn_serialize_vspace(si, &child_paging_state, domain_params);
|
err = spawn_serialize_vspace(si, &child_paging_state, domain_params);
|
||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
return err_push(err, SPAWN_ERR_SERIALISE_VSPACE);
|
return err_push(err, SPAWN_ERR_SERIALISE_VSPACE);
|
||||||
@ -527,7 +532,7 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
|
|||||||
// domain_params->tls_init_len = 0;
|
// domain_params->tls_init_len = 0;
|
||||||
// domain_params->tls_total_len = 0;
|
// domain_params->tls_total_len = 0;
|
||||||
// domain_params->pagesize = BASE_PAGE_SIZE;
|
// domain_params->pagesize = BASE_PAGE_SIZE;
|
||||||
|
|
||||||
domain_params->argc = argc;
|
domain_params->argc = argc;
|
||||||
size_t offset = sizeof(struct spawn_domain_params);
|
size_t offset = sizeof(struct spawn_domain_params);
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user