Mapping memory into process address space

Adam Lackorzynski adam at os.inf.tu-dresden.de
Thu Aug 21 23:14:25 CEST 2014


On Tue Aug 19, 2014 at 20:59:16 -0700, Noah Zentzis wrote:
> On 08/17/2014 12:55 AM, Adam Lackorzynski wrote:
> >So now I'm not sure how you want to proceed. Are your programs special
> >ones, i.e. that they are quite different from L4 programs or are they L4
> >programs? I wondering where to do the paging, however, in any case it
> >sounds to me like doing it in a different task would be good.
> >
> >To address your question:
> >You map the pager to the task with the dst_task->map() call as shown
> >above. The pager is probably a thread you implement, for doing your
> >work. The order does not really matter because the thread only starts
> >running until the run_thread call, i.e. it does not matter whether the
> >pager cap (any cap) is mapped before or after it has been registered
> >with the thread.
> 
> How would I configure the new task to use the same pager that the current
> task is? Looking at libloader, I'd think it would be something like:
> 
> task-map(L4Re::This_task, env->rm().fpage(), env->rm().snd_base());
> 
> but I'm not sure if I need to create a new region map or something like
> that. I think I've got memory mapping working, but the process dies with an
> unhandled read page fault.

Yes, you'd need to create a new region mapper for the new task, one that
knows about the virtual address space layout of that one. Should be
possible by using a new instance of Region_map as done in the
l4re_kernel. You'll also need to create an IPC-gate to be used as the
pager for the new task and which is routed to the Region_map instance
for that task. You also need to handle other events that come through
the pager channel, see Dispatcher::dispatch in
l4re_kernel/server/src/dispatcher.cc for the switch block.


Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/



More information about the l4-hackers mailing list