Re: how to get physical memory address from virtual memory address

"David Schwartz" <davids@xxxxxxxxxxxxx> wrote:
Hari wrote:
Hi ,

I am using Linux 2.4.20 Kernel. I am runing an application which will
malloc and returns a virtual memory address. I need to get the physical
memory address for that virtual memory address. How can I get that?

There isn't one. You haven't allocated any physical memory, so the
kernel doesn't give you any.

What?? This is entirely incorrect. EVERY valid virtual address has an
associated physical address. In the case of malloc-ed memory, that
physical address will be in physical memory.

Addressing the OP, while you are in user mode, the physical address can
change at any time. The only reliable way to get the physical address is
within a kernel driver.
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.