I’m new to seL4 but am struggling with transferring caps from the root task to a process created with sel4utils_spawn_process_v. Initially the process(es) should get the endpoint of the root task and that is working well. Now, I would like to add the possibility for a process to request an IPC endpoint from the root-task, so I’d call the root-task which allocates a new endpoint and transfers it back by reply:
// child
seL4_SetCapReceivePath(CSPACE, RECV_CAP, CDEPTH);
seL4_MessageInfo_t ret = seL4_Call(parent_ep, msg);
seL4_Uint64 extra_caps = seL4_MessageInfo_get_extraCaps(ret);
but what should CSPACE
be? There is no such thing as the boot-info, hm should I add more arguments to the process? Then the root task:
// root
vka_alloc_endpoint(&vka, &app_ep);
cspacepath_t ep_cap_path;
vka_cspace_make_path(&vka, app_ep.cptr, &ep_cap_path);
seL4_CPtr new_ep_cap = sel4utils_mint_cap_to_process(pcb, ep_cap_path,
seL4_AllRights, APP_BADGE);
seL4_MessageInfo_t info = seL4_MessageInfo_new(0, 0, 1, 1);
seL4_SetCap(0, new_ep_cap);
seL4_SetMR(0, 0x2E2E2E2E);
seL4_Reply(info);
(full code main.c and app.c which can both be used within the dynamic-3 build-context of the tutorials)
However on the client extra caps are not set. I tried many different ways, also with sel4utils_copy_cap_to_process
. But I am not sure I understand most of it nor with how to proceed, also what are the pcb->thread.ipc_buffer
?
Can someone help me with finding a working, clean solution for spawning process(es) that may ask for their IPC? And why is my code not transferring at least the caps?
Also: Once the child dies, I’d assume the root-task needs to do some cleanup (eg. that cspace path allocated). Is this managed by the process abstraction or (if not) what are the necessary steps?
I’m sorry for all those questions, there’s a lot of new parts and I cannot find many resources (or even code examples, the ipc tutorial or refos does not make use of the sel4utils processes - should I even use them?).