Question about memory management in L4 Fiasco O.C + L4re
adam at os.inf.tu-dresden.de
Mon Dec 14 00:36:29 CET 2015
On Fri Dec 11, 2015 at 16:49:06 +0100, Mahdi Aichouch wrote:
> I tried to find where the code, data and stack segments of L4 tasks are
> loaded into physical memory by moe.
> I instrumented the code of "pkg/libloader/include/elf" and
> "pkg/l4re_kernel/server/src/loader.c" programs by using the "phys( )"
> method of Dataspace object in order to know the physical addresses, as
> shown in the code snippet below.
> I tested the hello example, by running 4 instances of the hello program.
> The problem is that I was unable to get the physical addresses, all the
> addresses seem to be virtual, as shown in the logs below.
> Could you please tell me what is wrong in my investigation, what is the
> right way to obtain the physical memory addresses of an L4 user programs.
In your code, you should check the return values when calling the phys()
phys() will only work for memory that has been created 'pinned' meaning
that this memory can not be moved around. Memory for programs is
(typically) not allocated with this attribute and thus phys will not
work here. If you just want to know the physical address of a virtual
address once, you should do this via jdb: press 's', move cursor to the
task in question, press 'p' which gives you the page-table view. In that
view you can explore the page table of the task you selected. On the
last level you'll see the physical frame number.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers