Memory management, mapping, paging questions...
First hello everybody,
Currently I play with Xen (2.0.7), especially I want to know more about the memory management. What I understood is that at start-of-day, in the start_info structure, we have the following information:
nr_pages = Number of machine pages provided for the virtual machine. Represents
the amount of memory specified in the configuration file (nr_pages * 4096).pt_base = The virtual address of the page directory.nr_pt_frames = Number of page tables created for the VM by Xen mfn_list = List of machine adresses.
So my questions are the following :
* pt_base is the virtual adress of the pd. But what means virtual here ? in which adress space does this adress has the right meaning ?
* Does Xen create the page tables (I do not include the pd in page tables, I think it is more understable like this, i.e. pd != pt) ? Where are these pt? their address ?
* mfn_list : is this a list, starting at adress mfn_list, that contains all the machine adresses of all machine pages allocated for our VM ? i.e. the following code print all the machine page adresses :
for (i = 0; i < nr_pages; i++)
printf("page %d at %x\n", i, ((unsigned long *)mfn_list)[i]);* If I want to map at identical (machine or physical adress == virtual address), how can I do ?
Thanks.
--
Nicolas CLERMONT
Xen player
At Tue, 24 Oct 2006 17:11:37 +0200,
Quoted 2 lines · [email protected] wrote:
Currently I play with Xen (2.0.7), especially I want to know more about the memory management.
I hope I can answer your questions, but I've only used Xen 3/unstable and I am also not one of the Xen experts (correct me if I'm wrong, please!)
Quoted 5 lines
So my questions are the following :
*
pt_baseis the virtual adress of the pd. But what means virtual here ? in which adress space does this adress has the right meaning ?
Xen has setup an address space which the guest domain starts in, so pt_base is simply the virtual address of the page directory.
Quoted 3 lines
* Does Xen create the page tables (I do not include the pd in page tables, I think it is more understable like this, i.e. pd != pt) ? Where are these pt? their address ?
You can always traverse the page directory page to find this out.
Quoted 2 lines
*
mfn_list: is this a list, starting at adressmfn_list, that contains all the machine adresses of all machine pages allocated for our VM ?
Yes, it stores the machine page frame numbers and it's used to translate physical addresses to machine addresses. I.e., something like
unsigned long phys_to_machine(unsigned long phys)
{
unsigned long machine = mfn_list[phys >> 12];
machine = (machine << 12) | (phys & (unsigned long)~4095);
return machine;
}Mapping pages work basically as on real hardware except that you have to translate physical addresses to machine addresses before entering them into the page table.
// Simon