2017-12-01 11 views
1

私はLinuxカーネルを読んでいますが、私はMMU関連の部分に興味があります。Linuxカーネルmmu create_page_tables

__create_page_tables: 
    pgtbl x25, x26, x28   // idmap_pg_dir and swapper_pg_dir addresses 
    mov x27, lr 

    /* 
    * Invalidate the idmap and swapper page tables to avoid potential 
    * dirty cache lines being evicted. 
    */ 
    mov x0, x25 
    add x1, x26, #SWAPPER_DIR_SIZE 
    bl __inval_cache_range 

    /* 
    * Clear the idmap and swapper page tables. 
    */ 
    mov x0, x25 
    add x6, x26, #SWAPPER_DIR_SIZE 
    1: stp xzr, xzr, [x0], #16 
    stp xzr, xzr, [x0], #16 
    stp xzr, xzr, [x0], #16 
    stp xzr, xzr, [x0], #16 
    cmp x0, x6 
    b.lo 1b 

    ldr x7, =MM_MMUFLAGS 

    /* 
    * Create the identity mapping. 
    */ 
    **add x0, x25, #PAGE_SIZE  // section table address** 
    ldr x3, =KERNEL_START 
    add x3, x3, x28   // __pa(KERNEL_START) 
    create_pgd_entry x25, x0, x3, x5, x6 
    ldr x6, =KERNEL_END 
    mov x5, x3    // __pa(KERNEL_START) 
    add x6, x6, x28   // __pa(KERNEL_END) 
    create_block_map x0, x7, x3, x5, x6 

私はこのコードを理解していない:ARM64のCPUでは、以下のコードがある

add x0, x25, #PAGE_SIZE 

私の理解ではx25あるアドレスidmap_pg_dirであり、我々はPAGE_SIZEを追加する必要はありませんそれに。 PAGE_SIZEx25に追加するのはなぜですか?

答えて

0

create_pgd_entry関数は、 "add x0、x25、#PAGE_SIZE"の後にPGDにエントリを作成することです。x0は次のレベルのテーブルを指します。

2つの4KB @ idmap_pg_dir、最初の4KBはPGD、次の4KBは次のレベルのテーブルです。

注:PGDのエントリは1つだけ使用されます。