2012年(366)
分类: 系统运维
2012-04-05 21:40:25
Linux Virtual Memory Layout
Wtual Memory Spice Purpose
FFJf8000 .FFFFFFFF |
copy_user_page / clear_user_page use |
FFFFI000 - FFFF7FFF |
Reserved. P’atforms must not e this address raige. |
FFFF0000 - FFFFOFFF |
Cpu vector |
FFC00000 - FFFEFFFF |
DMA memory mapping region. |
FF000000- FFBFFFFF |
— Reserved fcw future expansion & DMA mappil reØon |
VMALLOC_END. FEFFFFFF |
Free for platform usee, recommended. |
VMALLOC_START - YMALLOC_END -1. |
vmalloco/ loremap() space |
PAGE_OFFSET - VMALLOC_START -1 |
Kernel direct-mped RAM region |
TASK_SIZE - FGE_0FFSET .1 |
Kernel modie space |
0000i000 - TASK_SIZE -i |
User space mappings |
00000000 - 00000FFF |
Cpu vector page / null pointer trAP |
66 |
几个重要的 分界线 |
See linuy./incluc/asrn.arm/memo,yh for following definitions
deflne TASK_SIZE (Oxbt000000UL)
#detlne PAGE_OFFSET (Oxc0000000UL)
#define VMAI.LOC_START (((unsigned Iong)hii_memory + VMALLOC_OFFSET) & -(lMALLOC_OFFSET-i))
#define VMAU.OC_END (OxE0000000)
66 总结pdf from 读后感 |
• The virtual address space of Linux is divided into two parts Ox00000000 to PAGE_OFFSET-i can be for process user space. PAGE_OFFSET to Oxifififif can be addressed only In kernel mode, PAGE_OFFSF1 Is usually Oxc00000000
•ln kernel mode, Linux Physical RAM address have a constant offset to virtual address, the constant is PAGE_OFFSET PHYS_OFFSET. •Linux Kernel spIel physical memory into page, page size usually 4KB size, Linux physical memory management Is Page-based. •The boot-time allocator is kernel boot-time page allocator, It allocate physical contiguous page. Boot- time allocator is destroyed when buddy system initialized.
•The buddy system the kernel core page allocator. it allocate physical conteguoLs page •The slab system Is a cached object pro-allocated system, slab call buddy page allocator to buikng a slab, a slab Is one or more physical contiguous page , contain many pro-allocated objects. Kmalloc return object in physical contiguous addrres •vmalloc is usefull when need virtual contiguous page only. •loremap Is not allocator, It only map specIal physical address to a virtual address, usually for I/O registers. You should access the address wIth wrlteb/readb/wrltew/readw. |