Re: x86 pages, page tables, and page table entries

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

 



Hi,

Le Mon, 21 Jan 2008 23:43:47 +0100,
"Vegard Nossum" <vegard.nossum@xxxxxxxxx> a écrit :

> I am experiencing something strange about pages and ptes on x86. I am
> calling alloc_pages() with order = 1 (should be 2 pages). This returns
> a struct page with virtual address c7800000 (returned by
> page_address()). Now I call lookup_address() on the same address, and
> the pte is located at c0438c78. So far, so good. But if I try to call
> lookup_address() on the next page (i.e. address 7801000), this returns
> a pte which is located at c7800004. How can this happen? This would
> mean that the pte is inside the previous page, which is nonsense,
> since it was just returned to me by the page allocator.
> 
> Does anybody know immediately what I am doing wrong here? Help is
> appreciated. Thanks.

You say that you use the "struct page" virtual address to call
lookup_address(), but a quick look to this function leads me to think
that it takes the virtual address of the page itself, not the struct
page address.

Moreover, if c7800000 is the address of a struct page (and not of
*your* page), then 0x7801000 is not the address of the second page, but
just some random part of the mem_map[] array.

I'd say you're making a confusion between struct page addresses and the
page address itself. Use page_address() to convert a struct page
address to the real page virtual address.

Sincerly,

Thomas
-- 
Thomas Petazzoni, thomas.petazzoni@xxxxxxxxxxxxxxxxxx
Free Electrons
http://free-electrons.com

Attachment: signature.asc
Description: PGP signature


[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