嫉妒小姑子有孩子:由 cat /proc/iomem 所学到的
来源:百度文库 编辑:偶看新闻 时间:2024/04/28 08:44:48
1)cat /proc/iomem看到的内容:IO memory空间的地址资源分配情况,以树状结构显示。request_mem_regionioremap2)cat /proc/ioports看到的内容IO port空间的地址资源分配情况,以树状结构显示。[源于x86平台的设计思想,目前基本不用了]request_regionioremap # define __iomem __attribute__((noderef, address_space(2)))void __iomem *fpga_vbase; __iomem是linux2.6.9内核中加入的特性。是用来个表示指针是指向一个I/O的内存空间。主要是为了驱动程序的通用性考虑。由于不同的CPU体系结构对I/O空间的表示可能不同。当使用__iomem时,编译器会忽略对变量的检查(因为用的是void __iomem)。若要对它进行检查,当__iomem的指针和正常的指针混用时,就会发出一些警告。 include/linux/compiler.h , make C=1 时会有检查,C=0
则无任何作用。
$ grep -RIn 'define __iomem' include/linux
#ifdef __CHECKER__
# define __user __attribute__((noderef, address_space(1)))
# define __kernel /* default address space */
# define __safe __attribute__((safe))
# define __force __attribute__((force))
# define __nocast __attribute__((nocast))
# define __iomem __attribute__((noderef, address_space(2)))
# define __acquires(x) __attribute__((context(0,1)))
# define __releases(x) __attribute__((context(1,0)))
# define __acquire(x) __context__(1)
# define __release(x) __context__(-1)
# define __cond_lock(x) ((x) ? ({ __context__(1); 1; }) : 0)
extern void __chk_user_ptr(void __user *);
extern void __chk_io_ptr(void __iomem *);
#else
# define __user
# define __kernel
# define __safe
# define __force
# define __nocast
# define __iomem
# define __chk_user_ptr(x) (void)0
# define __chk_io_ptr(x) (void)0
# define __builtin_warning(x, y...) (1)
# define __acquires(x)
# define __releases(x)
# define __acquire(x) (void)0
# define __release(x) (void)0
# define __cond_lock(x) (x)
#endif 概念性的东西:
参考:linux/kernel/resource.cinclude/linux/Ioport.h
则无任何作用。
$ grep -RIn 'define __iomem' include/linux
#ifdef __CHECKER__
# define __user __attribute__((noderef, address_space(1)))
# define __kernel /* default address space */
# define __safe __attribute__((safe))
# define __force __attribute__((force))
# define __nocast __attribute__((nocast))
# define __iomem __attribute__((noderef, address_space(2)))
# define __acquires(x) __attribute__((context(0,1)))
# define __releases(x) __attribute__((context(1,0)))
# define __acquire(x) __context__(1)
# define __release(x) __context__(-1)
# define __cond_lock(x) ((x) ? ({ __context__(1); 1; }) : 0)
extern void __chk_user_ptr(void __user *);
extern void __chk_io_ptr(void __iomem *);
#else
# define __user
# define __kernel
# define __safe
# define __force
# define __nocast
# define __iomem
# define __chk_user_ptr(x) (void)0
# define __chk_io_ptr(x) (void)0
# define __builtin_warning(x, y...) (1)
# define __acquires(x)
# define __releases(x)
# define __acquire(x) (void)0
# define __release(x) (void)0
# define __cond_lock(x) (x)
#endif 概念性的东西:
几乎每一种外设都是通过读写设备上的寄存器来进行的。外设寄存器也称为“I/O端口”,通常包括:控制寄存器、状态寄存器和数据寄存器三大类,而且一个外设的寄存器通常被连续地编址。CPU对外设IO端口物理地址的编址方式有两种:一种是I/O映射方式(I/O-mapped),另一种是内存映射方式(Memory-mapped)。而具体采用哪一种则取决于CPU的体系结构。
有些体系结构的CPU(如,PowerPC、m68k等)通常只实现一个物理地址空间(RAM)。在这种情况下,外设I/O端口的物理地址就被映射到CPU的单一物理地址空间中,而成为内存的一部分。此时,CPU可象访问一个内存单元那样访问外设I/O端口,而无需设立专门的外设I/O指令。这就是所谓的“内存映射方式”(Memory-mapped)。
而另外一些体系结构的CPU(典型地如X86)则为外设专门实现了一个单独地地址空间,称为“I/O地址空间”或“I/O端口空间”。这是个和CPU地RAM物理地址空间不同的地址空间,任何外设的I/O端口均在这一空间中进行编址。CPU通过设立专门的I/O指令(如X86的IN和OUT指令)来访问这一空间中的地址单元(也即I/O端口)。这就是所谓的“I/O映射方式”(I/O-mapped)。和RAM物理地址空间相比,I/O地址空间通常都比较小,如x86 CPU的I/O空间就只有64KB(0-0xffff)。这是“I/O映射方式”的一个主要缺点。 Linux设计了一个通用的数据结构resource来描述各种I/O资源(如:I/O端口、外设内存、DMA和IRQ等)。该结构定义在include/linux/ioport.h头文件中。Linux是以一种倒置的树形结构来管理每一类I/O资源(如:I/O端口、外设内存、DMA和IRQ)的。每一类I/O资源都对应有一颗倒置的资源树,树中的每一个节点都是个resource结构,而树的根结点root则描述了该类资源的整个资源空间。 基于上述这个思想,Linux将基于I/O映射方式的I/O端口和基于内存映射方式的I/O端口资源统称为“I/O区域”(I/O Region)。参考:linux/kernel/resource.cinclude/linux/Ioport.h
什么是/proc
proC多行查询
Out-of-proc是什么意思(计算机)
/proc文件系统的作用
小猫cat 瞄瞄瞄,cat、cat是小猫
nvsaml.cat
BLACK CAT
hp1kw2k.cat
alcxwdm.cat
CAT.#是?
CAT是什么意思
delphi中proc( )的含义是什么
proc near 和proc far 分别是什么时候用哪一个啊?
CAT 5 是什么意思? quota cat 是什么意思?
请问考研数学的一二三四是由所学专业决定的吗?如果是的话,什么样的专业学数一、二、三或四呢
启动MSN 然后出现self proc Write NewWrite error是什么意思?
SAS proc score 是做什么用的
Mouse and cat
cat文件是什么格式?
怎么下载hiddev.cat
Balck Ange Evil Cat
CAT外贸的市场价
什么是net cat?
怎样清洗CAT鞋