arch/x86/mm/pgtable.c

GFP means Get Free Page

GFP bitmasks are at include/linux/gfp.h
This file has clear description for each kind of flags.


Some important Macros

#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)

  • The virt_to_page(addr) macro yields the address of the page descriptor associated with the linear address addr .
  • The pfn_to_page(pfn) macro yields the address of the page descriptor associated with the page frame having number pfn .
  • #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET)) ,#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
  • #define __pa(x) __phys_addr((unsigned long)(x))
  • The structure of page descriptor is at include/linux/mm_types.h

arch/x86/include/asm/pgtable_64_types.h

#define SHARED_KERNEL_PMD 0

//PGDIR_SHIFT determines what a top-level page table entry can map
#define PGDIR_SHIFT 39
#define PTRS_PER_PGD 512

//3rd level page
#define PUD_SHIFT 30
#define PTRS_PER_PUD 512

//PMD_SHIFT determines the size of the area a middle-level page table can map
#define PMD_SHIFT 21
#define PTRS_PER_PMD 512

//entries per page directory level
#define PTRS_PER_PTE 512

/* See Documentation/x86/x86_64/mm.txt for a description of the memory map. */
#define MAXMEM      _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL)
#define VMALLOC_SIZE_TB _AC(32, UL)
#define __VMALLOC_BASE  _AC(0xffffc90000000000, UL)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值