Sean
Sean

Reputation: 2771

How to use physical address in MOV instruction?

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

Answers (2)

rodrigo
rodrigo

Reputation: 98348

You should use the following functions instead of accessing the address directly (that might work, but it is definitely not portable):

  1. request_mem_region()
  2. ioremap()
  3. writeb()/writew()/writel() or readb()/readw()/readl()

Upvotes: 4

Neil
Neil

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

Related Questions