作者:xueer2502938817_416 | 来源:互联网 | 2023-05-17 12:00
Iwanttosetarangeofmemoryasuncacheable(Linux,x86-86)fromwithinauser-spaceprocess.Thi
I want to set a range of memory as uncacheable (Linux, x86-86) from within a user-space process. This question comes close, but only mentions the MTRR registers which work with physical memory. I want to do this using the PAT tables as they offer finer-grained control, they allow virtual memory to be set uncacheable on a page-by-page basis.
我想在用户空间进程中将一系列内存设置为不可缓存(Linux,x86-86)。这个问题很接近,但只提到了与物理内存一起工作的MTRR寄存器。我想使用PAT表来实现这一点,因为它们提供了更细粒度的控制,它们允许虚拟内存在逐页的基础上设置为不可缓存。
The Linux documentation, Documentation/x86/pat.txt, suggests there should be something with mmap
and a SYNC
flag, but I can't find how to do this in practice. Ideally, I'd like to use a call such as mprotect(address, range, O_UNCACHABLE)
.
Linux文档,Documentation / x86 / pat.txt,建议应该有mmap和SYNC标志,但我在实践中找不到如何做到这一点。理想情况下,我想使用诸如mprotect(地址,范围,O_UNCACHABLE)之类的调用。
2 个解决方案