针对ARM Linux内核swapper_pg_dir简单分析

在分析ARM Linux内核的内存管理的时候不小心考到了System.map有个特别的地方:

0000000c A cpu_arm926_suspend_size
c0004000 A swapper_pg_dir
c0008000 T _text
c0008000 T stext
c0008050 t __create_page_tables
c0008104 t __turn_mmu_on_loc
c0008110 t __enable_mmu
c0008140 t __fixup_pv_table
c0008180 t __vet_atags
c0008400 T __exception_text_start
c0008400 T _stext

在arch/arm/kernel/head.S有其中的定义:

#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
#if (KERNEL_RAM_VADDR & 0xffff) != 0x8000
#error KERNEL_RAM_VADDR must start at 0xXXXX8000
#endif


#ifdef CONFIG_ARM_LPAE
/* LPAE requires an additional page for the PGD */
#define PG_DIR_SIZE 0x5000
#define PMD_ORDER 3
#else
#define PG_DIR_SIZE 0x4000
#define PMD_ORDER 2
#endif


.globl swapper_pg_dir
.equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE


.macro pgtbl, rd, phys
add \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE
.endm


swapper_pg_dir涉及到很多内容,主要是用来设置内核系统页目录。


你可能感兴趣的:(内核,swapper_pg_dir)