ChinaUnix.net
相关文章推荐:

linux mmap 创建 页表

根据ldd的说法,vmalloc得到是内核虚拟地址,书中对vmalloc 的地址mmap的方法是利用nopage每次建立一个页表。 如果我想对vmalloc得到的地址,使用remap_pfn_range一次全部建立页表,有无可能呢? 我的想法:逐页遍历vmalloc得到的虚拟地址,利用vmalloc_to_page,转化为page结构,然后将其转化为内核逻辑地址,再转化后逐一调用remap_pfn_range. 但是将page转化为内核逻辑地址,貌似只能用kmap,这个函数有“不要持有映射过长时间...

by tyrionlin - 驱动开发 - 2011-08-31 16:28:10 阅读(3774) 回复(2)

相关讨论

在ARM中一级页表有4096个目录项,用虚拟地址的高12位,再结合协处理器CP15的寄存器C2的高18位为基地址来索引一个目录项,一个目录项对应1M虚拟空间。 然而在看linux2.6.30内核源代码时发现一个奇怪的问题,为什么PGDIR_SHIFT定义为21,而不是20. 有如下定义:[code]#define PGDIR_SHIFT 21 #define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* to find an entry in a page-table-directory */ #define pgd_index(addr) ((addr) >> PGDI...

by bin_linux96 - Linux环境编程 - 2011-12-17 09:32:27 阅读(1754) 回复(0)

本帖最后由 linuxfellow 于 2012-02-17 10:36 编辑 Arm pte table前2K是linux 页表, 高2k是h/w页表, 这两个页表究竟是啥? 如何理解? /* * Allocate one PTE table. * * +--------------+ 0 * | linux pt 0 | * +--------------+ * | linux pt 1 | * +--------------+ 2048 * | h/w pt 0 | * +--------------+ * | h/w pt 1 | * +--------------+ */ From d30e45eeabefadc6039d7f876a59e5f5f6cb11c6 Mon Sep 17 ...

by linuxfellow - 内核源码 - 2012-02-17 13:41:08 阅读(2549) 回复(3)

一、自己画了个图,不知正确? 这是我的理解 注意 1.所有的物理内存要使用都要映射到内核空间 2.物理内存划分为页 3.页扩展机制,支持大于4G的物理内存,这时要用到三级分页(pgd 页全局目录Page Global Directory,pmd页中间目录 (Page Middle Directory),pte页表条目 (Page Table Entry)),不 需支持时,只需将 pmd 定义成“1”,返回两级分页机制 4.PAGE_OFFSET宏代表3G PAGE_SHIFT、PMD_SHIFT、PGD_SHIF...

by 罗克炬 - Linux文档专区 - 2008-12-20 19:09:23 阅读(1288) 回复(0)

mmap函数是unix/linux下的系统调用,来看《Unix Netword programming》卷二12.2节对mmap的介绍: The mmap function maps either a file or a Posix shared memory object into the address space of a process.We use this function for three purposes: 1. with a regular file to provide memory-mapped I/O 2. with special files to provide anonymous memory mappings 3. with shm_open to provide Posix shared memory be...

by embededgood - Linux文档专区 - 2009-07-12 14:17:00 阅读(561) 回复(0)

原文地址: http://blog.chinaunix.net/u1/33226/showart_499264.html 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/56723/showart_1010342.html

by zsfly - Linux文档专区 - 2008-06-24 16:35:41 阅读(613) 回复(0)

文件: mmap-skelon.rar 大小: 99KB 下载: 下载 // linux Device Driver Template/Skeleton with mmap // Kernel Module #include #include #include #include #include #include #include #include #include #include #include #include #include #if linux_VERSION_CODE #endif #define SKELETON_MAJOR 240 #define SKELETON_NAME "skeleton" #define CASE1 1 #define CASE2 2 static unsigned int counter = 0; ...

by panhuachun - Linux文档专区 - 2008-03-18 19:24:59 阅读(1075) 回复(0)

linux Device Drivers, 2nd Edition By Alessandro Rubini & Jonathan Corbet 2nd Edition June 2001 0-59600-008-1, Order Number: 0081 586 pages, $39.95 Chapter 13 mmap and DMA Contents: Memory Management in linux The mmap Device Operation The kiobuf Interface Direct Memory Access and Bus Mastering Backward Compatibility Quick Reference This chapter delves into the area of linux memory management, wi...

by pascal4123 - Linux文档专区 - 2006-09-20 14:52:48 阅读(931) 回复(0)

mmap   功能描述: mmap函数是unix/linux下的系统调用   mmap将一个文件或者其它对象映射进内存。文件被映射到多个页上,如果文件的大小不是所有页的大小之和,最后一个页不被使用的空间将会清零。munmap执行相反的操作,删除特定地址区域的对象映射。   基于文件的映射,在mmap和munmap执行过程的任何时刻,被映射文件的st_atime可能被更新。如果st_atime字段在前述的情况下没有得到更新,首次对映射区的第一个页索引...

by coolcoolrain - Linux文档专区 - 2010-01-15 23:45:59 阅读(626) 回复(0)

mmap   功能描述: mmap函数是unix/linux下的系统调用   mmap将一个文件或者其它对象映射进内存。文件被映射到多个页上,如果文件的大小不是所有页的大小之和,最后一个页不被使用的空间将会清零。munmap执行相反的操作,删除特定地址区域的对象映射。   基于文件的映射,在mmap和munmap执行过程的任何时刻,被映射文件的st_atime可能被更新。如果st_atime字段在前述的情况下没有得到更新,首次对映射区的第一个页索引...

by embededgood - Linux文档专区 - 2009-07-12 00:11:30 阅读(667) 回复(0)

struct page中有一个域为指针mapping ,它指向一个struct address_space类型结构。page cache或swap cache中的所有页面就是根据address_space结构以及一个偏移量来区分的。 文件与 address_space结构的对应:一个具体的文件在打开后,内核会在内存中为之建立一个struct inode结构,其中的i_mapping域指向一个address_space结构。这样,一个文件就对应一个address_space结构,一个 address_space与一个偏移量能够确定一个page cache...

by Elite - Linux文档专区 - 2007-01-28 22:45:10 阅读(587) 回复(0)