Re: Need for SHIFT and MASK
From: Fawad Lateef
Date: Sun Oct 09 2005 - 19:21:43 EST
On 10/9/05, Vivek Kutal <vivek.kutal@xxxxxxxxx> wrote:
> > This is usally table driven and someone has to set up
> > this "Page Translation Tables". That's a job of the Linux kernel.
> Yes setting up the page table entries is the job of the kernel , but
> for that we need to put the physical add. of the page and some bits
> (present,access writes etc) in the entry, once it is done the main job
> of translation which requires the masking and shifting is done by the
> processor whenever that page is referenced .
> so why these macros are present in the kernel?
The setting of the Page Translation Tables are done by the Kernel, and
processor actually do the traversing over those page table entries
(PGD, PMD, PTE) to get the physical address of the page and then add
the last 12-bits of virtual/linear address to get to the physical
And as far as SHIFT, MASK, SIZE macros are concerned they are used in
creating Page Translation Tables and also used to get the translation
from linear to physical, SIZE macro used to get the current PAGE_SIZE,
SHIFT can be used to get PFN etc in Kernel Code ....
(I might not able to explain, just b/c I think your question is not so
clear to me !!!). You better study the stuffs and search in the kernel
code for those SHIFT, MASK, SIZE macros and you will see where they
are needed and used !!!!!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/