From mboxrd@z Thu Jan 1 00:00:00 1970 From: PUCCETTI Armand Subject: idle_pg_tables?? Date: Fri, 01 Sep 2006 18:10:48 +0200 Message-ID: <44F85B88.4060704@cea.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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