Mapping memory into process address space

Björn Döbel doebel at os.inf.tu-dresden.de
Fri Aug 15 08:06:59 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> 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");

env->mem_alloc() only gives you the memory allocator. You will have to
call env->mem_alloc().alloc() to actually allocate a dataspace. I'm
afraid your call hangs, because L4Re tries to translate the .fpage()
call into an IPC to the memory allocator, which does not reply because
it is no idea what you want from it.

Also, do not call the allocator twice within the function call,
because then you would obtain two different dataspaces and this is not
what you want here. Better do

L4:Cap<Dataspace> x = L4Re::Util::cap_alloc.alloc<L4::Dataspace>();
long alloc = L4Re::Env::env()->mem_alloc.alloc(size, x);
if (!x.is_valid()) {
  // handle error
}

> Do I need to set up the UTCB beforehand or do some other kind of
> setup before mapping capabilities?

No.

Bjoern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlPto38ACgkQP5ijxgQLUNnlFACaAgHjF0rmKLui9AXSq/x8/wEe
LTcAoJwcRLJ5Pd4eFkXyTmo36nnSJAcE
=j7xc
-----END PGP SIGNATURE-----




More information about the l4-hackers mailing list