Re: About swapper_pg_dir

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

 



Hi Bao Zhao,

>The ïrst pointers to pg0 and pg1
> are placed to cover the region 1-9MiB; the second pointers to pg0 and pg1
> are placed
> at PAGE OFFSET+1MiB

As you said the pg0 and pg1 covers the region 1-9 MiB.But what the
above lines says is about the swapper_pg_dir entries.pg0 contains 1024
entries which cover the first 4 MiB of the Physical memory and pg1
anothet 1024 entires which cover the next 4 MiB of physical memory.

In order for the kernel to be addressable to be in both real mode and
protected mode,the 0th entry(Covers the linear address 0-4MiB) and the
368th entry(from PAGE_OFFSET-0xC0000000,this covers the linear address
PAGE_OFFSET+4MiB )
of the swapper_pg_dir must contain the address of pg0(page table which
covers the first 4 MiB of the physical memory). In this way the kernel
can address the first 4Mib of Physical memory either using the linear
addresses that are identical to the Physical addresses(0th entry of
the page directory) or using the 4MiB worth of linear addresses from
PAGE_OFFSET.This is done in the startup_32 present in head.S of the
kernel code.This is ofcourse the provisional kernel page table.

The Final kernel page table is initialized by the paging_init function
which unmaps the  0th entry of the sapper_pg_dir and maps the linear
addresses starting from PAGE_OFFSET till the end_mem of the kernel.So
after the provisional page table pg0 is not used,user mode processes
can now use the Linear addresses ranging from 0-4MIB.This also helps
us trap NULL-reference errors in the kernel. This is done in the
paging_init function of linux/arch/i386/mm/init.c of the kernel.

Do correct me if i am wrong anywhere.

Regards
Saravanan S

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux