understanding __linear_l2_table and friends
I was trying to understand the states behind domain creation, but i'm having troubles getting past this. Would someone mind saying a few words about what these are and (if still needed) why these calculations work for that?
xen/include/asm-x86/page.h:
#define linear_l1_table \
((l1_pgentry_t *)(LINEAR_PT_VIRT_START))
#define __linear_l2_table \
((l2_pgentry_t *)(LINEAR_PT_VIRT_START + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0))))
#define __linear_l3_table \
((l3_pgentry_t *)(LINEAR_PT_VIRT_START + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0)) + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<1))))
#define __linear_l4_table \
((l4_pgentry_t *)(LINEAR_PT_VIRT_START + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0)) + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<1)) + \
(LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<2))))Thanks!
sRp
Signature · 1 line
Scott Parish
They aren't actually used during domain building, but anyway: Xen uses the common trick whereby each page directory maps itself. This means that every page-table entry is mapped into the address space at some virtual address. In fact, page directory entries (and PML3 and PML4 entries on x86/64) are also directly accessible in the virtual address space. The macros below are expressions that evaluate to the correct virtual addresses.
-- Keir
Quoted 32 lines
I was trying to understand the states behind domain creation, but i'm having troubles getting past this. Would someone mind saying a few words about what these are and (if still needed) why these calculations work for that?
xen/include/asm-x86/page.h:#define linear_l1_table \ ((l1_pgentry_t *)(LINEAR_PT_VIRT_START)) #define __linear_l2_table \ ((l2_pgentry_t *)(LINEAR_PT_VIRT_START + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0)))) #define __linear_l3_table \ ((l3_pgentry_t *)(LINEAR_PT_VIRT_START + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0)) + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<1)))) #define __linear_l4_table \ ((l4_pgentry_t *)(LINEAR_PT_VIRT_START + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<0)) + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<1)) + \ (LINEAR_PT_VIRT_START >> (PAGETABLE_ORDER<<2))))Thanks!
sRpSignature · 6 lines
Scott Parish _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel
Quoted 1 line · Keir Fraser
They aren't actually used during domain building,
Used anywhere else? Especially __linear_l2_table and __linear_l3_table?
Quoted 3 lines
Xen uses the common trick whereby each page directory maps itself. This means that every page-table entry is mapped into the address space at some virtual address.
Well, in PAE mode that trick doesn't fully work. It will do fine for the l1 tables, I think also for l2, but certainly not for l3 due to address space constrains ...
Gerd
Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)
Quoted 3 lines · Keir Fraser
Xen uses the common trick whereby each page directory maps itself. This means that every page-table entry is mapped into the address space at some virtual address.
So this is the same as netbsd's recursive page table stuff.
Thanks for the explanation
sRp
Signature · 1 line
Scott Parish