我想在物理内存位置中分配固定尺寸的缓冲区,该缓冲区在不同的运行中将完全相同。
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!
发布评论