public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw@osc.edu>
To: Ingo Molnar <mingo@elte.hu>
Cc: mdaljeet@in.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: pte_page
Date: Wed, 30 May 2001 13:08:30 -0400	[thread overview]
Message-ID: <20010530130830.F14433@osc.edu> (raw)
In-Reply-To: <CA256A5C.002E4CF0.00@d73mta01.au.ibm.com> <Pine.LNX.4.33.0105301602430.1328-100000@localhost.localdomain>
In-Reply-To: <Pine.LNX.4.33.0105301602430.1328-100000@localhost.localdomain>; from mingo@elte.hu on Wed, May 30, 2001 at 04:09:33PM +0200

mingo@elte.hu said:
> On Wed, 30 May 2001 mdaljeet@in.ibm.com wrote:
> > I use the 'pgt_offset', 'pmd_offset', 'pte_offset' and 'pte_page'
> > inside a module to get the physical address of a user space virtual
> > address. The physical address returned by 'pte_page' is not page
> > aligned whereas the virtual address was page aligned. Can somebody
> > tell me the reason?
> 
> __pa(page_address(pte_page(pte))) is the address you want. [or
> pte_val(*pte) & (PAGE_SIZE-1) on x86 but this is platform-dependent.]

Does this work on x86 non-kmapped highmem user pages too?  (i.e. is
page->virtual valid for every potential user page.)

		-- Pete

> > Also, can i use these functions to get the physical address of a
> > kernel virtual address using init_mm?
> 
> nope. Eg. on x86 these functions only walk normal 4K page pagetables, they
> do not walk 4MB pages correctly. (which are set up on pentiums and better
> CPUs, unless mem=nopentium is specified.)
> 
> a kernel virtual address can be decoded by simply doing __pa(kaddr). If
> the page is a highmem page [and you have the struct page pointer] then you
> can do [(page-mem_map) << PAGE_SHIFT] to get the physical address, but
> only on systems where mem_map[] starts at physical address 0.

  reply	other threads:[~2001-05-30 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-30  8:01 pte_page mdaljeet
2001-05-30 12:26 ` pte_page Brian Gerst
2001-05-30 12:38   ` pte_page Brian Gerst
2001-05-30 14:09 ` pte_page Ingo Molnar
2001-05-30 17:08   ` Pete Wyckoff [this message]
2001-05-30 17:39     ` pte_page Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2001-05-31  9:57 pte_page mdaljeet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010530130830.F14433@osc.edu \
    --to=pw@osc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdaljeet@in.ibm.com \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox