Some questions about pager

BERTRAND Joel joel.bertrand at
Wed Nov 24 17:20:03 CET 2010

	Thanks for your answer, Adam.

Adam Lackorzynski a écrit :
>> 	I suppose that faulty address in pagefault protocol is a virtual
>> address. A thread tries to access to a unmapped memory.
> Yes, the fault address is virtual.


>> 	In this pagefault function, I have to find a free memory page.
>> Thus, my function looks for small aligned page that contains
>> requested address. It looks for a free physical page, and sends a
>> mapitem message to faulty thread. My new code is available at:
>> 	I understand why faulty task sends a pagefault signal. I think my
>> mapitem answer is correct. But I don't understand how assign
>> physical page to virtual one.
> Actually, there aren't any physical addresses really. What's special is
> that sigma0 has identity mappings (only) and thus for sigma0 a virtual
> address is same as the corresponding physical address. The same is
> usually true for the roottask. Now if the app page-faults, the roottask
> gets this page-fault and needs to send some reasonable mapping back so
> that the app can continue. For that to work, roottask needs to have that
> memory available in its task. This mapping basically says map the memory
> at virtual address soandso in my task to that app at virtual address
> soandso there. Consequently you need a representation of all the client
> memory in your roottask, i.e. when you get a page-fault from a client
> you look up this address in some data structure to find the virtual
> address in roottask and map it to the app. Initially roottask is getting
> this memory from sigma0.

	I understand what you say but I think that I misunderstand some L4 

	Now, I have written a roottask that starts (or tries to start, it 
depends ;-) ) a new task (init.exe) in new address space. This task is 
loaded by bootloader and _physically_ mapped as it's mapped by roottask 
and sigma0.

	Problem : start init.exe address is outside physical memory and 
requires virtual memory mapping. Thus, I have written a very simple 
pagefault handler in roottask. When this thread starts, it sends a 
pagefault IPC to roottask.

	Pagefault handler knows required memory, but it needs to associate 
roottask's memory and I don't see how pagefault can return this memory.

	For example :
physical memory : 0 - 128 M
roottask starts at 16 M
init.exe starts at 512 M

	When init.exe starts, it sends a pagefault error to its pager (roottask):

	-> vms$pagefault(addr:200000b0) [priv=4]

and pager must reply with a mapitem message with the _same_ address. I 
understand that pager has to associate a memory region to virtual 
address required by init.exe. I know how find an available page to 
satisfy this request, but I don't know how associate this page to 
returned memory. Is there anywhere an example ? All pagers I have found 
only maps physical memory (iguana, darbat...).



More information about the l4-hackers mailing list