Re: PAGE_SIZE query

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

 



hi,

In the example 1 << PAGE_SHIFT, left shift gives me the address of page number 1  i.e. the address of second page in memory (page no. 0 is the first page).
now,
address of page number 1 (second page) - address of page number 0 (first page) == size of one page == PAGE_SIZE

so the left shift :)

cheers,
Nikhil

On Tue, Apr 22, 2008 at 2:08 AM, Nikhil Talpallikar <nikhil.talpallikar@xxxxxxxxx> wrote:


On Tue, Apr 22, 2008 at 1:54 AM, Mrunal Gawade <mrunal.gawade@xxxxxxxxx> wrote:
Right. But It should be always a right shift right? Why your example has a left shift 1 << PAGE_SHIFT?

use right shift ( of 32 bit address ) to get page number from the 32 bit address
use left shift ( of page number ) to get the 32 bit address of the first byte of that page


cheers,
Nikhil




[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