有什么方法可以在Ubuntu中使用缓存分配精确的物理内存地址?

发布于 01-24 11:19 字数 546 浏览 4 评论 0 原文

我想在物理内存位置中分配固定尺寸的缓冲区,该缓冲区在不同的运行中将完全相同。

void * getBuffer(size_t len,uintptr_t paddr);

分配 len 的缓冲区

因此,此函数 getBuffer(len,paddr)应在确切的物理地址 paddr 到目前为止 看到了使用DMA的基于“/dev/mem” this ,和其他人。 ( 如果我错了,请在此处纠正我。 ),

但我想确保从 getBuffer()访问内存访问()遵循常规CPU缓存模式。即,访问通过L1,L2和L3缓存,最后写入/读取内存。

请让我知道这是否可能。如果没有,还有其他方法可以访问固定的物理地址吗?随时分享!

I want to allocate a fixed sized buffer in a physical memory location that would be exactly same across different runs.

void * getBuffer(size_t len, uintptr_t paddr);

So this function getBuffer(len,paddr) should allocate a buffer of len at the exact physical address paddr

So far I have seen the usage of "/dev/mem" based memory allocation that uses DMA, but this does not follow the cache access pattern according to this, this and others. (Please correct me here if I am wrong.)

But I want make sure that the memory access from the getBuffer() follows regular CPU cache patterns. i.e, the access is goes through L1, L2 and L3 cache and finally write/reads the memory.

Please let me know if this is possible. If not, is there any other way of accessing a fixed physical address? Feel free to share!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文