Re: MMU ON: virtual vs. physical addressing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Yannick Chamming's [eMVP] (ychammings_nospam_at_adeset.com)
Date: 02/05/04


Date: Thu, 5 Feb 2004 14:36:29 +0100

in a more generic way, you can consider 3 types of memory :

Physical memory : this memory is accessed only from bootloader, before it
starts the MMU

"Kernel" Memory : this memory is accessed from the code executed in kernel
mode (depends on your build settings, but in most of the cases, this memory
is accessed from the OAL), once MMU is started. This memory maps the
physical memory according to a table dowloaded by the bootloader when it
starts the MMU. The area is from 0x80000000 to 0x9FFFFFFF for cached memory
and from 0xA0000000 to 0xBFFFFFFF for non cached memory. By some "language
abuses", it is sometime called Physical memory, which is confusing as it is
definitely virtual memory.

"User" memory: this memory is accessed from code executed in user mode. It
is in memory space 0x00000000 to 0x7FFFFFFF, depending on the process. It
can be mapped to Kernel memory using
VirtualAlloc / VirtualCopy. It is often called Virtual memory, which is
true, but the kernel memory is "Virtual memory" too.

So :

- When you are talking of "Physical memory", are you referring to real
physical or kernel memory ? Isn't it that the address received in parameter
is a "User Memory" address which is converted to a "Kernel memory" address ?

- You might have some references to real physical memory, even when MMU is
on : this is the case when you have to dowload an address to a register of a
chip (for example the Frame buffer address in the registers of a display
controller) : in this case, the chip will use "real" physical memory, so it
will need a real "physical" address.

--
----------------------------------------------------------------
Yannick Chamming's (eMVP)
ADESET
Windows Embedded Manager
ychammings AT adeset DOT com>
http://www.adeset.com
Tél  : +33 (0)4.72.18.57.77
Fax : +33 (0)4.72.18.57.78
----------------------------------------------------------------
"Inger" <inger72@online.no> wrote in message
news:41a44da6.0402050208.53146127@posting.google.com...
> I mave a question regarding virtual to physical mapping on the PXA255.
> I am in the process of writing the bootloader code for Windows CE 4.2.
> In my assembly code that gets executed initially, I turn on the MMU
> after having setup the translation table  base register and
> translation table itself in RAM. As far as I understand it, after the
> MMU is turned on, all addresses are treated as virtual and converted
> by using the translation table.
>
> However, what confuses me is when I look at the BSP code available,
> the actual writes to for instance Flash uses physical memory
> addresses. For instance, the FlashRead routine, translates the virtual
> address argument dwStartAddr to physical and calls all its lower level
> functions with this address. Also when dealing with PCMCIA, it looks
> like sometimes the code sets addresses in the physical space and write
> to for instance attribute memory, and other times I see code using
> virtual space. I don't see any MMU on/off switching, which leads me to
> believe that there are rules for when to use virtual and physical
> memory addressing that I need to know to develop working code (can't
> check it on hardware now as our development board is still a couple of
> weeks away).
>
> Can anybody help me with the rules for when I need to use virtual
> address space and when I need to use physical in the bootloader code
> after turning on the MMU?
>
> Regards,
> Inger


Relevant Pages

  • Re: Is there a maximum contiguous memory allocation?
    ... Most of it would be paged out most of the time, but could ALLOCATE it! ... allocate it if I had 2GB of physical memory! ... the amount of physical memory I have installed. ... Note that you can use raw VirtualAlloc to improve your ...
    (microsoft.public.vc.mfc)
  • Re: Is there a maximum contiguous memory allocation?
    ... but could ALLOCATE it! ... allocate it if I had 2GB of physical memory! ... the amount of physical memory I have installed. ... Note that you can use raw VirtualAlloc to improve your ...
    (microsoft.public.vc.mfc)
  • Re: Is there a maximum contiguous memory allocation?
    ... if you have enough virtual memory. ... physical memory is zero. ... Note that you can use raw VirtualAlloc to improve your chances of getting storage (malloc ... that did no other allocation, had no user DLLs loaded. ...
    (microsoft.public.vc.mfc)
  • Re: Is there a maximum contiguous memory allocation?
    ... if you have enough virtual memory. ... physical memory is zero. ... contiguous arrays to minimize page faults (the extra cost ... Note that you can use raw VirtualAlloc to improve your ...
    (microsoft.public.vc.mfc)
  • Re: RAM
    ... For applications that are I/O-intensive, ... The 4GT RAM Tuning feature increases the memory ... more than 2 GB of physical memory. ... VirtualAlloc function. ...
    (alt.os.windows-xp)