Physical to virtual memory address translation

I was wondering if anyone know of an easy way of translating a physical
address to virtual address.

The physical address is within some dma safe memory allocated with mmap*().
I know the virtual and physical base address when mmap*() is called. But
because of the architecture of the driver code the physical address is only
known at a later time. I know I can save the virtual and physical base
address and then use those two for converting into the virtual address, but
is there an easier way - similar to mem_offset() - just the other way?

Thanks
Jens

Jens H Jorgensen <jhj@remove-nospam-videk.com> wrote:

I was wondering if anyone know of an easy way of translating a physical
address to virtual address.

Sorry, there’s no way aside from the obvious one of running through
all your virtual address doing mem_offset()'s and finding one that
matches.

\

Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

Thanks

<bstecher@qnx.com> wrote in message news:bdhbjq$pbs$1@nntp.qnx.com

Jens H Jorgensen <> jhj@remove-nospam-videk.com> > wrote:
I was wondering if anyone know of an easy way of translating a physical
address to virtual address.

Sorry, there’s no way aside from the obvious one of running through
all your virtual address doing mem_offset()'s and finding one that
matches.

\

Brian Stecher (> bstecher@qnx.com> ) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M
1W8