|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
some quest about L4 concepts and marzipan It is said in L4 reference X.2 that sigma0 gives pages
to the kernel and to
arbitrary tasks, but only once. The idea is that all pagers request the memory they need in the startup phase of the system so that afterwards sigma0 has exhausted all its memory. Further requests will then automatically be denied. I want to know what is meant by "give" . Does it mean that if a task has request a region through L4_sigma0_getpage() call, then the region can not be requested by any other task? In the source code of resourcemon, I found that grab_all_memory() function had request all the memory from sigma0 throuth L4_sigma0_getany() call. However in member function vm_t::install_elf_binary(), the function L4_sigma0_getpage() was called again to remap client shared. According to what was said in L4 reference ,the region requested should have been exhausted, the remap procedure should fail. Is my opinion right? |
|
|
Re: some quest about L4 concepts and marzipanThe Sigma0_GetAny() function grabs arbitrary memory which is marked as
avaiable physical memory in sigma0. The Sigma0_GetPage() grabs memory from a particular location. This might be special I/O memory or other non-standard memory. Sigma0 will only hand out standard memory for GetAny requests, but will hand out any memory if the location is specified explicitly and it does not overlap with memory which has already been reserved. Here's a function that can be used in the rootserver to grab all memory in the system (including device memory): ================================================================ static void graballmem (void) { L4_Word_t next_addr[sizeof (L4_Word_t) * 8 + 2]; L4_Word_t addr = 0, sz = sizeof (L4_Word_t) * 8 - 1; L4_ThreadId_t s0 = L4_GlobalId (L4_ThreadIdUserBase (L4_GetKernelInterface ()), 1); // Ensure that loop below terminates when whole address space has // been requested. next_addr[sz+2] = ~0UL; next_addr[sz+1] = 0; // Explicitly request all memory (including device and other // special memory) from sigma0 using as large page sizes as // possible. while (sz < sizeof (L4_Word_t) * 8) { if (L4_IsNilFpage (L4_Sigma0_GetPage (s0, L4_FpageLog2 (addr, sz))) && sz > 12) { next_addr[sz] = addr + (1 << sz); sz--; continue; } else addr += (1 << sz); while (addr == next_addr[sz + 1]) sz++; } } ================================================================ It attempts to request memory using as large page sizes as possible, and decreses the page size if it fails to allocate a large page. It also has the advantage that it remaps the current code and data using as large page sizes as possible. That is, when the rootserver is started it requests memory from sigma0 via the pagefault protocol. However, this memory will be allocated using as small a page size as possible. The function above re-allocates the memory using larger page sizes. eSk |
| Free embeddable forum powered by Nabble | Forum Help |