Hi Folks,
I'm sorry to come with a so technical question, but I'm working out a port of XEN on ARM in the context of EmbeddedXEN project.
I digged into miniOS and found something which seems strange to me: the build_pagetable() function in mm.c.
This function aims at building up the additional page tables which were not allocated by the hypervisor during the
domain construction (domain_build.c). I do not understand the following calculation:
pfn_to_map = (start_info.nr_pt_frames - NOT_L1_FRAMES) * L1_PAGETABLE_ENTRIES;
pfn_to_map is supposed to be the first page frame number to be mapped by the function. However, the guest OS gets
a list of pfns (start_pfn - max_pfn, including the phys_to_machine table) assigned by the hypervisor, and the first pfns are supposed to contain the startup code and
initial page tables (L2-L1). In this calculation, NOT_L1_FRAMES are typically L2 (and L3,L4 eventually) page table frames. Then, going through the code
pfn_to_map is directly converted to the virtual address and mapped in the corresponding page tables. So, my problem is we do not consider
the L2,L3,L4 frames which are supposed to be in the same virtual address space of the guest OS.
I would expect something like pfn_to_map = *start_pfn + (start_info.nr_pt_frames - NOT_L1_FRAMES)*L1_PAGETABLE_ENTRIES.
Many thanks for any inputs.
Daniel