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.

Relevant Pages

  • Re: [Lit.] Buffer overruns
    ... > floating point support or a memory expansion option. ... had virtual memory support grafted on. ... > where the modified instruction was fetched from. ... vis-a-vis the official coporate strategic operating system TSS/360. ...
  • Re: mmap, the language go, problems with the linux kernel
    ... There popped up a serious problem by implementing a fast memory ... Maybe some experienced kernel hacker ... Suddenly the page allocation ... virtual memory lookup footprint. ...
  • Improved file handling mechanisms for 64-bit architectures
    ... in the new kernel version for 64-bit architectures. ... there is not enough physical memory, save the contents of the file to disk ... exception would occur and read a missing page (a missing portion of file). ... a remapping of virtual memory and the cooperation of file system is needed. ...
  • Re: NTFS - Kernel memory leak in driver for kernel 2.4.28?
    ... I should say that the malloc() succeeds, but the 16mb I need for the ... buffer are not available. ... memory tied up in the inode and dentry cache. ... kernel attempts to use for the dentry/inode cache, or make it much, ...
  • Re: sbrk(2) broken
    ... How could you hide it inside malloc? ... memory becomes available. ... granular indication from the kernel about how bad things are. ... we could cache vnodes and inodes less agressively, ...