如何在内核中分配不可缓存的物理内存?
如果要分配不可缓存的物理内存(DRAM)供驱动程序使用, (即,不希望数据被缓存到CPU的数据缓存中 数据被访问)我该怎么做?
有像 kmalloc()、get_free_pages、vmalloc 等函数, 但似乎我无法指定数据是否可以缓存或不使用这些函数? 关于如何做有什么建议吗?
谢谢!
if want to allocate non-cacheable physical memory (DRAM) for usage in the driver,
(ie. don't want the data being cached into the CPU's data cache when
the data are accessed) how could I do this?
there are functions like kmalloc(), get_free_pages, vmalloc, etc,
but seems like that I can't specify if the data can be cached or not using these functions?
any suggestion on how to do it?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之,没有简单的方法可以做到这一点,它非常依赖于平台。
如果您想尝试一下,请阅读 drivers/char/mem.c 和《Linux 设备驱动程序第三版》一书的第 15 章。
In short there is no easy way to do this, it is very platform dependent.
If you want a go at it read drivers/char/mem.c and Chapter 15 of the Linux Device Drivers 3rd Edition book.