Mapping memory into process address space
Noah Zentzis
nzentzis at pdx.edu
Fri Aug 15 03:33:33 CEST 2014
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
More information about the l4-hackers
mailing list