[Dri-devel] PPC Lockup (ati-pcigart-branch)
Roman Zippel
zippel at fh-brandenburg.de
Tue Jan 23 08:58:38 EST 2001
Hi,
On Mon, 22 Jan 2001, Dan Malek wrote:
> I do this:
>
> pgd = pgd_offset_k(i);
> if (pgd) {
> pmd = pmd_offset(pgd, i);
> if (pmd && pmd_present(*pmd)) {
> pte = pte_offset(pmd, i);
> if (pte && pte_present(*pte)) {
> /* Do your stuff */
> }
> }
> }
There is no need to test the pointers and you forgot a pgd_present(),
otherwise you might get a problem on architectures with 3-level mmus.
Anyway to get to the page struct, this should do it:
pgd = pgd_offset_k(addr);
if (!pgd_present(*pgd))
return NULL;
pmd = pmd_offset(pgd, addr);
if (!pmd_present(*pmd))
return NULL;
pte = pte_offset(pmd, addr);
if (!pte_present(*pte))
return NULL;
return pte_page(*pte);
bye, Roman
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list