Reputation: 2771
I want to access physical address 0xfee00020
, which is a location of memory map of APIC registers. I want to read or write data to this location using the "MOV
" instruction. Should I do physical to virtual address translation first? How should write a code piece in inline assembly?
Thanks.
Upvotes: 1
Views: 720
Reputation: 98348
You should use the following functions instead of accessing the address directly (that might work, but it is definitely not portable):
request_mem_region()
ioremap()
writeb()/writew()/writel()
or readb()/readw()/readl()
Upvotes: 4
Reputation: 55392
Yes, you need to do physical to virtual address translation, typically using ioremap, on the address before you can use it. On some platforms, you can then get away with using the return value from ioremap directly as a pointer to the memory you want to access.
Upvotes: 3