Re: identity mapped paging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Vaibhav,

On Wed, Apr 11, 2012 at 2:22 PM, Vaibhav Jain <vjoss197@xxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux