VMA of processes and CPU registers

limp johnkyr83 at hotmail.com
Wed Apr 20 07:01:08 EDT 2011


Thanks a lot Dace and Vladimir for your replies.

First of all, I forgot to mention that I am talking for x86 architecture.

> The CPU registers will contain the virtual addresses. Each and every
> time that the CPU tries to access a virtual memory location, then the
> address will be translated by the MMU into a physical address.

So, AFAIU the translation to physical memory takes place *only* when the ALU
of the processor has to do some operation which has memory operands (in
this case the CPU needs to deal with the *real* addresses) but not prior to
that.

Now if, for example, EIP has the value of 0xB71B13E8 and I know that on
B70CC000-B71B7000 the libX11.so is linked, then the IP points to the 0xE53E8
(0xB71B13E8 - B70CC000) offset of libX11.so? Is that right?

Thanks again for all the useful help.

John K.


-----Original Message-----
From: Dave Hylands [mailto:dhylands at gmail.com] 
Sent: Wednesday, April 20, 2011 12:20 AM
To: limp
Cc: kernelnewbies at kernelnewbies.org
Subject: Re: VMA of processes and CPU registers

Hi John,

On Tue, Apr 19, 2011 at 3:56 PM, limp <johnkyr83 at hotmail.com> wrote:
> Hi all,
>
> I know that each user processes has a number of virtual memory areas (VMA)
> which consist its (virtual memory) address space. For example cat
> /proc/1426/maps will return the (virtual memory) address space of the
> process 1426.
>
> What I don't know for sure is if the actual CPU registers contain the
> virtual address of a running process or the "translated" by MMU physical
> address.
>
> I think that every access to a VA must be resolved to a corresponding PA
so
> I guess the CPU registers will deal with the physical addresses rather
than
> the virtual ones but I wanted to be sure about it.

The CPU registers will contain the virtual addresses. Each and every
time that the CPU tries to access a virtual memory location, then the
address will be translated by the MMU into a physical address.

Generally speaking. the only time you actually deal with physical
addresses is when you're setting up the MMU, and when programming
hardware (like DMA) which accesses memory without going through the
MMU.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com




More information about the Kernelnewbies mailing list