[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] idle_pg_tables??



In the paging mechanism of XEN what is the role of the variable 'idle_pg_table*' variables ??

For a 4-levels paging system these variables are defined in x86_64.S and partially initialised.
Here is the code, copied from x86_64.S:

__________________________________________________
...

/* Initial PML4 -- level-4 page table. */
       .org 0x2000
ENTRY(idle_pg_table)
ENTRY(idle_pg_table_4)
       .quad idle_pg_table_l3 - __PAGE_OFFSET + 7 # PML4[0]
       .fill 261,8,0
       .quad idle_pg_table_l3 - __PAGE_OFFSET + 7 # PML4[262]

/* Initial PDP -- level-3 page table. */
       .org 0x3000
ENTRY(idle_pg_table_l3)
       .quad idle_pg_table_l2 - __PAGE_OFFSET + 7

/* Initial PDE -- level-2 page table. Maps first 64MB physical memory. */
       .org 0x4000
ENTRY(idle_pg_table_l2)
       .macro identmap from=0, count=32
       .if \count-1
       identmap "(\from+0)","(\count/2)"
       identmap "(\from+(0x200000*(\count/2)))","(\count/2)"
       .else
       .quad 0x00000000000001e3 + \from
       .endif
       .endm
       identmap

       .org 0x4000 + PAGE_SIZE
       .code64

.section ".bss.stack_aligned","w"
ENTRY(cpu0_stack)
       .fill STACK_SIZE,1,0
______________________________________________________
trying to understand that:

- idle_pg_table_l4 is the same as idle_pg_table and contains 263 enties, all zeroed but two (identical) ones. These two pointers point somewhere close to idle_pg_table_l3. Why are there two identical pointers and why shift them by __PAGE_OFFSET +7?

- idle_pg_table_l3 is located between 0x3000 and 0x4000 , with only the first slot initialised. The later points to
level 2 table with some offset.

- idle_pg_table_l2 has terrible code with a recursive macro, who expands into 63 quad constants. It is unclear to me why this complicated macro?? I would have put a table of constants pretty simply... Every entry in that l2 table points to a fixed address, at intervals of 4K (a page).l2 tables are located between 0x01E3 to 0x03E001E3 in groups. Every group is apparently a set of 4 page tables and each table has a size of 128K. Groups are separated by approx 256MB.
Why are these spacings and groups?

- idle_pg_table_l1 is not an entry and so l1 tables are not allocated. Why?

thanks for help!

Armand


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.