Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想访问物理地址0xfee00020,这是 APIC 寄存器的内存映射的位置。我想使用“ MOV”指令读取或写入数据到这个位置。我应该先进行物理到虚拟地址的转换吗?应该如何在内联汇编中编写代码片段?
0xfee00020
MOV
谢谢。
您应该使用以下函数而不是直接访问地址(这可能有效,但绝对不可移植):
request_mem_region()
ioremap()
writeb()/writew()/writel()
readb()/readw()/readl()
是的,您需要先对地址进行物理到虚拟地址的转换,通常使用 ioremap,然后才能使用它。在某些平台上,您可以直接使用 ioremap 的返回值作为指向您要访问的内存的指针。