English 中文(简体)
限制内核内核用“ 乳” 环境变量能够管理的物理内存量
原标题:Limiting how much physical memory the kernel can manage with the "mem" environment variable

I ve inherited supporting some linux kernel drivers (in which my experience is very limited). My question is as follows. It s an embedded environment and the hardware has 512MB of physical memory. However, the boot parameters that are passed to the kernel limits the memory to 256MB by using the variable linuxMem=mem=256M. In my research of this environment variable, I am of the understanding that this limits the amount of memory that the kernel can manage to 256MB. Yet in some application code that runs on my target, I see an open of /dev/mem and a subsequent mmap of the returned file descriptor and the offset parameter of the mmap call is in the upper 256MB of physical memory. And things seem to be working fine. So my question is "why does it work if the kernel supposedly does not know about the upper 256MB?"

问题回答

严格地说,Mem=256M是一个内核参数,不是环境变量。该参数只告诉内核使用这么多内存,但不会使系统完全看不见机器安装的物理芯片。它可用于模拟物理内存比实际可用的少的系统,但并不完全等同于打开你的盒子并拉出一个内存芯片。

查看 < a href=> http://www.mjmwired.net/内核/Documentation/cernel-paraters.txt#1578" rel=“nofollow” > 这个参数 的文档, 您可以清楚地看到, 某些情况下可以使用范围有限的地址, 这就是为什么他们建议在某些情况下也使用 < code> memmmap/code> 。 因此, 您无法为您的应用程序分配超过极限的内存, 但是您可以查看一些物理地址中发现的内容, 似乎有些设备驱动器可以使用这种可能性 。

mmap () 返回虚拟地址, 而不是物理地址 。

设备只有64MB的内存和 mmap () 绘制约1GB的地图是完全可能的。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签