From: "Peter Teoh" <htmldeveloper@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: How to get the PTE pointer for a linear address?
Date: Fri, 17 Oct 2008 15:07:13 +0800 [thread overview]
Message-ID: <804dabb00810170007hacb0e97rdbd251664bb06de4@mail.gmail.com> (raw)
If I allocate kernel memory via alloc_page(GFP_KERNEL), and convert
that struct page pointer to linear address via page_address(), how do
I derive the PTE pointer of that page?
Following the source code, I did the following:
pgd_t *pgd = pgd_offset_k(address);
if (pgd_none(*pgd)) {
printk("no pgd ");
return 0;
}
pud = pud_offset(pgd, address);
if (pud_none(*pud)) {
printk("no pud ");
return 0;
}
pmd = pmd_offset(pud, address);
if (pmd_none(*pmd)) {
printk("no pmd ");
return 0;
}
pte = pte_offset_map(pmd, address);
===============> and in between here, the PTE pointer is returned
(from pte_offset_map())? And so the PTE structure (pte_t) should be
*pte?
pte_unmap(pte);
I suspect something is not right?
Thanks.
--
Regards,
Peter Teoh
reply other threads:[~2008-10-17 7:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=804dabb00810170007hacb0e97rdbd251664bb06de4@mail.gmail.com \
--to=htmldeveloper@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®