Re: Mapping memory into process address space

Noah Zentzis <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
On 08/14/2014 03:01 PM, Adam Lackorzynski wrote:
> Typical arguments for L4::Task::map for memory are (omitting cache
> attributes etc.):
>     l4_msgtag_t t;
>     t = dst_task->map(src_task,
>                       l4_fpage(src_address, L4_PAGESHIFT, L4_FPAGE_RWX),
>                       dst_address);
>     if (l4_error(t))
>       printf("error: %d\n", l4_error(t));
> For L4::task::map you do not need any cooperation from dst_task. Mapping
> caps works similarly:
>     t = dst_task->map(src_task,
>                       l4_obj_fpage(src_cap, 0, L4_FPAGE_RW),
>                       l4_map_obj_control(dst_cap, L4_MAP_ITEM_MAP));
>
> When a programs runs it will also generate pagefault IPCs to the pager
> which must be replied with the proper mapper. For that the pager cap
> must be setup in the target, with a task->map call.

I might be missing a step when setting up my task, but trying to map 
capabilities in the same way that libloader does seems to cause the 
parent process to freeze:

printf("This message is printed\n");
task->map(L4Re::This_task, env->mem_alloc().fpage(),
	env->mem_alloc().snd_base());
printf("This message is never printed\n");

Do I need to set up the UTCB beforehand or do some other kind of setup 
before mapping capabilities? I see the prog_attach_utcb_area() function 
in libloader, but can't figure out how it ever gets called or whether I 
actually need to do so. Also, libloader's start_prog() function seems to 
perform the mapping immediately after creating the task and thread, so 
I'm confused about why L4::Task::map() keeps freezing the parent process.

- Noah Zentzis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.