All of lore.kernel.org
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: identity mapped paging
Date: Tue, 19 Jun 2012 08:54:43 -0700	[thread overview]
Message-ID: <CABi1daFJO6DAfPHEfSVXZ9HJK4p0o3ZCuZZAnAXpxHHm0R_Fzg@mail.gmail.com> (raw)
In-Reply-To: <CAKuUYSy-j5HogDpg0-9j5RrVSPbNObBDKqafBEPgCTjHO2twFA@mail.gmail.com>

Hi Vaibhav,

On Wed, Apr 11, 2012 at 2:22 PM, Vaibhav Jain <vjoss197@gmail.com> wrote:
> I am not clear about the use of identity mapped paging while paging is being
> enabled by the operating system. Also I don't understand at what point are
> the
> identity mappings no longer useful.According to this article
> http://geezer.osdevbrasil.net/osd/mem/index.htm#identity?- "The page table
> entries used to identity-map kernel memory can be deleted once paging and
> virtual addresses are enabled." Can somebody please explain?

The identity mapping are used when the MMU is first enabled. I'm most
familiar with the ARM, so the rest of my comments are ARM specific.

When the kernel first gets control, the MMU is off, so virtual
addresses == physical addresses.

The kernel sets up a small identity mapping (virtual == physical) as
well as a the kernel direct mapping. This happens in assembler code
before any C code in the kernel runs.
http://lxr.linux.no/linux+v3.4.3/arch/arm/kernel/head.S#L203

The identity mapping is needed for the code that turns on the MMU. The
identity mapping is only needed for a few instructions. If you look at
http://lxr.linux.no/linux+v3.4.3/arch/arm/kernel/head.S#L451

The identity mapping is really only needed while lines 454 thru 459
execute. The mov pc, r13 instruction changes the PC to be in the
0xCxxxxxxx range (assuming a normal 3G user/ 1G kernel split is being
used).

Later on, in paging_init (which is written in C), that identity
mapping is removed, and the MMU is setup properly for the rest of the
kernel.

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

      parent reply	other threads:[~2012-06-19 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 21:22 identity mapped paging Vaibhav Jain
2012-06-19  9:23 ` subin gangadharan
2012-06-19 15:54 ` Dave Hylands [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABi1daFJO6DAfPHEfSVXZ9HJK4p0o3ZCuZZAnAXpxHHm0R_Fzg@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.